kaycxx-test
C++ unit test framework
Loading...
Searching...
No Matches
Public Member Functions | List of all members
kaycxx::test::skip_condition Class Reference

Condition used by a test case to decide whether it should be skipped before running hooks and test code. More...

#include <kaycxx/test/skip.hpp>

Public Member Functions

 skip_condition (std::string_view reason="")
 Creates a condition that always skips the test.
 
 skip_condition (std::move_only_function< bool()> condition, std::string_view reason="")
 Creates a dynamic skip condition.
 
bool should_skip ()
 Checks if the test should be skipped.
 
std::string const & reason () const noexcept
 Returns the skip reason.
 

Detailed Description

Condition used by a test case to decide whether it should be skipped before running hooks and test code.

Constructor & Destructor Documentation

◆ skip_condition() [1/2]

kaycxx::test::skip_condition::skip_condition ( std::string_view  reason = "")
explicit

Creates a condition that always skips the test.

Parameters
reasonOptional reason why the test should be skipped.

◆ skip_condition() [2/2]

kaycxx::test::skip_condition::skip_condition ( std::move_only_function< bool()>  condition,
std::string_view  reason = "" 
)

Creates a dynamic skip condition.

Parameters
conditionCallback returning true when the test should be skipped.
reasonOptional reason why the test should be skipped.

Member Function Documentation

◆ reason()

std::string const & kaycxx::test::skip_condition::reason ( ) const
noexcept

Returns the skip reason.

Returns
The skip reason, or an empty string if no reason was provided.

◆ should_skip()

bool kaycxx::test::skip_condition::should_skip ( )

Checks if the test should be skipped.

Returns
True if the test should be skipped, false if it should run.

The documentation for this class was generated from the following file: