-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathex00.c
47 lines (32 loc) · 1.17 KB
/
ex00.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <unistd.h>
#include <stdio.h>
#include "../ex00/ft_strcmp.c"
int ft_strcmp(char *s1, char *s2);
int main(void) {
char str_cmp1[] = "ABCDEFA";
char str_cmp2[] = "ABCDEFZ";
char empty[] = "";
unsigned int ret=0;
printf("Calling ft_strcmp(s1,s2);\n");
ret=ft_strcmp(str_cmp1,str_cmp1);
if (ret == 0)
printf("Comparing [s1] %s with [s2] %s | PASS ret %d\n",str_cmp1,str_cmp1,ret);
else
printf("Comparing [s1] %s with [s2] %s | FAIL ret %d\n",str_cmp1,str_cmp1,ret);
ret=ft_strcmp(str_cmp2,str_cmp1);
if (ret == 25)
printf("Comparing [s1] %s with [s2] %s | PASS ret %d\n",str_cmp2,str_cmp1,ret);
else
printf("Comparing [s1] %s with [s2] %s | FAIL ret %d\n",str_cmp2,str_cmp1,ret);
ret=ft_strcmp(str_cmp1,str_cmp2);
if ((int)ret == -25)
printf("Comparing [s1] %s with [s2] %s | PASS ret %d\n",str_cmp1,str_cmp2,ret);
else
printf("Comparing [s1] %s with [s2] %s | FAIL ret %d\n",str_cmp1,str_cmp2,ret);
ret=ft_strcmp(str_cmp2,empty);
if (ret == 65)
printf("Comparing [s1] %s with [s2] \"\" | PASS ret %d\n",str_cmp2,ret);
else
printf("Comparing [s1] %s with [s2] \"\" | FAIL ret %d\n",str_cmp2,ret);
return (0);
}