-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoupper.cpp
More file actions
129 lines (102 loc) · 3.09 KB
/
Copy pathtoupper.cpp
File metadata and controls
129 lines (102 loc) · 3.09 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* toupper.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kjurkows <kjurkows@student.42warsaw.pl> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/06/18 18:57:19 by kjurkows #+# #+# */
/* Updated: 2026/06/25 17:55:21 by kjurkows ### ########.fr */
/* */
/* ************************************************************************** */
#include "_main.hpp"
#include <string.h>
TEST(toupper, basic)
{
const int a = 'a';
const int z = 'z';
const int A = 'A';
const int Z = 'Z';
const int c_a = toupper(a);
const int ft_a = ft_toupper(a);
const int c_z = toupper(z);
const int ft_z = ft_toupper(z);
const int c_A = toupper(A);
const int ft_A = ft_toupper(A);
const int c_Z = toupper(Z);
const int ft_Z = ft_toupper(Z);
EXPECT_EQ(c_a, ft_a);
EXPECT_EQ(c_z, ft_z);
EXPECT_EQ(c_A, ft_A);
EXPECT_EQ(c_Z, ft_Z);
}
TEST(toupper, number)
{
const int zero = '0';
const int nine = '9';
const int c_zero = toupper(zero);
const int ft_zero = ft_toupper(zero);
const int c_nine = toupper(nine);
const int ft_nine = ft_toupper(nine);
EXPECT_EQ(c_zero, ft_zero);
EXPECT_EQ(c_nine, ft_nine);
}
TEST(toupper, special)
{
const int at = '@';
const int slash = '/';
const int colon = ':';
const int c_at = toupper(at);
const int ft_at = ft_toupper(at);
const int c_slash = toupper(slash);
const int ft_slash = ft_toupper(slash);
const int c_colon = toupper(colon);
const int ft_colon = ft_toupper(colon);
EXPECT_EQ(c_at, ft_at);
EXPECT_EQ(c_slash, ft_slash);
EXPECT_EQ(c_colon, ft_colon);
}
TEST(toupper, non_ascii)
{
const int non_ascii = 128;
const int c_non_ascii = toupper(non_ascii);
const int ft_non_ascii = ft_toupper(non_ascii);
ASSERT_EQ(c_non_ascii, ft_non_ascii);
}
TEST(toupper, negative)
{
const int negative = -12;
const int c_negative = toupper(negative);
const int ft_negative = ft_toupper(negative);
ASSERT_EQ(c_negative, ft_negative);
}
TEST(toupper, out_of_range)
{
const int out_of_range = 256;
const int c_out_of_range = toupper(out_of_range);
const int ft_out_of_range = ft_toupper(out_of_range);
ASSERT_EQ(c_out_of_range, ft_out_of_range);
}
TEST(toupper, null_char)
{
const int null_char = '\0';
const int c_null_char = toupper(null_char);
const int ft_null_char = ft_toupper(null_char);
ASSERT_EQ(c_null_char, ft_null_char);
}
TEST(toupper, all_chars)
{
for (int i = -128; i <= 255; ++i)
{
const int c_i = toupper(i);
const int ft_i = ft_toupper(i);
EXPECT_EQ(c_i, ft_i);
}
}
TEST(toupper, eof)
{
const int eof = EOF;
const int c_eof = toupper(eof);
const int ft_eof = ft_toupper(eof);
ASSERT_EQ(c_eof, ft_eof);
}