C++Spec 1.0.0
BDD testing for C++
Loading...
Searching...
No Matches
CppSpec::Description Class Reference
Inheritance diagram for CppSpec::Description:
Collaboration diagram for CppSpec::Description:

Public Types

using Block = std::function<void(Description&)>
 

Public Member Functions

 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
 
ItDit (const char *name, ItD::Block body, std::source_location location=std::source_location::current())
 
ItDit (ItD::Block body, std::source_location location=std::source_location::current())
 
template<class T = std::nullptr_t>
Descriptioncontext (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
 
virtual std::string get_subject_type () 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>
Contextcontext (const char *description, Block body, std::source_location location)
 
- Public Member Functions inherited from CppSpec::Runnable
 Runnable (std::source_location location)
 
bool has_parent () noexcept
 Check to see if the Runnable has a parent.
 
bool has_parent () const noexcept
 
Runnableget_parent () noexcept
 Get the Runnable's parent.
 
const Runnableget_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

std::forward_list< LetBase * > lets
 
std::deque< VoidBlock > after_alls
 
std::deque< VoidBlock > before_eaches
 
std::deque< VoidBlock > after_eaches
 

Protected Member Functions

void exec_before_eaches ()
 
void exec_after_eaches ()
 

Protected Attributes

std::string description
 

Member Function Documentation

◆ let()

template<typename T>
auto CppSpec::Description::let ( T block) -> Let<decltype(body())>

Object generator for Let.

Parameters
bodythe body of the let statement
Returns
a new Let object

◆ run()

void CppSpec::Description::run ( )
inlineoverridevirtual

Implements CppSpec::Runnable.


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