|
C++Spec 1.1.0
BDD testing for C++
|
Wraps the target of an expectation. More...
#include <expectation.hpp>

Public Member Functions | |
| Expectation (std::source_location location) | |
| Expectation (ItBase &it, std::source_location location) | |
| Create an Expectation using a value. | |
| virtual A & | get_target () &=0 |
| Get the target of the expectation. | |
| ItBase * | get_it () const |
| std::source_location | get_location () const |
| constexpr bool | positive () const |
| Get whether the expectation is normal or negated. | |
| constexpr bool | ignored () const |
| virtual Expectation & | not_ ()=0 |
| virtual Expectation & | ignore ()=0 |
| template<class M> | |
| 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="") |
| template<typename E> | |
| 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. | |
| template<typename E> | |
| void | to_be_greater_than (E rhs, std::string msg="") |
| template<typename E> | |
| void | to_be_less_than (E rhs, std::string msg="") |
| template<typename E> | |
| Matchers::BeWithinHelper< A, E > | to_be_within (E expected, std::string msg="") |
| Match using the Matchers::BeWithin matcher. | |
| template<Util::is_string_like T> | |
| void | to_end_with (T ending, std::string msg="") |
| Match using the Matchers::EndWith matcher, with the ending given as text. | |
| 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="") |
| template<Util::is_string_like T> | |
| void | to_match (T pattern, std::string msg="") |
| Match using the Matchers::Match matcher, with a pattern given as text. | |
| void | to_partially_match (std::regex regex, std::string msg="") |
| template<Util::is_string_like T> | |
| void | to_partially_match (T pattern, std::string msg="") |
| Match using the Matchers::MatchPartial matcher, with a pattern given as text. | |
| template<typename F> | |
| void | to_satisfy (F test, std::string msg="") |
| Match using the Matchers::Satisfy matcher. | |
| template<Util::is_string_like T> | |
| void | to_start_with (T start, std::string msg="") |
| Match using the Matchers::StartWith matcher, with the start given as text. | |
| template<typename U> | |
| void | to_contain (std::initializer_list< U > expected, std::string msg="") |
| Match using the Matchers::Include matcher, given an initializer list. | |
| template<typename E> | |
| void | to_contain (E expected, std::string msg="") |
| Match using the Matchers::Include matcher. | |
| template<typename U> | |
| void | to_end_with (std::initializer_list< U > start, std::string msg="") |
| template<typename E> | |
| void | to_equal (E expected, std::string msg="") |
| Match using the Matchers::Equal matcher. | |
| template<typename U> | |
| void | to_start_with (std::initializer_list< U > start, std::string msg="") |
| void | to_have_value (std::string msg="") |
Protected Attributes | |
| bool | is_positive_ = true |
| bool | ignore_ = false |
Wraps the target of an expectation.
Static typing forces us to either give the type of the expected result to the Matcher object, or chain in a builder-like fashion.
|
inlineexplicit |
Create an Expectation using a value.
| value | The target to test, an explicit value. |
|
pure virtual |
Get the target of the expectation.
Implemented in CppSpec::ExpectationFunc< F >, and CppSpec::ExpectationValue< A >.
| void CppSpec::Expectation< A >::to | ( | M | matcher, |
| std::string | msg = "" ) |
| matcher | |
| msg |
| A | |
| M |
| void CppSpec::Expectation< A >::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.
| min | |
| max | |
| msg | Optional message to give on failure. |
| void CppSpec::Expectation< A >::to_be_false | ( | std::string | msg = "" | ) |
Match using the Matchers::Be matcher, testing for falsy-ness.
| msg | Optional message to give on failure. |
| A |
| void CppSpec::Expectation< A >::to_be_falsy | ( | std::string | msg = "" | ) |
| msg |
| void CppSpec::Expectation< A >::to_be_null | ( | std::string | msg = "" | ) |
Match using the Matchers::BeNullptr matcher.
| msg | Optional message to give on failure. |
| void CppSpec::Expectation< A >::to_be_true | ( | std::string | msg = "" | ) |
Match using the Matchers::Be matcher, testing for truthy-ness.
| msg | Optional message to give on failure. |
| void CppSpec::Expectation< A >::to_be_truthy | ( | std::string | msg = "" | ) |
| msg |
| A |
| Matchers::BeWithinHelper< A, E > CppSpec::Expectation< A >::to_be_within | ( | E | expected, |
| std::string | msg = "" ) |
Match using the Matchers::BeWithin matcher.
| expected | |
| msg | Optional message to give on failure. |
| void CppSpec::Expectation< A >::to_contain | ( | E | expected, |
| std::string | msg = "" ) |
Match using the Matchers::Include matcher.
| expected | |
| msg | Optional message to give on failure. |
| void CppSpec::Expectation< A >::to_contain | ( | std::initializer_list< U > | expected, |
| std::string | msg = "" ) |
Match using the Matchers::Include matcher, given an initializer list.
| expected | |
| msg | Optional message to give on failure. |
| void CppSpec::Expectation< A >::to_end_with | ( | T | ending, |
| std::string | msg = "" ) |
Match using the Matchers::EndWith matcher, with the ending given as text.
| ending | the text, in any form string_view_of() reads; a null C string fails, negated or not. |
| msg | Optional message to give on failure. |
| void CppSpec::Expectation< A >::to_equal | ( | E | expected, |
| std::string | msg = "" ) |
Match using the Matchers::Equal matcher.
| expected | |
| msg | Optional message to give on failure. |
| void CppSpec::Expectation< A >::to_match | ( | T | pattern, |
| std::string | msg = "" ) |
Match using the Matchers::Match matcher, with a pattern given as text.
| pattern | the pattern, in any form string_view_of() reads; a null C string fails, negated or not. |
| msg | Optional message to give on failure. |
| void CppSpec::Expectation< A >::to_partially_match | ( | T | pattern, |
| std::string | msg = "" ) |
Match using the Matchers::MatchPartial matcher, with a pattern given as text.
| pattern | the pattern, in any form string_view_of() reads; a null C string fails, negated or not. |
| msg | Optional message to give on failure. |
| void CppSpec::Expectation< A >::to_satisfy | ( | F | test, |
| std::string | msg = "" ) |
Match using the Matchers::Satisfy matcher.
| test | The function to use to test the output of the expectation expression. |
| msg | Optional message to give on failure. |
| void CppSpec::Expectation< A >::to_start_with | ( | T | start, |
| std::string | msg = "" ) |
Match using the Matchers::StartWith matcher, with the start given as text.
| start | the text, in any form string_view_of() reads; a null C string fails, negated or not. |
| msg | Optional message to give on failure. |