30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
-
+
-
-
+
+
|
i++;
if (!strcmp(result, should)) {
wprintf(L"\r\033[1;%dmchar* tests successful: %2d/%d\033[0m",
(i == NUM_TESTS ? 32 : 33), i, NUM_TESTS);
fflush(stdout);
} else {
wprintf(L"\r\033[1;31mchar* test %d/%d failed!\033[0m\n",
wprintf(L"\r\033[K\033[1;31mchar* test %d/%d failed!\033[0m\n",
i, NUM_TESTS);
wprintf(L"%s is NOT expected result!\n", result);
exit(1);
}
free(result);
}
inline void
check_result_wide(wchar_t *result, const wchar_t *should)
{
i++;
if (!wcscmp(result, should)) {
wprintf(L"\r\033[1;%dmwchar_t* tests successful: %2d/%d\033[0m",
(i == NUM_TESTS ? 32 : 33), i, NUM_TESTS);
fflush(stdout);
} else {
wprintf(L"\r\033[1;31mwchar_t* test %d/%d failed!\033[0m\n",
i, NUM_TESTS);
wprintf(L"\r\033[K\033[1;31mwchar_t* test %d/%d failed!\033[0m"
"\n", i, NUM_TESTS);
wprintf(L"%s is NOT expected result!\n", result);
exit(1);
}
free(result);
}
|