Skip to content

Commit 1e2d760

Browse files
committed
add
1 parent cb67765 commit 1e2d760

File tree

10 files changed

+252
-105
lines changed

10 files changed

+252
-105
lines changed

mini-moul/tests/C00/ex00/ft_putchar.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ int test1(void)
4747
return (-1);
4848
}
4949
else
50-
printf(" " GREEN CHECKMARK GREY " ft_putchar(\'c\') Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
50+
printf(" " GREEN CHECKMARK GREY " [1] ft_putchar(\'c\') Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
5151
remove("output.txt");
5252
return (0);
5353
}
@@ -78,12 +78,12 @@ int test2(void)
7878
const char *expected_output = "x";
7979
if (strncmp(buffer, expected_output, 1) != 0)
8080
{
81-
printf(" " RED "[1] ft_putchar(\'x\') Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
81+
printf(" " RED "[2] ft_putchar(\'x\') Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
8282
remove("output.txt");
8383
return (-1);
8484
}
8585
else
86-
printf(" " GREEN CHECKMARK GREY " ft_putchar(\'x\') Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
86+
printf(" " GREEN CHECKMARK GREY " [2] ft_putchar(\'x\') Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
8787
remove("output.txt");
8888
return (0);
8989
}
@@ -114,12 +114,12 @@ int test3(void)
114114
const char *expected_output = "t";
115115
if (strncmp(buffer, expected_output, 1) != 0)
116116
{
117-
printf(" " RED "[1] ft_putchar(\'t\') Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
117+
printf(" " RED "[3] ft_putchar(\'t\') Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
118118
remove("output.txt");
119119
return (-1);
120120
}
121121
else
122-
printf(" " GREEN CHECKMARK GREY " ft_putchar(\'t\') Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
122+
printf(" " GREEN CHECKMARK GREY " [3] ft_putchar(\'t\') Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
123123
remove("output.txt");
124124
return (0);
125125
}

mini-moul/tests/C00/ex04/ft_is_negative.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ int test2(void)
7777
const char *expected_output = "N";
7878
if (strncmp(buffer, expected_output, 1) != 0)
7979
{
80-
printf(" " RED "[1] ft_is_negative(8) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
80+
printf(" " RED "[2] ft_is_negative(8) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
8181
remove("output.txt");
8282
return (-1);
8383
}
8484
else
85-
printf(" " GREEN CHECKMARK GREY " [1] ft_is_negative(8) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
85+
printf(" " GREEN CHECKMARK GREY " [2] ft_is_negative(8) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
8686
remove("output.txt");
8787
return (0);
8888
}
@@ -112,12 +112,12 @@ int test3(void)
112112
const char *expected_output = "N";
113113
if (strncmp(buffer, expected_output, 1) != 0)
114114
{
115-
printf(" " RED "[1] ft_is_negative(-2147483648) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
115+
printf(" " RED "[3] ft_is_negative(-2147483648) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
116116
remove("output.txt");
117117
return (-1);
118118
}
119119
else
120-
printf(" " GREEN CHECKMARK GREY " [1] ft_is_negative(-2147483648) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
120+
printf(" " GREEN CHECKMARK GREY " [3] ft_is_negative(-2147483648) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
121121
remove("output.txt");
122122
return (0);
123123
}

mini-moul/tests/C00/ex07/ft_putnbr.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ int test2(void)
7575
const char *expected_output = "2008";
7676
if (strncmp(buffer, expected_output, 4) != 0)
7777
{
78-
printf(" " RED "[1] ft_putnbr(2008) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
78+
printf(" " RED "[2] ft_putnbr(2008) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
7979
remove("output.txt");
8080
return (-1);
8181
}
82-
else printf(" " GREEN CHECKMARK GREY " [1] ft_putnbr(2008) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
82+
else printf(" " GREEN CHECKMARK GREY " [2] ft_putnbr(2008) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
8383
remove("output.txt");
8484
return (0);
8585
}
@@ -109,11 +109,11 @@ int test3(void)
109109
const char *expected_output = "-425";
110110
if (strncmp(buffer, expected_output, 4) != 0)
111111
{
112-
printf(" " RED "[1] ft_putnbr(-425) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
112+
printf(" " RED "[3] ft_putnbr(-425) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
113113
remove("output.txt");
114114
return (-1);
115115
}
116-
else printf(" " GREEN CHECKMARK GREY " [1] ft_putnbr(-425) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
116+
else printf(" " GREEN CHECKMARK GREY " [3] ft_putnbr(-425) Expected \"%s\", got \"%s\"\n"DEFAULT, expected_output, buffer);
117117
remove("output.txt");
118118
return (0);
119119
}

mini-moul/tests/C01/ex02/ft_swap.c

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
#include "../../../utils/constants.h"
77

88
int test1(void);
9+
int test2(void);
10+
int test3(void);
911

1012
int main(void)
1113
{
12-
if (test1() != 0)
14+
if (test1()+test2()+test3() != 0)
1315
return (-1);
1416
return (0);
1517
}
@@ -31,4 +33,42 @@ int test1(void)
3133
else
3234
printf(" " GREEN CHECKMARK GREY " [1] ft_swap(x = 2, y = 3) output x = 3, y = 2\n" DEFAULT);
3335
return (0);
36+
}
37+
38+
int test2(void)
39+
{
40+
int x;
41+
int y;
42+
43+
x = 9;
44+
y = -4;
45+
ft_swap(&x, &y);
46+
47+
if (x != -4 || y != 9)
48+
{
49+
printf(" " RED "[2] ft_swap(x = 9, y = -4) Expected x = -4, got %d. Expected y = 9, got %d\n" DEFAULT, x, y);
50+
return (-1);
51+
}
52+
else
53+
printf(" " GREEN CHECKMARK GREY " [2] ft_swap(x = 9, y = -4) output x = -4, y = 9\n" DEFAULT);
54+
return (0);
55+
}
56+
57+
int test3(void)
58+
{
59+
int x;
60+
int y;
61+
62+
x = -32;
63+
y = 54;
64+
ft_swap(&x, &y);
65+
66+
if (x != 54 || y != -32)
67+
{
68+
printf(" " RED "[3] ft_swap(x = -32, y = 54) Expected x = 54, got %d. Expected y = -32, got %d\n" DEFAULT, x, y);
69+
return (-1);
70+
}
71+
else
72+
printf(" " GREEN CHECKMARK GREY " [3] ft_swap(x = -32, y = 54) output x = 54, y = -32\n" DEFAULT);
73+
return (0);
3474
}

mini-moul/tests/C01/ex03/ft_div_mod.c

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
#include "../../../utils/constants.h"
77

88
int test1(void);
9+
int test2(void);
10+
int test3(void);
911

1012
int main(void)
1113
{
12-
if (test1() != 0)
14+
if (test1()+test2()+test3() != 0)
1315
return (-1);
1416
return (0);
1517
}
@@ -28,10 +30,54 @@ int test1(void)
2830

2931
if (x != 2 || y != 0)
3032
{
31-
printf(" " RED "[1] ft_div_mod(10, 5, &x, &y) Expected x = 3, got %d. Expected y = 2, got %d\n" DEFAULT, x, y);
33+
printf(" " RED "[1] ft_div_mod(10, 5, &x, &y) Expected x = 2, got %d. Expected y = 0, got %d\n" DEFAULT, x, y);
3234
return (-1);
3335
}
3436
else
35-
printf(" " GREEN CHECKMARK GREY " [1] ft_div_mod(10, 5, &x, &y) Expected x = 3, got %d. Expected y = 2, got %d\n" DEFAULT, x, y);
37+
printf(" " GREEN CHECKMARK GREY " [1] ft_div_mod(10, 5, &x, &y) Expected x = 2, got %d. Expected y = 0, got %d\n" DEFAULT, x, y);
38+
return (0);
39+
}
40+
41+
int test2(void)
42+
{
43+
int a;
44+
int b;
45+
int x;
46+
int y;
47+
48+
a = 25;
49+
b = 6;
50+
ft_div_mod(a, b, &x, &y);
51+
52+
53+
if (x != 4 || y != 1)
54+
{
55+
printf(" " RED "[2] ft_div_mod(25, 6, &x, &y) Expected x = 4, got %d. Expected y = 1, got %d\n" DEFAULT, x, y);
56+
return (-1);
57+
}
58+
else
59+
printf(" " GREEN CHECKMARK GREY " [2] ft_div_mod(25, 6, &x, &y) Expected x = 4, got %d. Expected y = 1, got %d\n" DEFAULT, x, y);
60+
return (0);
61+
}
62+
63+
int test3(void)
64+
{
65+
int a;
66+
int b;
67+
int x;
68+
int y;
69+
70+
a = 47;
71+
b = 8;
72+
ft_div_mod(a, b, &x, &y);
73+
74+
75+
if (x != 5 || y != 7)
76+
{
77+
printf(" " RED "[3] ft_div_mod(47, 8, &x, &y) Expected x = 5, got %d. Expected y = 7, got %d\n" DEFAULT, x, y);
78+
return (-1);
79+
}
80+
else
81+
printf(" " GREEN CHECKMARK GREY " [3] ft_div_mod(47, 8, &x, &y) Expected x = 5, got %d. Expected y = 7, got %d\n" DEFAULT, x, y);
3682
return (0);
3783
}

mini-moul/tests/C01/ex04/ft_ultimate_div_mod.c

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
#include "../../../utils/constants.h"
77

88
int test1(void);
9+
int test2(void);
10+
int test3(void);
911

1012
int main(void)
1113
{
12-
if (test1() != 0)
14+
if (test1()+test2()+test3() != 0)
1315
return (-1);
1416
return (0);
1517
}
@@ -25,10 +27,48 @@ int test1(void)
2527

2628
if (x != 5 || y != 0)
2729
{
28-
printf(" " RED "[1] ft_ultimate_div_mod(x = 15, y = 3) Expected x = 3, got %d. Expected y = 2, got %d\n" DEFAULT, x, y);
30+
printf(" " RED "[1] ft_ultimate_div_mod(x = 15, y = 3) Expected x = 5, got %d. Expected y = 0, got %d\n" DEFAULT, x, y);
2931
return (-1);
3032
}
3133
else
32-
printf(" " GREEN CHECKMARK GREY " [1] ft_ultimate_div_mod(x = 15, y = 3) Expected x = 3, got %d. Expected y = 2, got %d\n" DEFAULT, x, y);
34+
printf(" " GREEN CHECKMARK GREY " [1] ft_ultimate_div_mod(x = 15, y = 3) Expected x = 5, got %d. Expected y = 0, got %d\n" DEFAULT, x, y);
35+
return (0);
36+
}
37+
38+
int test2(void)
39+
{
40+
int x;
41+
int y;
42+
43+
x = 23;
44+
y = 5;
45+
ft_ultimate_div_mod(&x, &y);
46+
47+
if (x != 4 || y != 3)
48+
{
49+
printf(" " RED "[2] ft_ultimate_div_mod(x = 23, y = 5) Expected x = 4, got %d. Expected y = 3, got %d\n" DEFAULT, x, y);
50+
return (-1);
51+
}
52+
else
53+
printf(" " GREEN CHECKMARK GREY " [2] ft_ultimate_div_mod(x = 23, y = 5) Expected x = 4, got %d. Expected y = 3, got %d\n" DEFAULT, x, y);
54+
return (0);
55+
}
56+
57+
int test3(void)
58+
{
59+
int x;
60+
int y;
61+
62+
x = 32;
63+
y = 5;
64+
ft_ultimate_div_mod(&x, &y);
65+
66+
if (x != 6 || y != 2)
67+
{
68+
printf(" " RED "[3] ft_ultimate_div_mod(x = 32, y = 5) Expected x = 6, got %d. Expected y = 2, got %d\n" DEFAULT, x, y);
69+
return (-1);
70+
}
71+
else
72+
printf(" " GREEN CHECKMARK GREY " [3] ft_ultimate_div_mod(x = 32, y = 5) Expected x = 6, got %d. Expected y = 2, got %d\n" DEFAULT, x, y);
3373
return (0);
3474
}

0 commit comments

Comments
 (0)