Line | Branch | Exec | Source |
---|---|---|---|
1 | /* | ||
2 | ** EPITECH PROJECT, 2023 | ||
3 | ** test_my_lib | ||
4 | ** File description: | ||
5 | ** Unit tests for each function of the my lib | ||
6 | */ | ||
7 | /** | ||
8 | * @file test_my_lib.c | ||
9 | * @brief Unit tests for each function of the my lib | ||
10 | * @author Nicolas TORO | ||
11 | */ | ||
12 | |||
13 | #include "criterion/criterion.h" | ||
14 | #include "criterion/redirect.h" | ||
15 | #include "../include/my.h" | ||
16 | |||
17 | 4 | Test(my_compute_factorial_rec, full_covr) | |
18 | { | ||
19 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_compute_factorial_rec(3), 6); |
20 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_compute_factorial_rec(15), 0); |
21 | 2 | } | |
22 | |||
23 | 4 | Test(my_compute_power_rec, full_covr) | |
24 | { | ||
25 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_compute_power_rec(3, 2), 9); |
26 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_compute_power_rec(21, 0), 1); |
27 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_compute_power_rec(-4, -4), 0); |
28 | 2 | } | |
29 | |||
30 | 4 | Test(my_compute_square_root, full_covr) | |
31 | { | ||
32 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_compute_square_root(25), 5); |
33 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_compute_square_root(0), 0); |
34 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_compute_square_root(-4), 0); |
35 | 2 | } | |
36 | |||
37 | 4 | Test(my_concat_params, full_covr) | |
38 | { | ||
39 | 2 | int argc = 4; | |
40 | 2 | char *argv[] = {"unit_tests", "coucou", "ça", "va"}; | |
41 | |||
42 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_concat_params(argc, argv)); |
43 | 2 | } | |
44 | |||
45 | 4 | Test(my_convert_base, full_covr) | |
46 | { | ||
47 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_convert_base("-10", "0123456789", "01")); |
48 | 2 | } // NE PASSE PAS CAR NE PRINT PAS LE DERNIER 0 | |
49 | |||
50 | 4 | Test(my_convert_base_unsigned, full_covr) | |
51 | { | ||
52 |
6/16✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 1 times.
|
2 | cr_assert_str_eq(my_convert_base_unsigned("10", "0123456789", "01"), "1010"); |
53 |
6/16✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 1 times.
|
2 | cr_assert_str_eq(my_convert_base_unsigned("10a10", "0123456789", "01"), "1010"); |
54 | 2 | } | |
55 | |||
56 | 4 | Test(my_find_prime_sup, full_covr) | |
57 | { | ||
58 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_find_prime_sup(9), 11); |
59 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_find_prime_sup(0)); |
60 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_find_prime_sup(4)); |
61 | 2 | } | |
62 | |||
63 | 4 | Test(my_getnbr_base, full_covr) | |
64 | { | ||
65 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_getnbr_base("10", "0123456789"), 10); |
66 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_getnbr_base("a10", "0123456789")); |
67 | 2 | } | |
68 | |||
69 | 4 | Test(my_getnbr, full_covr) | |
70 | { | ||
71 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_getnbr("-10"), -10); |
72 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_getnbr("-2147483648"), -2147483648); |
73 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_getnbr("a54"), 0); |
74 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_getnbr("00012345667"), 0); |
75 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_getnbr("42"), 42); |
76 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_getnbr("-+21"), 21); |
77 | 2 | } | |
78 | |||
79 | 4 | Test(my_isneg, full_covr) | |
80 | { | ||
81 | 2 | my_isneg(-10); | |
82 | 2 | my_isneg(10); | |
83 | 2 | } | |
84 | |||
85 | 4 | Test(my_is_prime, full_covr) | |
86 | { | ||
87 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_is_prime(0), 0); |
88 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_is_prime(7), 1); |
89 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_is_prime(9), 0); |
90 | 2 | } | |
91 | |||
92 | 4 | Test(my_params_to_array, full_covr) | |
93 | { | ||
94 | 2 | char *test[] = {"unittests", "coucou"}; | |
95 | |||
96 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_params_to_array(0, test)); |
97 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_params_to_array(1, test)); |
98 | //cr_assert(my_params_to_array(2, argv)); | ||
99 | 2 | } | |
100 | |||
101 | 4 | Test(my_print_combn, full_covr) | |
102 | { | ||
103 | 2 | my_print_combn(3); | |
104 | 2 | } | |
105 | |||
106 | 4 | Test(my_print_params, full_covr, .init = cr_redirect_stdout) | |
107 | { | ||
108 | 2 | char *argv[] = {"unit_tests", "coucou"}; | |
109 | |||
110 | 2 | my_print_params(2, argv); | |
111 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_stdout_eq_str("unit_tests\ncoucou\n"); |
112 | 2 | } | |
113 | |||
114 | 4 | Test(my_putnbr, fullcovr, .init = cr_redirect_stdout) | |
115 | { | ||
116 | 2 | my_putnbr(-2400934); | |
117 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_stdout_eq_str("-2400934"); |
118 | 2 | } | |
119 | |||
120 | 4 | Test(my_putnbr, fullcovr_2, .init = cr_redirect_stdout) | |
121 | { | ||
122 | 2 | my_putnbr(-2147483648); | |
123 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_stdout_eq_str("-2147483648"); |
124 | 2 | } | |
125 | |||
126 | 4 | Test(my_putnbr_base, fullcovr, .init = cr_redirect_stdout) | |
127 | { | ||
128 | 2 | my_putnbr_base(-10, "0123456789"); | |
129 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_stdout_eq_str("-10"); |
130 | 2 | } | |
131 | |||
132 | 4 | Test(my_putstr_error, full_covr) | |
133 | { | ||
134 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_putstr_error("ok"), 84); |
135 | 2 | } | |
136 | |||
137 | 4 | Test(my_putstr_sized, full_covr) | |
138 | { | ||
139 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_putstr_sized("ok", 2), 2); |
140 | 2 | } | |
141 | |||
142 | 4 | Test(my_rev_params, full_covr, .init = cr_redirect_stdout) | |
143 | { | ||
144 | 2 | char *argv[] = {"unit_tests", "coucou"}; | |
145 | |||
146 | 2 | my_rev_params(2, argv); | |
147 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_stdout_eq_str("coucou\nunit_tests\n"); |
148 | 2 | } | |
149 | |||
150 | 4 | Test(my_rev_str, full_covr) | |
151 | { | ||
152 | 2 | char str[6] = "kayak\0"; | |
153 | |||
154 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_revstr(str)); |
155 | 2 | } | |
156 | |||
157 | 4 | Test(my_show_param, full_covr, .init = cr_redirect_stdout) | |
158 | { | ||
159 | 2 | char str[6] = "kayak\0"; | |
160 | struct info_param struct1; | ||
161 | struct info_param struct2; | ||
162 | struct info_param par[2]; | ||
163 | |||
164 | 2 | struct1.length = my_strlen(str); | |
165 | 2 | struct1.str = str; | |
166 | 2 | struct1.copy = my_strdup(str); | |
167 | 2 | struct1.word_array = my_str_to_word_array(str); | |
168 | 2 | struct2.length = 0; | |
169 | 2 | struct2.str = ""; | |
170 | 2 | struct2.copy = ""; | |
171 | 2 | struct2.word_array = my_str_to_word_array(""); | |
172 | 2 | par[0] = struct1; | |
173 | 2 | par[1] = struct2; | |
174 | 2 | my_show_param_array(par); | |
175 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_stdout_eq_str("kayak\n5\nkayak\n"); |
176 | 2 | } | |
177 | |||
178 | 4 | Test(my_show_word_array, full_covr, .init = cr_redirect_stdout) | |
179 | { | ||
180 | 2 | char *test[] = {"unit_tests", "coucou"}; | |
181 | |||
182 | 2 | my_show_word_array(NULL); | |
183 | 2 | my_show_word_array(test); | |
184 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_stdout_eq_str("unit_tests\ncoucou\n"); |
185 | 2 | } | |
186 | |||
187 | 4 | Test(my_show_mem, full_covr) | |
188 | { | ||
189 | 2 | char str[8] = "hel\n\blo\0"; | |
190 | |||
191 | 2 | my_showmem(str, my_strlen(str)); | |
192 | 2 | } | |
193 | |||
194 | 4 | Test(my_show_str, full_covr) | |
195 | { | ||
196 | 2 | char str[8] = "hel\nl\bo\0"; | |
197 | |||
198 | 2 | my_showstr(str); | |
199 | 2 | } | |
200 | |||
201 | 4 | Test(my_sort_int_array, full_covr) | |
202 | { | ||
203 | 2 | int tab_int[5] = {0, 5, 12, 42}; | |
204 | |||
205 | 2 | my_sort_int_array(tab_int, 5); | |
206 |
3/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 times.
|
2 | cr_assert_eq(tab_int[0], 0); |
207 | 2 | } | |
208 | |||
209 | 4 | Test(my_sort_params, full_covr) | |
210 | { | ||
211 | 2 | char *argv1[] = {"unit_tests", "coucou", "wesh"}; | |
212 | 2 | char *argv2[] = {"coucoulL", "coucou", "coucoul"}; | |
213 | 2 | char *argv3[] = {"unit_tests", "unit_tests", "wesh"}; | |
214 | |||
215 | 2 | my_sort_params(3, argv1); | |
216 | 2 | my_sort_params(3, argv2); | |
217 | 2 | my_sort_params(3, argv3); | |
218 |
6/16✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 1 times.
|
2 | cr_assert_str_eq(argv1[2], "coucou"); |
219 |
6/16✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 1 times.
|
2 | cr_assert_str_eq(argv2[0], "coucoulL"); |
220 |
6/16✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 20 not taken.
✓ Branch 21 taken 1 times.
|
2 | cr_assert_str_eq(argv3[2], "unit_tests"); |
221 | 2 | } //ça tri mais à l'envers -> à fix | |
222 | |||
223 | 4 | Test(my_str_is_alpha, full_covr) | |
224 | { | ||
225 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_isalpha("Coucou"), 1); |
226 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_isalpha("124"), 0); |
227 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_isalpha(""), 1); |
228 | 2 | } | |
229 | |||
230 | 4 | Test(my_str_is_lower, full_covr) | |
231 | { | ||
232 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_islower("Coucou"), 0); |
233 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_islower("124"), 0); |
234 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_islower(""), 1); |
235 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_islower("oui"), 1); |
236 | 2 | } | |
237 | |||
238 | 4 | Test(my_str_is_num, full_covr) | |
239 | { | ||
240 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_isnum("Coucou"), 0); |
241 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_isnum("124"), 1); |
242 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_isnum(""), 1); |
243 | 2 | } | |
244 | |||
245 | 4 | Test(my_str_is_printable, full_covr) | |
246 | { | ||
247 | char str[2]; | ||
248 | |||
249 | 2 | str[0] = 31; | |
250 | 2 | str[1] = '\0'; | |
251 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_isprintable("Coucou"), 1); |
252 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_isprintable(str), 0); |
253 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_isprintable(""), 1); |
254 | 2 | } | |
255 | |||
256 | 4 | Test(my_str_is_upper, full_covr) | |
257 | { | ||
258 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_isupper("Coucou"), 0); |
259 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_isupper("9"), 0); |
260 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_isupper("abc"), 0); |
261 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_isupper(""), 1); |
262 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_isupper("ABC"), 1); |
263 | 2 | } | |
264 | |||
265 | 4 | Test(my_str_nbr, full_covr) | |
266 | { | ||
267 |
6/16✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 1 times.
|
2 | cr_assert_str_eq(my_str_nbr(-12), "-12"); |
268 | 2 | } | |
269 | |||
270 | 4 | Test(my_str_nbr, full_covr_2, .init = cr_redirect_stdout) | |
271 | { | ||
272 |
6/16✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 1 times.
|
2 | cr_assert_str_eq(my_str_nbr(-2147483648), "-2147483648"); |
273 | 2 | } | |
274 | |||
275 | 4 | Test(my_str_nbr_base_long_long_int, full_covr_2) | |
276 | { | ||
277 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_base_long_long_int(-12, "0123456789")); |
278 | 2 | } | |
279 | |||
280 | 4 | Test(my_str_nbr_base_unsigned, full_covr) | |
281 | { | ||
282 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_base_unsigned(12, "0123456789")); |
283 | 2 | } | |
284 | |||
285 | 4 | Test(my_str_nbr_long_long, full_covr) | |
286 | { | ||
287 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_long_long(-12)); |
288 | 2 | } | |
289 | |||
290 | 4 | Test(my_str_nbr_long_long, full_covr_2) | |
291 | { | ||
292 |
6/16✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 1 times.
|
2 | cr_assert_str_eq(my_str_nbr_long_long(-9223372036854775807), "-9223372036854775807"); |
293 | 2 | } | |
294 | |||
295 | 4 | Test(my_str_nbr_size_t, full_covr) | |
296 | { | ||
297 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_size_t(12)); |
298 | 2 | } | |
299 | |||
300 | 4 | Test(my_str_nbr_unsigned, full_covr) | |
301 | { | ||
302 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_unsigned(12)); |
303 | 2 | } | |
304 | |||
305 | 4 | Test(my_str_nbr_unsigned_long, full_covr) | |
306 | { | ||
307 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_unsigned_long(12)); |
308 | 2 | } | |
309 | |||
310 | 4 | Test(my_str_to_word_array, full_covr, .init = cr_redirect_stdout) | |
311 | { | ||
312 | 2 | char *str = "----hello 9coucou.çava/oui"; | |
313 | 2 | char **test = my_str_to_word_array(str); | |
314 | |||
315 | 2 | my_show_word_array(test); | |
316 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_stdout_eq_str("hello\n9coucou\nava\noui\n"); |
317 | 2 | } | |
318 | |||
319 | 4 | Test(my_strcapitalize, full_covr) | |
320 | { | ||
321 | 2 | char str[6] = "c cac\0"; | |
322 | |||
323 |
6/16✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 21 not taken.
✓ Branch 22 taken 1 times.
|
2 | cr_assert_str_eq(my_strcapitalize(str), "C Cac"); |
324 | 2 | } | |
325 | |||
326 | 4 | Test(my_strcat, full_covr) | |
327 | { | ||
328 | 2 | char str[30] = "coucou"; | |
329 | 2 | char src[5] = "caca\0"; | |
330 | |||
331 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_strcat(str, src)); |
332 | 2 | my_strcat(NULL, src); | |
333 | 2 | my_strcat(str, NULL); | |
334 | 2 | } | |
335 | |||
336 | 4 | Test(my_strcmp, full_covr) | |
337 | { | ||
338 | 2 | char str[7] = "cbbcbb\0"; | |
339 | 2 | char src[7] = "caacaa\0"; | |
340 | |||
341 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strcmp(str, str), 0); |
342 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strcmp(str, src), 1); |
343 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strcmp(src, str), -1); |
344 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strcmp(NULL, NULL), 0); |
345 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strcmp(NULL, src), -99); |
346 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strcmp(str, NULL), 99); |
347 | 2 | } | |
348 | |||
349 | 4 | Test(my_strcpy, full_covr) | |
350 | { | ||
351 | 2 | char str[7] = "coucou\0"; | |
352 | char src[7]; | ||
353 | |||
354 | 2 | my_strcpy(src, str); | |
355 |
3/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 times.
|
2 | cr_assert_eq(str[0], src[0]); |
356 | 2 | } | |
357 | |||
358 | 4 | Test(my_strncmp, full_covr) | |
359 | { | ||
360 | 2 | char str[7] = "cbbcbb\0"; | |
361 | 2 | char src[7] = "caacaa\0"; | |
362 | |||
363 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strncmp(str, str, 6), 0); |
364 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strncmp(src, str, 6), -1); |
365 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strncmp(str, src, 6), 1); |
366 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strncmp(NULL, NULL, 6), 0); |
367 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strncmp(NULL, src, 6), -99); |
368 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strncmp(str, NULL, 6), 99); |
369 | 2 | } | |
370 | |||
371 | 4 | Test(my_strncat, full_covr) | |
372 | { | ||
373 | 2 | char str[30] = "coucou"; | |
374 | 2 | char src[5] = "caca\0"; | |
375 | |||
376 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_strncat(str, src, 2)); |
377 | 2 | my_strncat(NULL, src, 2); | |
378 | 2 | my_strncat(str, NULL, 2); | |
379 | 2 | } | |
380 | |||
381 | 4 | Test(my_strlowcase, full_covr) | |
382 | { | ||
383 | 2 | char str[30] = "couCou"; | |
384 | |||
385 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_strlowcase(str)); |
386 | 2 | } | |
387 | |||
388 | 4 | Test(my_strncpy, full_covr) | |
389 | { | ||
390 | 2 | char str[7] = "coucou\0"; | |
391 | char src[7]; | ||
392 | |||
393 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_strncpy(src, str, 10)); |
394 | 2 | } | |
395 | |||
396 | 4 | Test(my_strstr, full_covr) | |
397 | { | ||
398 | 2 | char str[7] = "cbbcbb\0"; | |
399 | 2 | char src[4] = "cbb\0"; | |
400 | |||
401 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strstr(NULL, src), 0); |
402 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strstr(str, NULL), 0); |
403 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_strstr(str, src)); |
404 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_strstr(str, "")); |
405 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strstr(str, "la"), 0); |
406 | 2 | } | |
407 | |||
408 | 4 | Test(my_strupcase, full_covr) | |
409 | { | ||
410 | 2 | char str[30] = "couCou"; | |
411 | |||
412 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_strupcase(str)); |
413 | 2 | } | |
414 | |||
415 | 4 | Test(my_swap, full_covr) | |
416 | { | ||
417 | 2 | int a = 5; | |
418 | 2 | int b = 10; | |
419 | |||
420 | 2 | my_swap(&a, &b); | |
421 |
3/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 times.
|
2 | cr_assert_eq(b, 5); |
422 | 2 | } | |
423 | |||
424 | 4 | Test(my_array_len, full_covr) | |
425 | { | ||
426 | 2 | char *tab[5] = {"a", "b", "c", "d", NULL}; | |
427 | |||
428 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_array_len((void **)tab), 4); |
429 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_array_len((void **)NULL), 0); |
430 | 2 | } | |
431 | |||
432 | 4 | Test(my, full_covr_for_null_return) | |
433 | { | ||
434 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_strlen(NULL), 0); |
435 | 2 | my_strdup(NULL); | |
436 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_putstr_sized(NULL, 0), 0); |
437 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_putstr_error(NULL)); |
438 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_putstr(NULL), 0); |
439 | 2 | } | |
440 | |||
441 | 4 | Test(my_char_is, full_covr) | |
442 | { | ||
443 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_char_is('a', "abc"), 1); |
444 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_char_is('a', "bc"), 0); |
445 | 2 | } | |
446 | |||
447 | 4 | Test(my_compute_power_rec_size_t, full_covr) | |
448 | { | ||
449 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_compute_power_rec_size_t(3, 2), 9); |
450 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_compute_power_rec_size_t(21, 0), 1); |
451 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_compute_power_rec_size_t(-4, -4), 0); |
452 | 2 | } | |
453 | |||
454 | 4 | Test(my_convert_base_size_t, full_covr) | |
455 | { | ||
456 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_convert_base_size_t("10", "0123456789", "01")); |
457 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_convert_base_size_t("10a10", "0123456789", "01")); |
458 | 2 | } | |
459 | |||
460 | 4 | Test(my_find_nbr, full_covr) | |
461 | { | ||
462 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_find_nbr("10"), 10); |
463 | 2 | my_find_nbr("a54"); | |
464 | 2 | my_find_nbr(""); | |
465 | 2 | my_find_nbr("abc"); | |
466 | 2 | my_find_nbr("0"); | |
467 | 2 | } | |
468 | |||
469 | 4 | Test(my_find_prime_inf, full_covr) | |
470 | { | ||
471 | 2 | my_find_prime_inf(9); | |
472 | 2 | my_find_prime_inf(0); | |
473 | 2 | my_find_prime_inf(4); | |
474 | 2 | } | |
475 | |||
476 | 4 | Test(my_free_ptr, full_covr) | |
477 | { | ||
478 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_free_ptr(NULL), NULL); |
479 | 2 | } | |
480 | |||
481 | 4 | Test(my_str_contains, full_covr) | |
482 | { | ||
483 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_contains(NULL, "a"), 0); |
484 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_contains("coucou", NULL), 0); |
485 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_contains("coucou", "c"), 1); |
486 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_contains("coucou", "a"), 0); |
487 | 2 | } | |
488 | |||
489 | 4 | Test(my_strdup_word_array, full_covr) | |
490 | { | ||
491 | 2 | char *tab[5] = {"a", "b", "c", "d", NULL}; | |
492 | |||
493 | 2 | char **test = my_strdup_word_array(tab); | |
494 | 2 | my_strdup_word_array(NULL); | |
495 | 2 | my_free_array((void **)test); | |
496 | 2 | my_free_array((void **)NULL); | |
497 | 2 | } | |
498 | |||
499 | 4 | Test(my_strerror, full_covr) | |
500 | { | ||
501 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_strerror(0)); |
502 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_strerror(1)); |
503 | 2 | my_strerror(-2); | |
504 | 2 | } | |
505 | |||
506 | 4 | Test(my_str_nbr_short, full_covr) | |
507 | { | ||
508 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_short(12)); |
509 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_short(-12)); |
510 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_short(-32768)); |
511 | 2 | } | |
512 | |||
513 | 4 | Test(my_str_nbr_short_short, full_covr) | |
514 | { | ||
515 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_short_short(12)); |
516 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_short_short(-12)); |
517 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_short_short(-128)); |
518 | 2 | } | |
519 | |||
520 | 4 | Test(my_str_nbr_base_unsigned_short, full_covr) | |
521 | { | ||
522 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_base_unsigned_short(12, "0123456789")); |
523 | 2 | } | |
524 | |||
525 | 4 | Test(my_str_nbr_base_unsigned_short_short, full_covr) | |
526 | { | ||
527 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_base_unsigned_short_short(12, "0123456789")); |
528 | 2 | } | |
529 | |||
530 | 4 | Test(my_str_nbr_base_unsigned_size_t, full_covr) | |
531 | { | ||
532 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_base_unsigned_size_t(12, "0123456789")); |
533 | 2 | } | |
534 | |||
535 | 4 | Test(my_str_nbr_base_unsigned_long, full_covr) | |
536 | { | ||
537 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_str_nbr_base_unsigned_long(12, "0123456789")); |
538 | 2 | } | |
539 | |||
540 | 4 | Test(my_getnbr_float, full_covr) | |
541 | { | ||
542 | 2 | my_getnbr_float("12.5"); | |
543 | 2 | my_getnbr_float("12.5a"); | |
544 | 2 | my_getnbr_float("a12.5"); | |
545 | 2 | my_getnbr_float("12.5a12.5"); | |
546 | 2 | my_getnbr_float("-12.5"); | |
547 | 2 | my_getnbr_float("-10"); | |
548 | 2 | my_getnbr_float("-2147483648"); | |
549 | 2 | my_getnbr_float("a54"); | |
550 | 2 | my_getnbr_float("00012345667"); | |
551 | 2 | my_getnbr_float("42"); | |
552 | 2 | my_getnbr_float("-+21"); | |
553 | 2 | } | |
554 | |||
555 | 4 | Test(my_strict, full_covr) | |
556 | { | ||
557 | 2 | my_strict_getnbr(""); | |
558 | 2 | my_strict_getnbr("12.5"); | |
559 | 2 | my_strict_getnbr("12.5a"); | |
560 | 2 | my_strict_getnbr("a12.5"); | |
561 | 2 | my_strict_getnbr("12.5a12.5"); | |
562 | 2 | my_strict_getnbr("-12.5"); | |
563 | 2 | my_strict_getnbr("-10"); | |
564 | 2 | my_strict_getnbr("-2147483648"); | |
565 | 2 | my_strict_getnbr("a54"); | |
566 | 2 | my_strict_getnbr("00012345667"); | |
567 | 2 | my_strict_getnbr("42"); | |
568 | 2 | my_strict_getnbr("-+21"); | |
569 | 2 | my_strict_getnbr_float(""); | |
570 | 2 | my_strict_getnbr_float("12.5"); | |
571 | 2 | my_strict_getnbr_float("12.5a"); | |
572 | 2 | my_strict_getnbr_float("a12.5"); | |
573 | 2 | my_strict_getnbr_float("12.5a12.5"); | |
574 | 2 | my_strict_getnbr_float("-12.5"); | |
575 | 2 | my_strict_getnbr_float("-10"); | |
576 | 2 | my_strict_getnbr_float("-2147483648"); | |
577 | 2 | my_strict_getnbr_float("a54"); | |
578 | 2 | my_strict_getnbr_float("00012345667"); | |
579 | 2 | my_strict_getnbr_float("42"); | |
580 | 2 | my_strict_getnbr_float("-+21"); | |
581 | 2 | my_strict_find_nbr(""); | |
582 | 2 | my_strict_find_nbr("12.5"); | |
583 | 2 | my_strict_find_nbr("12.5a"); | |
584 | 2 | my_strict_find_nbr("a12.5"); | |
585 | 2 | my_strict_find_nbr("12.5a12.5"); | |
586 | 2 | my_strict_find_nbr("-12.5"); | |
587 | 2 | my_strict_find_nbr("-10"); | |
588 | 2 | my_strict_find_nbr("-2147483648"); | |
589 | 2 | my_strict_find_nbr("a54"); | |
590 | 2 | my_strict_find_nbr("00012345667"); | |
591 | 2 | my_strict_find_nbr("42"); | |
592 | 2 | my_strict_find_nbr("-+21"); | |
593 | 2 | } | |
594 | |||
595 | 4 | Test(my_round_float_str, full_covr) | |
596 | { | ||
597 | 2 | char str[6] = "12.5\0"; | |
598 | 2 | char str2[6] = "12.4\0"; | |
599 | 2 | char str3[6] = "0.6\0"; | |
600 | 2 | char str4[6] = "9.9\0"; | |
601 | 2 | char str5[6] = "-9.9\0"; | |
602 | 2 | char str6[2] = "-\0"; | |
603 | |||
604 | 2 | my_round_float_str(str5, '-', 0, 1); | |
605 | 2 | my_round_float_str(str5, '-', 4, 1); | |
606 | 2 | my_round_float_str(str6, '-', 0, 0); | |
607 | 2 | my_round_float_str(str, '5', 2, 1); | |
608 | 2 | my_round_float_str(str2, '5', 2, 1); | |
609 | 2 | my_round_float_str(str3, '8', 2, 1); | |
610 | 2 | my_round_float_str(str4, '9', 1, 1); | |
611 | 2 | my_round_float_str(str4, '9', 1, 1); | |
612 | 2 | my_round_float_str(str4, '9', 2, 1); | |
613 | 2 | my_round_float_str(str4, '9', 0, 1); | |
614 | 2 | } | |
615 | |||
616 | 4 | Test(my_str_to_word_array_select, full_covr, .init = cr_redirect_stdout) | |
617 | { | ||
618 | 2 | char *str = "----hello 9coucou.çava/oui"; | |
619 | 2 | char **test = my_str_to_word_array_select(str, " -"); | |
620 | |||
621 | 2 | my_show_word_array(test); | |
622 | 2 | } | |
623 | |||
624 | 4 | Test(my_str_to_word_array_string, full_covr, .init = cr_redirect_stdout) | |
625 | { | ||
626 | 2 | char *str = " ----hello 9coucou.çava/oui"; | |
627 | 2 | char **test = my_str_to_word_array_string(str, " "); | |
628 | |||
629 | 2 | my_show_word_array(test); | |
630 | 2 | } | |
631 | |||
632 | 4 | Test(my_super_array, full_covr) | |
633 | { | ||
634 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_super_array("coucou", "c")); |
635 | 2 | } | |
636 | |||
637 | 4 | Test(my_str_is, full_covr) | |
638 | { | ||
639 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_is("coucou", "coucou"), 1); |
640 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_str_is("coucou", "a"), 0); |
641 | 2 | } | |
642 | |||
643 | 4 | Test(my_putstr_fd, full_covr) | |
644 | { | ||
645 | 2 | my_putstr_fd(NULL, 1); | |
646 | 2 | my_putstr_fd_free(NULL, 1); | |
647 | 2 | } | |
648 | |||
649 | 4 | Test(my_strndup, full_covr) | |
650 | { | ||
651 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_strndup("coucou", 3)); |
652 | 2 | my_strndup(NULL, 0); | |
653 | 2 | } | |
654 | |||
655 | 4 | Test(my_super_number, full_covr) | |
656 | { | ||
657 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_super_number("12", (NB){0, 0, 1, 0})); |
658 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_super_number("12", (NB){0, 0, 1, 1})); |
659 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_super_number("-12", (NB){0, 0, 1, 1})); |
660 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_super_number("szz12", (NB){0, 1, 0, 0})); |
661 | 2 | my_super_number("szz12", (NB){0, 0, 0, 0}); | |
662 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_super_number("12zxxz", (NB){0, 0, 1, 0})); |
663 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_super_number("12zxxz", (NB){0, 0, 0, 0})); |
664 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_super_number("-12", (NB){0, 0, 1, 1})); |
665 | 2 | my_super_number("+-+---12", (NB){0, 0, 1, 1}); | |
666 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert(my_super_number("+-+---12", (NB){1, 0, 1, 1})); |
667 | 2 | my_super_number("", (NB){0, 0, 0, 0}); | |
668 | 2 | my_super_number("-12+", (NB){0, 0, 0, 0}); | |
669 | |||
670 | 2 | } | |
671 | |||
672 | 4 | Test(my_count_letter, full_covr) | |
673 | { | ||
674 |
3/10✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
2 | cr_assert_eq(my_count_letter("coucou", 'c'), 2); |
675 | 2 | } | |
676 |