GCC Code Coverage Report


Directory: ./
File: tests/test_my_printf.c
Date: 2024-06-05 00:36:48
Exec Total Coverage
Lines: 846 846 100.0%
Functions: 349 349 100.0%
Branches: 987 3290 30.0%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2023
3 ** test_my_printf
4 ** File description:
5 ** Unit tests for each functionality of the my_printf
6 */
7 /**
8 * @file test_my_printf.c
9 * @brief Unit tests for each function of the my_printf
10 * @author Nicolas TORO
11 */
12
13 #include "criterion/criterion.h"
14 #include "criterion/redirect.h"
15 #include "../lib/my/my_printf/myprintf.h"
16
17 173 void redirect_all_std(void)
18 {
19 173 cr_redirect_stdout();
20 173 cr_redirect_stderr();
21 173 }
22
23 4 Test(my_printf, my_show_formating)
24 {
25 formating_t formating;
26
27 2 my_show_formating(&formating);
28 2 }
29
30 4 Test(my_printf, empty_format, .init = redirect_all_std)
31 {
32 2 int len = my_printf("");
33
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_stdout_eq_str("");
35
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(len, 0);
36 2 my_fprintf(2, "");
37 2 }
38
39 4 Test(my_printf, simple_format, .init = redirect_all_std)
40 {
41 2 int len = my_printf("hello world");
42
43
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 world");
44
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(len, 11);
45 2 my_fprintf(2, "hello world");
46 2 }
47
48 4 Test(my_printf, wrong_flag_1, .init = redirect_all_std)
49 {
50 2 int len = my_printf("hello %y");
51
52
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 %y");
53
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(len, 8);
54 2 my_fprintf(2, "hello %y");
55 2 }
56
57 4 Test(my_printf, wrong_flag_2, .init = redirect_all_std)
58 {
59 2 int len = my_printf("hello %+");
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_stdout_eq_str("hello %+");
61
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(len, 8);
62 2 my_fprintf(2, "hello %+");
63 2 }
64
65 4 Test(my_printf, wrong_flag_3, .init = redirect_all_std)
66 {
67 2 int len = my_printf("hello %+y");
68
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 %+y");
69
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(len, 9);
70 2 my_fprintf(2, "hello %");
71 2 }
72
73 4 Test(my_printf, one_flag_percent, .init = redirect_all_std)
74 {
75 2 int len = my_printf("hello %%");
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_stdout_eq_str("hello %");
77
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(len, 7);
78 2 my_fprintf(2, "hello %%");
79 2 }
80
81 4 Test(my_printf, multiple_flag_percent_1, .init = redirect_all_std)
82 {
83 2 int len = my_printf("hello %%%%%%");
84
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 %%%");
85
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(len, 9);
86 2 }
87
88 4 Test(my_printf, multiple_flag_percent_2, .init = redirect_all_std)
89 {
90 2 int len = my_printf("hello %%%%%");
91
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 %%%");
92
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(len, 9);
93 2 }
94
95 4 Test(my_printf, one_flag_c, .init = redirect_all_std)
96 {
97 2 int len = my_printf("hello %corld", 'w');
98
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 world");
99
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(len, 11);
100 2 }
101
102 4 Test(my_printf, multiple_flag_c, .init = redirect_all_std)
103 {
104 2 int len = my_printf("hello %c%c%c%c%c", 'w', 'o', 'r', 'l', 'd');
105
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 world");
106
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(len, 11);
107 2 }
108
109 4 Test(my_printf, format_flag_c_1, .init = redirect_all_std)
110 {
111 2 int len = my_printf("hello %2corld", 'w');
112
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 world");
113
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(len, 12);
114 2 }
115
116 4 Test(my_printf, format_flag_c_2, .init = redirect_all_std)
117 {
118 2 int len = my_printf("hello %#2corld", 'w');
119
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 world");
120
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(len, 12);
121 2 }
122
123 4 Test(my_printf, format_flag_c_3, .init = redirect_all_std)
124 {
125 2 int len = my_printf("hello %02corld", 'w');
126
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 0world");
127
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(len, 12);
128 2 }
129
130 4 Test(my_printf, format_flag_c_4, .init = redirect_all_std)
131 {
132 2 int len = my_printf("hello %+10corld", 'w');
133
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 world");
134
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(len, 20);
135 2 }
136
137 4 Test(my_printf, format_flag_c_5, .init = redirect_all_std)
138 {
139 2 int len = my_printf("hello %-10corld", 'w');
140
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 w orld");
141
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(len, 20);
142 2 }
143
144 4 Test(my_printf, format_flag_c_6, .init = redirect_all_std)
145 {
146 2 int len = my_printf("hello %#+2corld", 'w');
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("hello world");
148
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(len, 12);
149 2 }
150
151 4 Test(my_printf, format_flag_c_7, .init = redirect_all_std)
152 {
153 2 int len = my_printf("hello %#02corld", 'w');
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_stdout_eq_str("hello world");
155
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(len, 12);
156 2 }
157
158 4 Test(my_printf, format_flag_c_8, .init = redirect_all_std)
159 {
160 2 int len = my_printf("hello %-#20corld", 'w');
161
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 %-#20corld");
162
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(len, 16);
163 2 }
164
165 4 Test(my_printf, format_flag_c_9, .init = redirect_all_std)
166 {
167 2 int len = my_printf("hello %-+10corld", 'w');
168
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 w orld");
169
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(len, 20);
170 2 }
171
172 4 Test(my_printf, one_flag_s, .init = redirect_all_std)
173 {
174 2 int len = my_printf("hello %s", "world");
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("hello world");
176
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(len, 11);
177 2 }
178
179 4 Test(my_printf, multiple_flag_s, .init = redirect_all_std)
180 {
181 2 int len = my_printf("%s%s%s", "hello", " ", "world");
182
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 world");
183
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(len, 11);
184 2 }
185
186 4 Test(my_printf, invalid_flag_s, .init = redirect_all_std)
187 {
188 2 int len = my_printf("hello %s", NULL);
189
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 ");
190
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(len, 6);
191 2 }
192
193 4 Test(my_printf, format_flag_s_1, .init = redirect_all_std)
194 {
195 2 int len = my_printf("hello %2s", "world");
196
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 world");
197
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(len, 11);
198 2 }
199
200 4 Test(my_printf, format_flag_s_2, .init = redirect_all_std)
201 {
202 2 int len = my_printf("hello %#2s", "world");
203
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 world");
204
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(len, 11);
205 2 }
206
207 4 Test(my_printf, format_flag_s_3, .init = redirect_all_std)
208 {
209 2 int len = my_printf("hello %02s", "world");
210
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 world");
211
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(len, 11);
212 2 }
213
214 4 Test(my_printf, format_flag_s_4, .init = redirect_all_std)
215 {
216 2 int len = my_printf("hello %+10s", "world");
217
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 world");
218
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(len, 16);
219 2 }
220
221 4 Test(my_printf, format_flag_s_5, .init = redirect_all_std)
222 {
223 2 int len = my_printf("hello %-10s", "world");
224
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 world ");
225
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(len, 16);
226 2 }
227
228 4 Test(my_printf, format_flag_s_6, .init = redirect_all_std)
229 {
230 2 int len = my_printf("hello %#+2s", "world");
231
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 world");
232
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(len, 11);
233 2 }
234
235 4 Test(my_printf, format_flag_s_7, .init = redirect_all_std)
236 {
237 2 int len = my_printf("hello %#02s", "world");
238
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 world");
239
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(len, 11);
240 2 }
241
242 4 Test(my_printf, format_flag_s_8, .init = redirect_all_std)
243 {
244 2 int len = my_printf("hello %-#20s", "world");
245
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 %-#20s");
246
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(len, 12);
247 2 }
248
249 4 Test(my_printf, format_flag_s_9, .init = redirect_all_std)
250 {
251 2 int len = my_printf("hello %-+10s", "world");
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_stdout_eq_str("hello world ");
253
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(len, 16);
254 2 }
255
256 4 Test(my_printf, one_flag_bigs, .init = redirect_all_std)
257 {
258 2 char *test[] = {"hello", "world", NULL};
259 2 int len = my_printf("%S", test);
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_stdout_eq_str("hello\nworld\n");
261
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(len, 12);
262 2 }
263
264 4 Test(my_printf, one_flag_i, .init = redirect_all_std)
265 {
266 2 int len = my_printf("We are in %i", 2023);
267
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("We are in 2023");
268
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(len, 14);
269 2 }
270
271 4 Test(my_printf, one_flag_i_neg, .init = redirect_all_std)
272 {
273 2 int len = my_printf("We are in %i", -2023);
274
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("We are in -2023");
275
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(len, 15);
276 2 }
277
278 4 Test(my_printf, multiple_flag_i, .init = redirect_all_std)
279 {
280 2 int len = my_printf("We are in %i%i%i%i", 2, 0, 2, 3);
281
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("We are in 2023");
282
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(len, 14);
283 2 }
284
285 4 Test(my_printf, multiple_flag_i_neg, .init = redirect_all_std)
286 {
287 2 int len = my_printf("We are in %i%i%i%i", -2, 0, 2, 3);
288
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("We are in -2023");
289
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(len, 15);
290 2 }
291
292 4 Test(my_printf, one_flag_d, .init = redirect_all_std)
293 {
294 2 int len = my_printf("We are in %d", 2023);
295
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("We are in 2023");
296
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(len, 14);
297 2 }
298
299 4 Test(my_printf, one_flag_d_neg, .init = redirect_all_std)
300 {
301 2 int len = my_printf("We are in %d", -2023);
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_stdout_eq_str("We are in -2023");
303
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(len, 15);
304 2 }
305
306 4 Test(my_printf, multiple_flag_d, .init = redirect_all_std)
307 {
308 2 int len = my_printf("We are in %d%d%d%d", 2, 0, 2, 3);
309
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("We are in 2023");
310
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(len, 14);
311 2 }
312
313 4 Test(my_printf, multiple_flag_d_neg, .init = redirect_all_std)
314 {
315 2 int len = my_printf("We are in %d%d%d%d", -2, 0, 2, 3);
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("We are in -2023");
317
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(len, 15);
318 2 }
319
320 4 Test(my_printf, format_flag_d_1, .init = redirect_all_std)
321 {
322 2 int len = my_printf("We are in %4.5d", 2023);
323
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("We are in 02023");
324
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(len, 15);
325 2 }
326
327 4 Test(my_printf, format_flag_d_plus, .init = redirect_all_std)
328 {
329 2 int len = my_printf("%-+10d", 2023);
330
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("+2023 ");
331
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(len, 10);
332 2 }
333
334 4 Test(my_printf, format_flag_d_2, .init = redirect_all_std)
335 {
336 2 int len = my_printf("We are in %.0d", 0);
337
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("We are in ");
338
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(len, 10);
339 2 }
340
341 4 Test(my_printf, format_flag_d_3, .init = redirect_all_std)
342 {
343 2 int len = my_printf("We are in %+7.4d", 2023);
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_stdout_eq_str("We are in +2023");
345
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(len, 17);
346 2 }
347
348 4 Test(my_printf, format_flag_d_4, .init = redirect_all_std)
349 {
350 2 int len = my_printf("We are in %-7.4d", 2023);
351
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("We are in 2023 ");
352
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(len, 17);
353 2 }
354
355 4 Test(my_printf, format_flag_d_5, .init = redirect_all_std)
356 {
357 2 int len = my_printf("We are in %#7.4d", 2023);
358
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("We are in 2023");
359
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(len, 17);
360 2 }
361
362 4 Test(my_printf, format_flag_d_6, .init = redirect_all_std)
363 {
364 2 int len = my_printf("We are in %07d", 2023);
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_stdout_eq_str("We are in 0002023");
366
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(len, 17);
367 2 }
368
369 4 Test(my_printf, format_flag_d_7, .init = redirect_all_std)
370 {
371 2 int len = my_printf("We are in %lld", 2023);
372
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("We are in 2023");
373
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(len, 14);
374 2 }
375
376 4 Test(my_printf, format_flag_d_8, .init = redirect_all_std)
377 {
378 2 int len = my_printf("We are in %+-10d", 2023);
379
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("We are in +2023 ");
380
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(len, 20);
381 2 }
382
383 4 Test(my_printf, format_flag_d_9, .init = redirect_all_std)
384 {
385 2 int len = my_printf("We are in %0+10d", 2023);
386
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("We are in +000002023");
387
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(len, 20);
388 2 }
389
390 4 Test(my_printf, specifier_flag_d_1, .init = redirect_all_std)
391 {
392 2 int len = my_printf("We are in %ld", 1);
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_stdout_eq_str("We are in 1");
394
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(len, 11);
395 2 }
396
397 4 Test(my_printf, specifier_flag_d_2, .init = redirect_all_std)
398 {
399 2 int len = my_printf("We are in %lld", 1);
400
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("We are in 1");
401
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(len, 11);
402 2 }
403
404 4 Test(my_printf, specifier_flag_d_3, .init = redirect_all_std)
405 {
406 2 int len = my_printf("We are in %hd", 1);
407
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("We are in 1");
408
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(len, 11);
409 2 }
410
411 4 Test(my_printf, specifier_flag_d_4, .init = redirect_all_std)
412 {
413 2 int len = my_printf("We are in %hhd", 1);
414
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("We are in 1");
415
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(len, 11);
416 2 }
417
418 4 Test(my_printf, specifier_flag_d_5, .init = redirect_all_std)
419 {
420 2 int len = my_printf("We are in %zd", 1);
421
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("We are in 1");
422
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(len, 11);
423 2 }
424
425 4 Test(my_printf, format_flag_double_1, .init = redirect_all_std)
426 {
427 2 int len = my_printf("%.5f", 10.123);
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_stdout_eq_str("10.12300");
429
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(len, 8);
430 2 }
431
432 4 Test(my_printf, format_flag_double_plus, .init = redirect_all_std)
433 {
434 2 int len = my_printf("%+12f", 10.123);
435
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.123000");
436
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(len, 12);
437 2 }
438
439 4 Test(my_printf, format_flag_double_width, .init = redirect_all_std)
440 {
441 2 int len = my_printf("%12f", 10.123);
442
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.123000");
443
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(len, 12);
444 2 }
445
446 4 Test(my_printf, format_flag_double_moins, .init = redirect_all_std)
447 {
448 2 int len = my_printf("%-12f", 10.123);
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_stdout_eq_str("10.123000 ");
450
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(len, 12);
451 2 }
452
453 4 Test(my_printf, format_flag_double_esp, .init = redirect_all_std)
454 {
455 2 int len = my_printf("% f", 10.123);
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_stdout_eq_str(" 10.123000");
457
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(len, 10);
458 2 }
459
460 4 Test(my_printf, format_flag_double_esp_a, .init = redirect_all_std)
461 {
462 2 int len = my_printf("% 5a", 10.123);
463
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(" 0x1.43ef9db22d0e5p+3");
464
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(len, 21);
465 2 }
466
467 4 Test(my_printf, format_flag_double_zero, .init = redirect_all_std)
468 {
469 2 int len = my_printf("%010f", 10.123);
470
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("010.123000");
471
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(len, 10);
472 2 }
473
474 4 Test(my_printf, format_flag_double_hash, .init = redirect_all_std)
475 {
476 2 int len = my_printf("%#10f", 10.123);
477
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.123000");
478
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(len, 10);
479 2 }
480
481 4 Test(my_printf, format_flag_double_do_next, .init = redirect_all_std)
482 {
483 2 int len = my_printf("%#+10f", 10.123);
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_stdout_eq_str("+10.123000");
485
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(len, 10);
486 2 }
487
488 4 Test(my_printf, one_flag_u, .init = redirect_all_std)
489 {
490 2 int len = my_printf("We are in %u", 2023);
491
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("We are in 2023");
492
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(len, 14);
493 2 }
494
495 4 Test(my_printf, one_flag_u_neg, .init = redirect_all_std)
496 {
497 2 int len = my_printf("We are in %u", -2023);
498
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("We are in 4294965273");
499
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(len, 20);
500 2 }
501
502 4 Test(my_printf, multiple_flag_u, .init = redirect_all_std)
503 {
504 2 int len = my_printf("We are in %u%u%u%u", 2, 0, 2, 3);
505
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("We are in 2023");
506
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(len, 14);
507 2 }
508
509 4 Test(my_printf, multiple_flag_u_neg, .init = redirect_all_std)
510 {
511 2 int len = my_printf("We are in %u%u%u%u", -2, 0, 2, 3);
512
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("We are in 4294967294023");
513
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(len, 23);
514 2 }
515
516 4 Test(my_printf, specifier_flag_u_1, .init = redirect_all_std)
517 {
518 2 int len = my_printf("We are in %lu", 1);
519
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("We are in 1");
520
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(len, 11);
521 2 }
522
523 4 Test(my_printf, specifier_flag_u_2, .init = redirect_all_std)
524 {
525 2 int len = my_printf("We are in %llu", 1);
526
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("We are in 1");
527
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(len, 11);
528 2 }
529
530 4 Test(my_printf, specifier_flag_u_3, .init = redirect_all_std)
531 {
532 2 int len = my_printf("We are in %hu", 1);
533
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("We are in 1");
534
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(len, 11);
535 2 }
536
537 4 Test(my_printf, specifier_flag_u_4, .init = redirect_all_std)
538 {
539 2 int len = my_printf("We are in %hhu", 1);
540
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("We are in 1");
541
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(len, 11);
542 2 }
543
544 4 Test(my_printf, specifier_flag_u_5, .init = redirect_all_std)
545 {
546 2 int len = my_printf("We are in %zu", 1);
547
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("We are in 1");
548
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(len, 11);
549 2 }
550
551 4 Test(my_printf, one_flag_b, .init = redirect_all_std)
552 {
553 2 int len = my_printf("We are in %b", 2023);
554
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("We are in 11111100111");
555
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(len, 21);
556 2 }
557
558 4 Test(my_printf, one_flag_b_neg, .init = redirect_all_std)
559 {
560 2 int len = my_printf("We are in %b", -2023);
561
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("We are in 11111111111111111111100000011001");
562
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(len, 42);
563 2 }
564
565 4 Test(my_printf, multiple_flag_b, .init = redirect_all_std)
566 {
567 2 int len = my_printf("We are in %b%b%b%b", 2, 0, 2, 3);
568
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("We are in 1001011");
569
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(len, 17);
570 2 }
571
572 4 Test(my_printf, multiple_flag_b_neg, .init = redirect_all_std)
573 {
574 2 int len = my_printf("We are in %b%b%b%b", -2, 0, 2, 3);
575
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("We are in 1111111111111111111111111111111001011");
576
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(len, 47);
577 2 }
578
579 4 Test(my_printf, format_flag_b_neg, .init = redirect_all_std)
580 {
581 2 int len = my_printf("We are in %#b", 2023);
582
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("We are in 0b11111100111");
583
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(len, 23);
584 2 }
585
586 4 Test(my_printf, one_flag_o, .init = redirect_all_std)
587 {
588 2 int len = my_printf("We are in %o", 2023);
589
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("We are in 3747");
590
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(len, 14);
591 2 }
592
593 4 Test(my_printf, one_flag_o_neg, .init = redirect_all_std)
594 {
595 2 int len = my_printf("We are in %o", -2023);
596
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("We are in 37777774031");
597
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(len, 21);
598 2 }
599
600 4 Test(my_printf, multiple_flag_o, .init = redirect_all_std)
601 {
602 2 int len = my_printf("We are in %o%o%o%o", 2, 0, 2, 3);
603
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("We are in 2023");
604
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(len, 14);
605 2 }
606
607 4 Test(my_printf, multiple_flag_o_neg, .init = redirect_all_std)
608 {
609 2 int len = my_printf("We are in %o%o%o%o", -2, 0, 2, 3);
610
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("We are in 37777777776023");
611
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(len, 24);
612 2 }
613
614 4 Test(my_printf, format_flag_o, .init = redirect_all_std)
615 {
616 2 int len = my_printf("We are in %#o", 2023);
617
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("We are in 03747");
618
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(len, 15);
619 2 }
620
621 4 Test(my_printf, one_flag_x, .init = redirect_all_std)
622 {
623 2 int len = my_printf("We are in %x", 2023);
624
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("We are in 7e7");
625
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(len, 13);
626 2 }
627
628 4 Test(my_printf, one_flag_x_neg, .init = redirect_all_std)
629 {
630 2 int len = my_printf("We are in %x", -2023);
631
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("We are in fffff819");
632
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(len, 18);
633 2 }
634
635 4 Test(my_printf, multiple_flag_x, .init = redirect_all_std)
636 {
637 2 int len = my_printf("We are in %x%x%x%x", 2, 0, 2, 3);
638
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("We are in 2023");
639
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(len, 14);
640 2 }
641
642 4 Test(my_printf, multiple_flag_x_neg, .init = redirect_all_std)
643 {
644 2 int len = my_printf("We are in %x%x%x%x", -2, 0, 2, 3);
645
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("We are in fffffffe023");
646
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(len, 21);
647 2 }
648
649 4 Test(my_printf, format_flag_x, .init = redirect_all_std)
650 {
651 2 int len = my_printf("We are in %#x", 2023);
652
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("We are in 0x7e7");
653
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(len, 15);
654 2 }
655
656 4 Test(my_printf, one_flag_bigx, .init = redirect_all_std)
657 {
658 2 int len = my_printf("We are in %X", 2023);
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_stdout_eq_str("We are in 7E7");
660
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(len, 13);
661 2 }
662
663 4 Test(my_printf, one_flag_bigx_neg, .init = redirect_all_std)
664 {
665 2 int len = my_printf("We are in %X", -2023);
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_stdout_eq_str("We are in FFFFF819");
667
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(len, 18);
668 2 }
669
670 4 Test(my_printf, multiple_flag_bigx, .init = redirect_all_std)
671 {
672 2 int len = my_printf("We are in %X%X%X%X", 2, 0, 2, 3);
673
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("We are in 2023");
674
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(len, 14);
675 2 }
676
677 4 Test(my_printf, multiple_flag_bigx_neg, .init = redirect_all_std)
678 {
679 2 int len = my_printf("We are in %X%X%X%X", -2, 0, 2, 3);
680
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("We are in FFFFFFFE023");
681
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(len, 21);
682 2 }
683
684 4 Test(my_printf, format_flag_bigx, .init = redirect_all_std)
685 {
686 2 int len = my_printf("We are in %#X", 2023);
687
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("We are in 0X7E7");
688
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(len, 15);
689 2 }
690
691 4 Test(my_printf, one_flag_p, .init = redirect_all_std)
692 {
693 int len;
694
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_printf("We are in %p", &len));
695 2 }
696
697 4 Test(my_printf, one_flag_e_zero, .init = redirect_all_std)
698 {
699 2 int len = my_printf("We are in %e", 0.0);
700
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("We are in 0.000000e+00");
701
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(len, 22);
702 2 }
703
704 4 Test(my_printf, one_flag_e, .init = redirect_all_std)
705 {
706 2 int len = my_printf("We are in %e", 20.23);
707
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("We are in 2.023000e+01");
708
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(len, 22);
709 2 }
710
711 4 Test(my_printf, one_flag_e_neg, .init = redirect_all_std)
712 {
713 2 int len = my_printf("We are in %e", -20.23);
714
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("We are in -2.023000e+01");
715
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(len, 23);
716 2 }
717
718 4 Test(my_printf, one_flag_e_decimal, .init = redirect_all_std)
719 {
720 2 int len = my_printf("We are in %e", 0.02023);
721
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("We are in 2.023000e-02");
722
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(len, 22);
723 2 }
724
725 4 Test(my_printf, one_flag_e_neg_decimal, .init = redirect_all_std)
726 {
727 2 int len = my_printf("We are in %e", -0.02023);
728
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("We are in -2.023000e-02");
729
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(len, 23);
730 2 }
731
732 4 Test(my_printf, one_flag_e_max, .init = redirect_all_std)
733 {
734 2 int len = my_printf("We are in %e", 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002023);
735
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("We are in 2.023000e-100");
736
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(len, 23);
737 2 }
738
739 4 Test(my_printf, one_flag_bige_zero, .init = redirect_all_std)
740 {
741 2 int len = my_printf("We are in %E", 0.0);
742
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("We are in 0.000000E+00");
743
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(len, 22);
744 2 }
745
746 4 Test(my_printf, one_flag_bige, .init = redirect_all_std)
747 {
748 2 int len = my_printf("We are in %E", 20.23);
749
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("We are in 2.023000E+01");
750
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(len, 22);
751 2 }
752
753 4 Test(my_printf, one_flag_bige_neg, .init = redirect_all_std)
754 {
755 2 int len = my_printf("We are in %E", -20.23);
756
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("We are in -2.023000E+01");
757
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(len, 23);
758 2 }
759
760 4 Test(my_printf, one_flag_bige_decimal, .init = redirect_all_std)
761 {
762 2 int len = my_printf("We are in %E", 0.02023);
763
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("We are in 2.023000E-02");
764
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(len, 22);
765 2 }
766
767 4 Test(my_printf, one_flag_bige_neg_decimal, .init = redirect_all_std)
768 {
769 2 int len = my_printf("We are in %E", -0.02023);
770
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("We are in -2.023000E-02");
771
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(len, 23);
772 2 }
773
774 4 Test(my_printf, one_flag_bige_max, .init = redirect_all_std)
775 {
776 2 int len = my_printf("We are in %E", 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002023);
777
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("We are in 2.023000E-100");
778
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(len, 23);
779 2 }
780
781 4 Test(my_printf, one_flag_f, .init = redirect_all_std)
782 {
783 2 int len = my_printf("We are in %f", 20.23);
784
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("We are in 20.230000");
785
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(len, 19);
786 2 }
787
788 4 Test(my_printf, one_flag_f_neg, .init = redirect_all_std)
789 {
790 2 int len = my_printf("We are in %f", -20.23);
791
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("We are in -20.230000");
792
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(len, 20);
793 2 }
794
795 4 Test(my_printf, one_flag_f_decimal, .init = redirect_all_std)
796 {
797 2 int len = my_printf("We are in %f", 0.02023);
798
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("We are in 0.020230");
799
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(len, 18);
800 2 }
801
802 4 Test(my_printf, one_flag_f_neg_decimal, .init = redirect_all_std)
803 {
804 2 int len = my_printf("We are in %F", -0.02023);
805
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("We are in -0.020230");
806
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(len, 19);
807 2 }
808
809 4 Test(my_printf, one_flag_bigf, .init = redirect_all_std)
810 {
811 2 int len = my_printf("We are in %f", 20.23);
812
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("We are in 20.230000");
813
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(len, 19);
814 2 }
815
816 4 Test(my_printf, one_flag_bigf_neg, .init = redirect_all_std)
817 {
818 2 int len = my_printf("We are in %F", -20.23);
819
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("We are in -20.230000");
820
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(len, 20);
821 2 }
822
823 4 Test(my_printf, one_flag_bigf_decimal, .init = redirect_all_std)
824 {
825 2 int len = my_printf("We are in %F", 0.02023);
826
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("We are in 0.020230");
827
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(len, 18);
828 2 }
829
830 4 Test(my_printf, one_flag_bigf_neg_decimal, .init = redirect_all_std)
831 {
832 2 int len = my_printf("We are in %F", -0.02023);
833
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("We are in -0.020230");
834
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(len, 19);
835 2 }
836
837 4 Test(my_printf, one_flag_g_zero, .init = redirect_all_std)
838 {
839 2 int len = my_printf("We are in %g", 0.0);
840
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("We are in 0");
841
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(len, 11);
842 2 }
843
844 4 Test(my_printf, one_flag_g, .init = redirect_all_std)
845 {
846 2 int len = my_printf("We are in %g", 20.23);
847
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("We are in 20.23");
848
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(len, 15);
849 2 }
850
851 4 Test(my_printf, one_flag_g_neg, .init = redirect_all_std)
852 {
853 2 int len = my_printf("We are in %g", -20.23);
854
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("We are in -20.23");
855
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(len, 16);
856 2 }
857
858 4 Test(my_printf, one_flag_g_decimal, .init = redirect_all_std)
859 {
860 2 int len = my_printf("We are in %g", 0.02023);
861
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("We are in 0.02023");
862
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(len, 17);
863 2 }
864
865 4 Test(my_printf, one_flag_g_neg_decimal, .init = redirect_all_std)
866 {
867 2 int len = my_printf("We are in %g", -0.02023);
868
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("We are in -0.02023");
869
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(len, 18);
870 2 }
871
872 4 Test(my_printf, one_flag_g_max, .init = redirect_all_std)
873 {
874 2 int len = my_printf("We are in %g", -0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002023);
875
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("We are in -2.023e-100");
876
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(len, 21);
877 2 }
878
879 4 Test(my_printf, one_flag_bigg_zero, .init = redirect_all_std)
880 {
881 2 int len = my_printf("We are in %G", 0.0);
882
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("We are in 0");
883
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(len, 11);
884 2 }
885
886 4 Test(my_printf, one_flag_bigg, .init = redirect_all_std)
887 {
888 2 int len = my_printf("We are in %G", 20.23);
889
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("We are in 20.23");
890
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(len, 15);
891 2 }
892
893 4 Test(my_printf, one_flag_bigg_neg, .init = redirect_all_std)
894 {
895 2 int len = my_printf("We are in %G", -20.23);
896
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("We are in -20.23");
897
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(len, 16);
898 2 }
899
900 4 Test(my_printf, one_flag_bigg_decimal, .init = redirect_all_std)
901 {
902 2 int len = my_printf("We are in %G", 0.02023);
903
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("We are in 0.02023");
904
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(len, 17);
905 2 }
906
907 4 Test(my_printf, one_flag_bigg_neg_decimal, .init = redirect_all_std)
908 {
909 2 int len = my_printf("We are in %G", -0.02023);
910
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("We are in -0.02023");
911
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(len, 18);
912 2 }
913
914 4 Test(my_printf, one_flag_bigg_max, .init = redirect_all_std)
915 {
916 2 int len = my_printf("We are in %G", -0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002023);
917
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("We are in -2.023E-100");
918
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(len, 21);
919 2 }
920
921 4 Test(my_printf, one_flag_a_zero, .init = redirect_all_std)
922 {
923 2 int len = my_printf("We are in %a", 0.0);
924
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("We are in 0x0p+0");
925
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(len, 16);
926 2 }
927
928 4 Test(my_printf, one_flag_a, .init = redirect_all_std)
929 {
930 2 int len = my_printf("We are in %a", 100.020);
931
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("We are in 0x1.90147ae147ae1p+6");
932
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(len, 30);
933 2 }
934
935 4 Test(my_printf, one_flag_a_neg, .init = redirect_all_std)
936 {
937 2 int len = my_printf("We are in %a", -100.020);
938
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("We are in -0x1.90147ae147ae1p+6");
939
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(len, 31);
940 2 }
941
942 4 Test(my_printf, one_flag_a_decimal, .init = redirect_all_std)
943 {
944 2 int len = my_printf("We are in %a", 0.10020);
945
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("We are in 0x1.9a6b50b0f27bbp-4");
946
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(len, 30);
947 2 }
948
949 4 Test(my_printf, one_flag_a_neg_decimal, .init = redirect_all_std)
950 {
951 2 int len = my_printf("We are in %a", -0.10020);
952
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("We are in -0x1.9a6b50b0f27bbp-4");
953
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(len, 31);
954 2 }
955
956 4 Test(my_printf, one_flag_a_max, .init = redirect_all_std)
957 {
958 2 int len = my_printf("We are in %a", 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002023);
959
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("We are in 0x1.c519b147ec1ebp-332");
960
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(len, 32);
961 2 }
962
963 4 Test(my_printf, one_flag_biga_zero, .init = redirect_all_std)
964 {
965 2 int len = my_printf("We are in %A", 0.0);
966
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("We are in 0X0P+0");
967
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(len, 16);
968 2 }
969
970 4 Test(my_printf, one_flag_biga, .init = redirect_all_std)
971 {
972 2 int len = my_printf("We are in %A", 100.020);
973
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("We are in 0X1.90147AE147AE1P+6");
974
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(len, 30);
975 2 }
976
977 4 Test(my_printf, one_flag_biga_neg, .init = redirect_all_std)
978 {
979 2 int len = my_printf("We are in %A", -100.020);
980
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("We are in -0X1.90147AE147AE1P+6");
981
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(len, 31);
982 2 }
983
984 4 Test(my_printf, one_flag_biga_decimal, .init = redirect_all_std)
985 {
986 2 int len = my_printf("We are in %A", 0.10020);
987
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("We are in 0X1.9A6B50B0F27BBP-4");
988
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(len, 30);
989 2 }
990
991 4 Test(my_printf, one_flag_biga_neg_decimal, .init = redirect_all_std)
992 {
993 2 int len = my_printf("We are in %A", -0.10020);
994
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("We are in -0X1.9A6B50B0F27BBP-4");
995
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(len, 31);
996 2 }
997
998 4 Test(my_printf, one_flag_biga_max, .init = redirect_all_std)
999 {
1000 2 int len = my_printf("We are in %A", 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002023);
1001
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("We are in 0X1.C519B147EC1EBP-332");
1002
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(len, 32);
1003 2 }
1004
1005 4 Test(my_printf, one_flag_n, .init = redirect_all_std)
1006 {
1007 2 int test = 0;
1008
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_printf("We are%n in 2023", &test), 14);
1009
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(test, 6);
1010 2 my_fprintf(2, "We are in %n", &test);
1011 2 }
1012
1013 4 Test(my_printf, specifier_flag_n_l, .init = redirect_all_std)
1014 {
1015 2 int test = 0;
1016
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_printf("We are%ln in 2023", &test), 14);
1017
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(test, 6);
1018 2 }
1019
1020 4 Test(my_printf, specifier_flag_n_ll, .init = redirect_all_std)
1021 {
1022 2 int test = 0;
1023
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_printf("We are%lln in 2023", &test), 14);
1024
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(test, 6);
1025 2 }
1026
1027 4 Test(my_printf, specifier_flag_n_h, .init = redirect_all_std)
1028 {
1029 2 int test = 0;
1030
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_printf("We are%hn in 2023", &test), 14);
1031
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(test, 6);
1032 2 }
1033
1034 4 Test(my_printf, specifier_flag_n_hh, .init = redirect_all_std)
1035 {
1036 2 int test = 0;
1037
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_printf("We are%hhn in 2023", &test), 14);
1038
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(test, 6);
1039 2 }
1040
1041 4 Test(my_printf, specifier_flag_n_z, .init = redirect_all_std)
1042 {
1043 2 int test = 0;
1044
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_printf("We are%zn in 2023", &test), 14);
1045
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(test, 6);
1046 2 }
1047
1048 4 Test(my_printf, specifier_flag_n_j, .init = redirect_all_std)
1049 {
1050 2 int test = 0;
1051
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_printf("We are%jn in 2023", &test), 14);
1052
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(test, 6);
1053 2 }
1054
1055 4 Test(my_printf, specifier_flag_n_t, .init = redirect_all_std)
1056 {
1057 2 int test = 0;
1058
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_printf("We are%tn in 2023", &test), 14);
1059
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(test, 6);
1060 2 }
1061
1062 4 Test(my_printf, specifier_flag_n_L, .init = redirect_all_std)
1063 {
1064 2 int test = 0;
1065
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_printf("We are%Ln in 2023", &test), 14);
1066
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(test, 6);
1067 2 }
1068
1069 4 Test(my_printf, one_flag_m, .init = redirect_all_std)
1070 {
1071
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_printf("We are in %m"));
1072 2 }
1073
1074 4 Test(my_printf, one_flag_bigd, .init = redirect_all_std)
1075 {
1076
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_printf("We are in %D"));
1077 2 }
1078
1079 4 Test(my_printf, all_formats_1, .init = redirect_all_std)
1080 {
1081 2 int len = my_printf("We are in %#1.2lld", 2023);
1082
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("We are in 2023");
1083
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(len, 14);
1084 2 }
1085
1086 4 Test(my_printf, all_formats_2, .init = redirect_all_std)
1087 {
1088 2 int len = my_printf("We are in %#+1.2ld", 2023);
1089
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("We are in +2023");
1090
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(len, 15);
1091 2 }
1092
1093 4 Test(my_printf, all_formats_star_prc, .init = redirect_all_std)
1094 {
1095 2 int len = my_printf("%.*d", 6, 10);
1096
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("000010");
1097
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(len, 6);
1098 2 }
1099
1100 4 Test(my_printf, all_formats_star_width, .init = redirect_all_std)
1101 {
1102 2 int len = my_printf("%*d", 6, 10);
1103
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");
1104
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(len, 6);
1105 2 }
1106
1107 4 Test(my_printf, flag_a_prc_zero, .init = redirect_all_std)
1108 {
1109 2 int len = my_printf("%.4a", 0.0);
1110
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("0x0.0000p+0");
1111
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(len, 11);
1112
1113 2 }
1114
1115 4 Test(my_printf, flag_a_prc_x, .init = redirect_all_std)
1116 {
1117 2 int len = my_printf("%.14a", 10.123);
1118
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("0x1.43ef9db22d0e50p+3");
1119
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(len, 21);
1120 2 }
1121
1122 4 Test(my_printf, flag_biga_prc_zero, .init = redirect_all_std)
1123 {
1124 2 int len = my_printf("%.4A", 0.0);
1125
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("0X0.0000P+0");
1126
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(len, 11);
1127 2 }
1128
1129 4 Test(my_printf, flag_biga_prc_x, .init = redirect_all_std)
1130 {
1131 2 int len = my_printf("%.14A", 10.123);
1132
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("0X1.43EF9DB22D0E50P+3");
1133
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(len, 21);
1134 2 }
1135
1136 4 Test(my_printf, flag_g_prc_zero, .init = redirect_all_std)
1137 {
1138 2 int len = my_printf("%.4g", 1000000.123);
1139
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("1e+06");
1140
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(len, 5);
1141 2 }
1142
1143 4 Test(my_printf, flag_bigg_prc_zero, .init = redirect_all_std)
1144 {
1145 2 int len = my_printf("%.4G", 1000000.123);
1146
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("1E+06");
1147
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(len, 5);
1148 2 }
1149
1150 4 Test(my_printf, flag_g_prc_x, .init = redirect_all_std)
1151 {
1152
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_printf("%.1g", 123.456));
1153 2 }
1154
1155 4 Test(my_printf, flag_bigg_prc_x, .init = redirect_all_std)
1156 {
1157
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_printf("%.1G", 123.456));
1158 2 }
1159
1160 4 Test(my_printf, flag_a_prc, .init = redirect_all_std)
1161 {
1162
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_printf("The number is %.1a", 123.456));
1163 2 }
1164
1165 4 Test(my_printf, flag_a_prc_2, .init = redirect_all_std)
1166 {
1167
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_printf("The number is %a", 0.1));
1168 2 }
1169
1170 4 Test(my_printf, flag_a_prc_3, .init = redirect_all_std)
1171 {
1172
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_printf("The number is %.0a", 1));
1173 2 }
1174
1175 4 Test(my_printf, flag_a_prc_4, .init = redirect_all_std)
1176 {
1177
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_printf("The number is %.10a", 1.2345679));
1178 2 }
1179
1180 4 Test(my_printf, flag_a_prc_5, .init = redirect_all_std)
1181 {
1182
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_printf("The number is %.5a", 999.57835));
1183 2 }
1184
1185 4 Test(my_printf, flag_a_prc_6, .init = redirect_all_std)
1186 {
1187
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_printf("The number is %.8a", 138567983.64656757654664965785));
1188 2 }
1189
1190 4 Test(my_printf, flag_biga_prc, .init = redirect_all_std)
1191 {
1192
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_printf("The number is %.1A", 123.456));
1193 2 }
1194
1195 4 Test(my_printf, flag_biga_prc_2, .init = redirect_all_std)
1196 {
1197
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_printf("The number is %A", 0.1));
1198 2 }
1199
1200 4 Test(my_printf, flag_biga_prc_3, .init = redirect_all_std)
1201 {
1202
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_printf("The number is %.0A", 1));
1203 2 }
1204
1205 4 Test(my_printf, flag_biga_prc_4, .init = redirect_all_std)
1206 {
1207
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_printf("The number is %.10A", 1.2345679));
1208 2 }
1209
1210 4 Test(my_printf, flag_biga_prc_5, .init = redirect_all_std)
1211 {
1212
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_printf("The number is %.5A", 999.57835));
1213 2 }
1214
1215 4 Test(my_printf, flag_biga_prc_6, .init = redirect_all_std)
1216 {
1217
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_printf("The number is %.8A", 138567983.64656757654664965785));
1218 2 }
1219