forked from silentbicycle/greatest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_trunc.c
More file actions
36 lines (28 loc) · 705 Bytes
/
example_trunc.c
File metadata and controls
36 lines (28 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* Make the buffer size VERY small, to check truncation */
#define GREATEST_TESTNAME_BUF_SIZE 8
#include "greatest.h"
TEST t(void) {
PASS();
}
TEST abcdefghijklmnopqrstuvwxyz(void) {
PASS();
}
SUITE(suite) {
size_t i;
char buf[10];
memset(buf, 0x00, sizeof(buf));
for (i = 0; i < sizeof(buf); i++) {
if (i > 0) { buf[i - 1] = 'x'; }
greatest_set_test_suffix(buf);
RUN_TEST(t);
}
RUN_TEST(abcdefghijklmnopqrstuvwxyz);
}
GREATEST_MAIN_DEFS();
int main(int argc, char **argv) {
GREATEST_MAIN_BEGIN();
RUN_SUITE(suite);
printf("sizeof(greatest_info): %lu\n",
(unsigned long)sizeof(greatest_info));
GREATEST_MAIN_END();
}