C++Spec 1.0.0
BDD testing for C++
|
A Description with a defined subject. More...
#include <class_description.hpp>
Public Member Functions | |
ClassDescription (Block block, std::source_location location=std::source_location::current()) | |
ClassDescription (const char *description, Block block, std::source_location location=std::source_location::current()) | |
ClassDescription (const char *description, T &subject, Block block, std::source_location location=std::source_location::current()) | |
template<Util::not_c_string U> | |
ClassDescription (U &subject, Block block, std::source_location location=std::source_location::current()) | |
ClassDescription (const char *description, T &&subject, Block block, std::source_location location=std::source_location::current()) | |
template<Util::not_c_string U> | |
ClassDescription (U &&subject, Block block, std::source_location location=std::source_location::current()) | |
template<typename U> | |
ClassDescription (std::initializer_list< U > init_list, Block block, std::source_location location=std::source_location::current()) | |
template<typename U> | |
ClassDescription (const char *description, std::initializer_list< U > init_list, Block block, std::source_location location=std::source_location::current()) | |
ItCD< T > & | it (const char *name, std::function< void(ItCD< T > &)> block, std::source_location location=std::source_location::current()) |
ItCD< T > & | it (std::function< void(ItCD< T > &)> block, std::source_location location=std::source_location::current()) |
template<class U = std::nullptr_t, class B> | |
ClassDescription< T > & | context (const char *description, B block, std::source_location location=std::source_location::current()) |
template<class U, class B> | |
ClassDescription< U > & | context (const char *description, U &subject, B block, std::source_location location=std::source_location::current()) |
template<class U, class B> | |
ClassDescription< U > & | context (U &subject, B block, std::source_location location=std::source_location::current()) |
template<class U, class B> | |
ClassDescription< U > & | context (const char *description, U &&subject, B block, std::source_location location=std::source_location::current()) |
template<class U, class B> | |
ClassDescription< U > & | context (U &&subject, B block, std::source_location location=std::source_location::current()) |
void | run () override |
std::string | get_subject_type () const noexcept override |
template<class U, class B> | |
ClassContext< U > & | context (const char *description, U &subject, B block, std::source_location location) |
template<class U, class B> | |
ClassContext< U > & | context (const char *description, U &&subject, B block, std::source_location location) |
template<class U, class B> | |
ClassContext< T > & | context (const char *description, B block, std::source_location location) |
![]() | |
Description (const char *description, Block block, std::source_location location=std::source_location::current()) noexcept | |
Description (std::source_location location, std::string &&description) noexcept | |
Description (std::source_location location, const char *description, Block block) noexcept | |
ItD & | it (const char *name, ItD::Block body, std::source_location location=std::source_location::current()) |
ItD & | it (ItD::Block body, std::source_location location=std::source_location::current()) |
template<class T = std::nullptr_t> | |
Description & | context (const char *description, Block body, std::source_location location=std::source_location::current()) |
template<Util::not_c_string T, class B> | |
ClassDescription< T > & | context (T &subject, B block, std::source_location location=std::source_location::current()) |
template<class T, class B> | |
ClassDescription< T > & | context (const char *description, T &subject, B block, std::source_location location=std::source_location::current()) |
template<Util::not_c_string T, class B> | |
ClassDescription< T > & | context (T &&subject, B block, std::source_location location=std::source_location::current()) |
template<class T, class B> | |
ClassDescription< T > & | context (const char *description, T &&subject, B block, std::source_location location=std::source_location::current()) |
template<class T, typename U> | |
ClassDescription< T > & | context (std::initializer_list< U > init_list, std::function< void(ClassDescription< T > &)> block, std::source_location location=std::source_location::current()) |
void | before_each (VoidBlock block) |
void | before_all (VoidBlock block) |
void | after_each (VoidBlock block) |
void | after_all (VoidBlock block) |
template<typename T> | |
auto | let (T body) -> Let< decltype(body())> |
Object generator for Let. | |
void | reset_lets () noexcept |
virtual std::string | get_description () const noexcept |
void | run () override |
template<typename Formatter> | |
auto | as_main () |
template<Util::not_c_string T, class B> | |
ClassContext< T > & | context (T &subject, B block, std::source_location location) |
template<class T, class B> | |
ClassContext< T > & | context (const char *description, T &subject, B block, std::source_location location) |
template<Util::not_c_string T, class B> | |
ClassContext< T > & | context (T &&subject, B block, std::source_location location) |
template<class T, class B> | |
ClassContext< T > & | context (const char *description, T &&subject, B block, std::source_location location) |
template<class T, typename U> | |
ClassContext< T > & | context (std::initializer_list< U > init_list, std::function< void(ClassDescription< T > &)> block, std::source_location location) |
template<class T> | |
Context & | context (const char *description, Block body, std::source_location location) |
![]() | |
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 |
virtual Result | get_result () const |
size_t | num_tests () const noexcept |
size_t | num_failures () const noexcept |
Public Attributes | |
T | subject |
![]() | |
std::forward_list< LetBase * > | lets |
std::deque< VoidBlock > | after_alls |
std::deque< VoidBlock > | before_eaches |
std::deque< VoidBlock > | after_eaches |
Additional Inherited Members | |
![]() | |
using | Block = std::function<void(Description&)> |
![]() | |
void | exec_before_eaches () |
void | exec_after_eaches () |
![]() | |
std::string | description |
A Description with a defined subject.
A ClassDescription is a subclass of Description that allows for templating and specification of the subject of the tests prior to any it
objects.
It is also aliased to the context keyword through Description whenever it is templated, allowing the implicit subject in any child it
blocks
|
inlinenodiscardoverridevirtualnoexcept |
Reimplemented from CppSpec::Description.
ItCD< T > & CppSpec::ClassDescription< T >::it | ( | const char * | name, |
std::function< void(ItCD< T > &)> | block, | ||
std::source_location | location = std::source_location::current() ) |
Jasmine-style it
declaration, with an explicit docstring provided for verbose printing.
As this is an ItCD, it passes along associated type information about the implicit subject from the containing ClassDescription / ClassContext.
name | the name of the test |
block | the contents of test |
ItCD< T > & CppSpec::ClassDescription< T >::it | ( | std::function< void(ItCD< T > &)> | block, |
std::source_location | location = std::source_location::current() ) |
Rspec-style it
declaration, with an implicit docstring generated by the contained expect
s. Particularly handy if testing multiple facets of a single behavior and there is a desire to be verbose, as each expectation prints its own docstring.
As this is an ItCD, it passes along associated type information about the implicit subject from the containing ClassDescription / ClassContext.
block | the contents of the test |
|
overridevirtual |
Implements CppSpec::Runnable.