34#include "types/concepts.hpp"
38using namespace std::literals;
46 using namespace steppable::__internals::stringUtils; \
47 using namespace steppable::__internals::utils; \
48 using namespace steppable::testing; \
49 using namespace steppable::output; \
50 Utf8CodePage use_utf8; \
57 const std::string& nameSection = #__VA_ARGS__; \
58 std::cout << colors::brightBlue << std::setw(80) << std::setfill('-') << reset << '\n'; \
59 std::cout << colors::brightBlue << "[Testing: " << nameSection << ']' << reset << '\n'; \
60 auto start = std::chrono::high_resolution_clock::now(); \
61 auto _ = TestCase(nameSection);
65#define SECTION_END() \
66 auto end = std::chrono::high_resolution_clock::now(); \
68 std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - start) \
71 std::cout << colors::brightBlue << '[' << nameSection << " took " << duration << "(microseconds) to finish]" \
73 std::cout << reset << '\n'; \
74 errors += _.errorCount; \
81 error("TEST_END"s, "Not all tests passed. There are {0} errors."s, { std::to_string(errors) }); \
83 info("TEST_END"s, "All tests passed."s); \
84 std::cout << colors::brightBlue << std::setw(80) << std::setfill('=') << reset << '\n'; \
125 void assertIsEqual(
const std::string& a,
const std::string& b);
139 template<concepts::Numeric ValueT>
142 const std::string& conditionName =
152 template<concepts::Numeric ValueT>
155 const std::string& conditionName =
166 template<concepts::Numeric ValueT>
169 const std::string& conditionName =
179 template<concepts::Presentable ValueT>
182 const std::string& conditionName =
192 template<concepts::Presentable ValueT>
195 const std::string& conditionName =
void _assertCondition(bool condition, const std::string &conditionName)
Asserts a given condition and logs the condition name if it fails.
Definition testing.cpp:38
int errorCount
Definition testing.hpp:112
std::string testCaseName
Definition testing.hpp:109
TestCase(std::string testCaseName)
Constructs a new TestCase object with the given name.
Definition testing.cpp:36
void summarize() const
Prints a summary of the test case, including the number of errors encountered.
Definition testing.cpp:75
void assertFalse(bool value)
Asserts that a boolean value is false.
Definition testing.cpp:69
void assertTrue(bool value)
Asserts that a boolean value is true.
Definition testing.cpp:63
void assertIsEqual(const std::string &a, const std::string &b)
Asserts that two strings are equal.
Definition testing.cpp:51
void assertIsEqual(ValueT a, ValueT b)
Asserts that two numeric values are equal.
Definition testing.hpp:140
void assertIsNearlyEqual(ValueT a, ValueT b)
Asserts that two numeric values are nearly equal.
Definition testing.hpp:153
void assertIsNotEqual(const std::string &a, const std::string &b)
Asserts that two strings are not equal.
Definition testing.cpp:57
void assertIsNotEqual(ValueT a, ValueT b)
Asserts that two numeric values are not equal.
Definition testing.hpp:167
std::string abs(const std::string &_number, const int steps)
Calculates the absolute value of a string representation of a number.
Definition abs.cpp:56
Includes testing utilities for Steppable.
Definition testing.cpp:35