-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_main.c
59 lines (49 loc) · 1.22 KB
/
test_main.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
//------------------------------------------------------
//
// Copyright 2023 Mark Seminatore. All rights reserved.
//------------------------------------------------------
#include <stdio.h>
#include "test.h"
#if defined(_WIN32) || defined(_WIN64)
# include <Windows.h>
#endif
//
int test_number = 0;
int test_failures = 0;
int test_suites = 0;
int test_modules = 0;
//------------------------------------------------------
// enable VT100 support in pre Win11 console window
//------------------------------------------------------
int setupConsole()
{
#if defined(_WIN32) || defined(_WIN64)
// Set output mode to handle virtual terminal sequences
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
if (hOut == INVALID_HANDLE_VALUE)
{
return GetLastError();
}
DWORD dwMode = 0;
if (!GetConsoleMode(hOut, &dwMode))
{
return GetLastError();
}
dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
if (!SetConsoleMode(hOut, dwMode))
{
return GetLastError();
}
#endif
return 0;
}
//------------------------------------------------------
// test main entry point
//------------------------------------------------------
int main(int argc, char *argv[])
{
setupConsole();
BEGIN_TESTS();
test_main(argc, argv);
END_TESTS();
}