Aller au contenu
Bienvenue sur la nouvelle documentation de CppUtils !

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

Paramètre templateDescription
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.

ParamètreDescription
newTimeoutTimeout duration.

Retourne : Reference to this builder.

Deliberately marks this test case to be skipped.

ParamètreDescription
messageJustification for skipping.

Retourne : Rebound builder with skipping enabled.

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

Conditionally marks this test case to be skipped.

Paramètre templateDescription
ConditionCompile-time condition flag.
ParamètreDescription
messageJustification for skipping.

Retourne : 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.

ParamètreDescription
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.

ParamètreDescription
nameTest identifier.