-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathft_strstr_test.cpp
More file actions
84 lines (57 loc) · 1.44 KB
/
ft_strstr_test.cpp
File metadata and controls
84 lines (57 loc) · 1.44 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
extern "C"
{
#define new hackademy
#include "libft.h"
#undef new
}
#include "sigsegv.hpp"
#include "check.hpp"
#include "leaks.hpp"
#include <string.h>
int iTest = 1;
int main(void)
{
signal(SIGSEGV, sigsegv);
title("ft_strstr\t: ")
char *s1 = (char *) "FF";
char *s2 = (char *) "see FF your FF return FF now FF";
char *i1 = strstr(s2, s1);
char *i2 = ft_strstr(s2, s1);
/* 1 */ check(i1 == i2);
s1 = (char *) "MZIRIBMZIRIBMZP";
s2 = (char *) "MZIRIBMZP";
i1 = strstr(s2, s1);
i2 = ft_strstr(s2, s1);
/* 2 */ check(i1 == i2);
s2 = (char *) "FF";
s1 = (char *) "see F your F return FF now FF";
i1 = strstr(s2, s1);
i2 = ft_strstr(s2, s1);
/* 3 */ check(i1 == i2);
s1 = (char *) "FF";
s2 = (char *) "see F your F return F now FF";
i1 = strstr(s2, s1);
i2 = ft_strstr(s2, s1);
/* 4 */ check(i1 == i2);
s1 = (char *) "";
s2 = (char *) "";
i1 = strstr(s2, s1);
i2 = ft_strstr(s2, s1);
/* 5 */ check(i1 == i2);
s1 = (char *) "can't found that";
s2 = (char *) "in this !";
i1 = strstr(s2, s1);
i2 = ft_strstr(s2, s1);
/* 6 */ check(i1 == i2);
s1 = (char *) "";
s2 = (char *) "oh no not the empty string !";
i1 = strstr(s2, s1);
i2 = ft_strstr(s2, s1);
/* 7 */ check(i1 == i2);
s1 = (char *) "AAAAAAAAAAAAA";
i1 = strstr(s1, s1);
i2 = ft_strstr(s1, s1);
/* 8 */ check(i1 == i2);
write(1, "\n", 1);
return (0);
}