Skip to content
Welcome to the new CppUtils documentation!

Base CRTP helper providing common configuration (timeout, skip) for test builders.

Template parameterDescription
DerivedDerived builder type for method chaining.
IsSkippedIndicates whether the test execution is bypassed.
TestSuite& parentSuite;

Reference to the enclosing test suite registering the test.

std::string testName;

Identifier of the test case.

std::chrono::seconds testTimeout {10};

Maximum execution timeout duration.

std::string skipMessage {};

Explanatory reason if skipped.

TestBuilderBase::TestBuilderBase(TestSuite& suite, std::string name, std::chrono::seconds timeout = std::chrono::seconds{10}, std::string skipReason = {});
auto TestBuilderBase::timeout(std::chrono::seconds newTimeout) -> Derived&;

Sets the execution timeout before the test is aborted.

ParameterDescription
newTimeoutTimeout duration.

Returns: Reference to this builder.

Deliberately marks this test case to be skipped.

ParameterDescription
messageJustification for skipping.

Returns: Rebound builder with skipping enabled.

template <bool Condition>
[[nodiscard]] auto TestBuilderBase::skipIf(std::string message);

Conditionally marks this test case to be skipped.

Template parameterDescription
ConditionCompile-time condition flag.
ParameterDescription
messageJustification for skipping.

Returns: Rebound builder configured with the specified condition.

template <class Function>
auto TestBuilderBase::addTest(std::string name, Function&& function, std::chrono::seconds timeout) -> void;

Adds a test callback into the parent suite, taking skip status into account.

ParameterDescription
nameTest identifier.
functionInvocable test body.
timeoutExecution timeout duration.
auto TestBuilderBase::addCompileTimeTest(std::string name) -> void;

Adds a compile-time test into the parent suite, taking skip status into account.

ParameterDescription
nameTest identifier.