-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.c
63 lines (51 loc) · 1.38 KB
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "test.h"
#include <stdio.h>
int main(void)
{
printf("# ccodoc\n");
EXPECT_PASS(test_ccodoc());
printf("\n");
printf("# string\n");
EXPECT_PASS(test_str());
printf("\n");
printf("# time\n");
EXPECT_PASS(test_time());
printf("\n");
printf("# platform\n");
EXPECT_PASS(test_platform());
printf("\n");
printf("# renderer\n");
EXPECT_PASS(test_renderer());
printf("\n");
printf("ALL PASS\n");
return EXIT_SUCCESS;
}
void report_status(
const char* const file, const int line,
const bool passes,
const char* const label,
const char* const actual, const char* const expected
)
{
if (passes) {
printf("PASS: %s => %s\n", label, expected);
return;
}
printf("FAIL: %s =>\n", label);
printf(" expected: %s\n", expected);
printf(" actual: %s\n", actual);
printf("%s:%d\n", file, line);
}
void report_status_str(
const char* const file, const int line,
const bool passes,
const char* const label,
const char* const actual, const char* const expected
)
{
char actual_label[1 << 5] = { 0 };
(void)snprintf(actual_label, sizeof(actual_label), "\"%s\"", actual);
char expected_label[1 << 5] = { 0 };
(void)snprintf(expected_label, sizeof(expected_label), "\"%s\"", expected);
report_status(file, line, passes, label, actual_label, expected_label);
}