C++Spec 1.0.0
BDD testing for C++
Loading...
Searching...
No Matches
CppSpec::ExpectationFunc< F > Class Template Reference
Inheritance diagram for CppSpec::ExpectationFunc< F >:
Collaboration diagram for CppSpec::ExpectationFunc< F >:

Public Member Functions

 ExpectationFunc (ExpectationFunc< F > const &copy, std::source_location location)
 
 ExpectationFunc (ItBase &it, F block, std::source_location location)
 Create an ExpectationValue using a value.
 
block_ret_t & get_target () &override
 Create an Expectation using a function.
 
ExpectationFuncnot_ () override
 
ExpectationFuncignore () override
 
Expectation< decltype(block())> & casted ()
 
template<typename Ex = std::exception>
void to_throw (std::string msg="")
 
- Public Member Functions inherited from CppSpec::Expectation< decltype(std::declval< F >()())>
 Expectation (std::source_location location)
 
 Expectation (ItBase &it, std::source_location location)
 Create an Expectation using a value.
 
ItBaseget_it () const
 
std::source_location get_location () const
 
constexpr bool positive () const
 Get whether the expectation is normal or negated.
 
constexpr bool ignored () const
 
void to (M matcher, std::string msg="")
 
void to_be_false (std::string msg="")
 Match using the Matchers::Be matcher, testing for falsy-ness.
 
void to_be_falsy (std::string msg="")
 
void to_be_null (std::string msg="")
 Match using the Matchers::BeNullptr matcher.
 
void to_be_true (std::string msg="")
 Match using the Matchers::Be matcher, testing for truthy-ness.
 
void to_be_truthy (std::string msg="")
 
void to_be_between (E min, E max, Matchers::RangeMode mode=Matchers::RangeMode::inclusive, std::string msg="")
 Match using the Matchers::BeBetween matcher, with an explicit range mode.
 
void to_be_greater_than (E rhs, std::string msg="")
 
void to_be_less_than (E rhs, std::string msg="")
 
Matchers::BeWithinHelper< decltype(std::declval< F >()()), E > to_be_within (E expected, std::string msg="")
 Match using the Matchers::BeWithin matcher.
 
void to_end_with (std::string ending, std::string msg="")
 
void to_end_with (std::initializer_list< U > start, std::string msg="")
 
void to_fail (std::string msg="")
 
void to_fail_with (std::string failure_message, std::string msg="")
 
void to_match (std::regex regex, std::string msg="")
 
void to_match (std::string str, std::string msg="")
 
void to_partially_match (std::regex regex, std::string msg="")
 
void to_partially_match (std::string str, std::string msg="")
 
void to_satisfy (std::function< bool(decltype(std::declval< F >()()))>, std::string msg="")
 Match using the Matchers::Satisfy matcher.
 
void to_start_with (std::string start, std::string msg="")
 
void to_start_with (std::initializer_list< U > start, std::string msg="")
 
void to_contain (std::initializer_list< U > expected, std::string msg="")
 Match using the Matchers::Include matcher, given an initializer list.
 
void to_contain (E expected, std::string msg="")
 Match using the Matchers::Include matcher.
 
void to_equal (E expected, std::string msg="")
 Match using the Matchers::Equal matcher.
 
void to_have_value (std::string msg="")
 

Additional Inherited Members

- Protected Attributes inherited from CppSpec::Expectation< decltype(std::declval< F >()())>
bool is_positive_
 
bool ignore_
 

Constructor & Destructor Documentation

◆ ExpectationFunc()

template<Util::is_functional F>
CppSpec::ExpectationFunc< F >::ExpectationFunc ( ItBase & it,
F block,
std::source_location location )
inline

Create an ExpectationValue using a value.

Parameters
valueThe target to test, an explicit value.
Returns
The constructed ExpectationValue.

Member Function Documentation

◆ get_target()

template<Util::is_functional F>
block_ret_t & CppSpec::ExpectationFunc< F >::get_target ( ) &
inlineoverridevirtual

Create an Expectation using a function.

This does not simply contain the return value of the given lambda, but instead wraps the thunk, delaying execution until it is time to perform the match.

Parameters
blockA function that returns some value to test against.
Returns
The constructed Expectation.

Get the target of the expectation.

Implements CppSpec::Expectation< decltype(std::declval< F >()())>.

◆ ignore()

template<Util::is_functional F>
ExpectationFunc & CppSpec::ExpectationFunc< F >::ignore ( )
inlineoverridevirtual

◆ not_()

template<Util::is_functional F>
ExpectationFunc & CppSpec::ExpectationFunc< F >::not_ ( )
inlineoverridevirtual

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