Repository navigation
Expand file tree
/
Copy pathitoa.cpp
More file actions
97 lines (68 loc) · 1.85 KB
/
Copy pathitoa.cpp
File metadata and controls
97 lines (68 loc) · 1.85 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
85
86
87
88
89
90
91
92
93
94
95
96
97
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* itoa.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kjurkows <kjurkows@student.42warsaw.pl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/06/18 22:04:11 by kjurkows #+# #+# */
/* Updated: 2026/07/02 18:58:43 by kjurkows ### ########.fr */
/* */
/* ************************************************************************** */
#include "_main.hpp"
TEST(itoa, 0)
{
const int n = 0;
char *out = ft_itoa(n);
ASSERT_NE(out, nullptr);
ASSERT_STREQ(out, "0");
free(out);
}
TEST(itoa, 42)
{
const int n = 42;
char *out = ft_itoa(n);
ASSERT_NE(out, nullptr);
ASSERT_STREQ(out, "42");
free(out);
}
TEST(itoa, 123)
{
const int n = 123;
char *out = ft_itoa(n);
ASSERT_NE(out, nullptr);
ASSERT_STREQ(out, "123");
free(out);
}
TEST(itoa, neg42)
{
const int n = -42;
char *out = ft_itoa(n);
ASSERT_NE(out, nullptr);
ASSERT_STREQ(out, "-42");
free(out);
}
TEST(itoa, int_min)
{
const int n = -2147483648;
char *out = ft_itoa(n);
ASSERT_NE(out, nullptr);
ASSERT_STREQ(out, "-2147483648");
free(out);
}
TEST(itoa, int_max)
{
const int n = 2147483647;
char *out = ft_itoa(n);
ASSERT_NE(out, nullptr);
ASSERT_STREQ(out, "2147483647");
free(out);
}
TEST(itoa, neg10)
{
const int n = -10;
char *out = ft_itoa(n);
ASSERT_NE(out, nullptr);
ASSERT_STREQ(out, "-10");
free(out);
}