Skip to content

Commit 1f8d876

Browse files
committed
Minor additions to cpp.hint.
1 parent 83e7cae commit 1f8d876

File tree

2 files changed

+57
-673
lines changed

2 files changed

+57
-673
lines changed

cpp.hint

Lines changed: 57 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,60 @@
2323
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
2424
// such as names of functions and macros.
2525
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
26-
#define SECTION(__VA_ARGS__) \
27-
{ \
28-
const char* nameSection = #__VA_ARGS__; \
29-
std::cout << colors::brightBlue << std::setw(80) << std::setfill('-') << '\0' << reset << '\n'; \
30-
std::cout << colors::brightBlue << "[Testing: " << nameSection << ']' << reset << '\n'; \
31-
auto start = std::chrono::high_resolution_clock::now(); \
32-
auto testCase = TestCase(static_cast<std::string>(nameSection));
26+
#define TEST_START() \
27+
/* NOLINTNEXTLINE(bugprone-exception-escape) */ \
28+
int main() \
29+
{ \
30+
using namespace steppable::__internals::stringUtils; \
31+
using namespace steppable::__internals::utils; \
32+
using namespace steppable::testing; \
33+
using namespace steppable::output; \
34+
Utf8CodePage use_utf8; \
35+
int errors = 0;
36+
37+
#define SECTION(...) \
38+
{ \
39+
const std::string& nameSection = #__VA_ARGS__; \
40+
std::cout << colors::brightBlue << std::setw(80) << std::setfill('-') << reset << '\n'; \
41+
std::cout << colors::brightBlue << "[Testing: " << nameSection << ']' << reset << '\n'; \
42+
auto start = std::chrono::high_resolution_clock::now(); \
43+
auto _ = TestCase(nameSection);
44+
45+
#define SECTION_END() \
46+
auto end = std::chrono::high_resolution_clock::now(); \
47+
auto duration = \
48+
std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - start) \
49+
.count(); \
50+
_.summarize(); \
51+
std::cout << colors::brightBlue << '[' << nameSection << " took " << duration << "(microseconds) to finish]" \
52+
<< reset << '\n'; \
53+
std::cout << reset << '\n'; \
54+
errors += _.errorCount; \
55+
}
56+
57+
#define TEST_END() \
58+
if (errors) \
59+
error("TEST_END", "Not all tests passed. There are %i errors."s, errors); \
60+
else \
61+
info("All tests passed."); \
62+
std::cout << colors::brightBlue << std::setw(80) << std::setfill('=') << reset << '\n'; \
63+
if (errors) \
64+
return 1; \
65+
}
66+
67+
#define TIC(...) \
68+
{ \
69+
const char* nameSection = #__VA_ARGS__; \
70+
std::cout << colors::brightBlue << std::setw(80) << std::setfill('-') << reset << '\n'; \
71+
std::cout << colors::brightBlue << "[Profiling: " << nameSection << ']' << reset << '\n'; \
72+
auto start = std::chrono::high_resolution_clock::now();
73+
74+
#define TOC() \
75+
auto duration = \
76+
std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - start) \
77+
.count(); \
78+
std::cout << colors::brightBlue << '[' << nameSection << " took " << duration << "(microseconds) to execute]" \
79+
<< reset << '\n'; \
80+
std::cout << colors::brightBlue << std::setw(80) << std::setfill('-'); \
81+
std::cout << reset << '\n'; \
82+
}

0 commit comments

Comments
 (0)