CppUtils::UnitTest::TestSuite
STRUCTCore test suite execution context providing assertion methods, builders, and test registration.
Description
Section titled “Description”Instances are passed to test suite definitions configured via testSuite("SuiteName") = [](TestSuite& suite) { ... };. Supports regular tests, compile-time tests, parameterized tests (types, values, ranges), fuzz tests, and benchmarks.
Public types
Section titled “Public types”Logger
Section titled “Logger”using CppUtils::UnitTest::TestSuite::Logger = Logger<"UnitTests">;ValueTestBuilder
Section titled “ValueTestBuilder”using CppUtils::UnitTest::TestSuite::ValueTestBuilder = ParameterizedTestBuilder<std::tuple<Values...>>;RangeTestBuilder
Section titled “RangeTestBuilder”using CppUtils::UnitTest::TestSuite::RangeTestBuilder = ParameterizedTestBuilder<Range>;Public attributes
Section titled “Public attributes”Public methods
Section titled “Public methods”Declares a test case with the specified name, returning a builder to configure and assign its body.
| Parameter | Description |
|---|---|
name | Descriptive test name. |
Returns: TestBuilder instance.
Evaluates a test predicate at compile time via static_assert and registers it as a passed test.
The template predicate is evaluated at compile time: any assertion failure immediately breaks the build before the test executable is even run.
At runtime, this method registers an empty test body in the test runner so that the test appears in reports and metrics while avoiding the process isolation fork() overhead of runtime test cases. Prefer this overload when verifying constexpr functions, concepts, type traits, or template metaprogramming.
| Template parameter | Description |
|---|---|
Predicate | Constexpr invocable returning a boolean or performing static assertions. |
| Parameter | Description |
|---|---|
name | Descriptive test name. |
[[nodiscard]] auto TestSuite::fuzzTest(std::string name, std::size_t iterations) -> FuzzTestBuilder;Registers a fuzz test executed for a specified number of randomized iterations.
| Parameter | Description |
|---|---|
name | Test identifier. |
iterations | Number of iterations to run. |
Returns: FuzzTestBuilder for assigning the test body callback.