C++Spec 1.0.0
BDD testing for C++
|
An it
embedded in a ClassDescription.
More...
#include <it.hpp>
Public Types | |
using | Block = std::function<void(ItCD<T>&)> |
Public Member Functions | |
ItCD (std::source_location location, T &subject, const char *description, Block block) | |
ItCD (std::source_location location, T &subject, Block block) | |
ExpectationValue< T > | is_expected (std::source_location location=std::source_location::current()) |
void | run () override |
![]() | |
ItBase (std::source_location location) noexcept | |
Create an BaseIt without an explicit description. | |
ItBase (std::source_location location, const char *description) noexcept | |
Create an BaseIt with an explicit description. | |
bool | needs_description () noexcept |
Get whether the object needs a description string. | |
std::string | get_description () const noexcept |
Get the description string for the it statement. | |
ItBase & | set_description (std::string_view description) noexcept |
Set the description string. | |
template<Util::is_not_functional T> | |
ExpectationValue< T > | expect (T value, std::source_location location=std::source_location::current()) |
The expect object generator for objects and LiteralTypes. | |
template<Util::is_functional T> | |
ExpectationFunc< T > | expect (T block, std::source_location location=std::source_location::current()) |
The expect object generator for lambdas. | |
template<typename T> | |
ExpectationValue< std::initializer_list< T > > | expect (std::initializer_list< T > init_list, std::source_location location=std::source_location::current()) |
The expect object generator for initializer lists. | |
template<typename T> | |
ExpectationValue< T > | expect (Let< T > &let, std::source_location location=std::source_location::current()) |
The expect object generator for Let. | |
ExpectationValue< std::string > | expect (const char *string, std::source_location location=std::source_location::current()) |
The expect object generator for const char*. | |
void | add_result (const Result &result) |
std::list< Result > & | get_results () noexcept |
const std::list< Result > & | get_results () const noexcept |
void | clear_results () noexcept |
Result | get_result () const override |
![]() | |
Runnable (std::source_location location) | |
bool | has_parent () noexcept |
Check to see if the Runnable has a parent. | |
bool | has_parent () const noexcept |
Runnable * | get_parent () noexcept |
Get the Runnable's parent. | |
const Runnable * | get_parent () const noexcept |
std::list< std::shared_ptr< Runnable > > & | get_children () noexcept |
const std::list< std::shared_ptr< Runnable > > & | get_children () const noexcept |
template<class C> | |
C * | get_parent_as () noexcept |
template<class C> | |
const C * | get_parent_as () const noexcept |
template<typename T, typename... Args> | |
T * | make_child (Args &&... args) |
std::string | padding () const noexcept |
Generate padding (indentation) fore the current object. | |
std::source_location | get_location () const noexcept |
void | set_location (std::source_location location) noexcept |
virtual void | timed_run () |
std::chrono::duration< double > | get_runtime () const |
std::chrono::time_point< std::chrono::system_clock > | get_start_time () const |
size_t | num_tests () const noexcept |
size_t | num_failures () const noexcept |
Public Attributes | |
T & | subject |
A reference to the parent ClassDescription's subject. | |
An it
embedded in a ClassDescription.
ItCD objects are the representation of an it
in a describe_a
block. They contain both the function that represents the block of the it
, and a reference to the parent ClassDescription::subject
T | the type of the subject of the parent ClassDescription (ClassDescription<T>) |
|
overridevirtual |
Implements CppSpec::Runnable.
T& CppSpec::ItCD< T >::subject |
A reference to the parent ClassDescription's subject.
Public so that we can easily do expect(subject) without needing to have a dedicated macro for accessing the subject via getter, or needing to introduce parenthesis for call syntax (like subject()
)