micro-test-plus 3.2.0
µTest++, a lightweight testing framework for embedded platforms
Loading...
Searching...
No Matches
micro_os_plus::micro_test_plus::test_reporter Class Reference

Reporter to display the test results. For failed tests it prints the actual values of the operands, with their types. More...

#include <micro-os-plus/micro-test-plus.h>

Public Member Functions

 test_reporter ()=default
 
void begin_test_case (const char *name)
 
void begin_test_suite (const char *name)
 
auto color (const bool cond)
 
void end_test_case (const char *name)
 
void end_test_suite (test_suite_base &suite)
 
void endline (void)
 
template<class Expr_T >
void fail (Expr_T &expr, bool abort, std::string &message, const reflection::source_location &location)
 Report a failed condition.
 
void flush (void)
 Flush the current buffered content.
 
test_reporteroperator<< (bool v)
 
test_reporteroperator<< (char *s)
 
test_reporteroperator<< (char c)
 
test_reporteroperator<< (const char *s)
 
template<class Lhs_T , class Rhs_T >
test_reporteroperator<< (const detail::and_< Lhs_T, Rhs_T > &op)
 Output operator to display and() expressions.
 
template<class Lhs_T , class Rhs_T >
test_reporteroperator<< (const detail::eq_< Lhs_T, Rhs_T > &op)
 Output operator to display eq() expressions.
 
template<class Lhs_T , class Rhs_T >
test_reporteroperator<< (const detail::ge_< Lhs_T, Rhs_T > &op)
 Output operator to display ge() expressions.
 
template<class Lhs_T , class Rhs_T >
test_reporteroperator<< (const detail::gt_< Lhs_T, Rhs_T > &op)
 Output operator to display gt() expressions.
 
template<class Lhs_T , class Rhs_T >
test_reporteroperator<< (const detail::le_< Rhs_T, Lhs_T > &op)
 Output operator to display le() expressions.
 
template<class Lhs_T , class Rhs_T >
test_reporteroperator<< (const detail::lt_< Rhs_T, Lhs_T > &op)
 Output operator to display lt() expressions.
 
template<class Lhs_T , class Rhs_T >
test_reporteroperator<< (const detail::ne_< Lhs_T, Rhs_T > &op)
 Output operator to display ne() expressions.
 
template<class T >
test_reporteroperator<< (const detail::not_< T > &op)
 Output operator to display not() expressions.
 
template<class Expr_T >
test_reporteroperator<< (const detail::nothrow_< Expr_T > &op)
 
template<class Lhs_T , class Rhs_T >
test_reporteroperator<< (const detail::or_< Lhs_T, Rhs_T > &op)
 Output operator to display or() expressions.
 
template<class Expr_T , class Exception_T >
test_reporteroperator<< (const detail::throws_< Expr_T, Exception_T > &op)
 
template<class Expr_T >
test_reporteroperator<< (const detail::throws_< Expr_T, void > &op)
 
template<class T >
test_reporteroperator<< (const T &t)
 Output operator to types with a getter.
 
template<class T >
test_reporteroperator<< (const type_traits::genuine_integral_value< T > &v)
 Output operator to display genuine integers, without the type suffix.
 
test_reporteroperator<< (double v)
 
test_reporteroperator<< (float v)
 
test_reporteroperator<< (long double v)
 
test_reporteroperator<< (signed char c)
 
test_reporteroperator<< (signed int v)
 
test_reporteroperator<< (signed long long v)
 
test_reporteroperator<< (signed long v)
 
test_reporteroperator<< (signed short c)
 
test_reporteroperator<< (std::nullptr_t)
 
test_reporteroperator<< (std::string_view sv)
 
template<class T , type_traits::requires_t< type_traits::is_container_v< T > and not type_traits::has_npos_v< T > > = 0>
test_reporteroperator<< (T &&t)
 Output operator to display containers. Iterate all members.
 
template<typename T >
test_reporteroperator<< (T *v)
 Output operator to display any pointer.
 
test_reporteroperator<< (test_reporter &(*func)(test_reporter &))
 Output operator to display the endl.
 
test_reporteroperator<< (unsigned char c)
 
test_reporteroperator<< (unsigned int v)
 
test_reporteroperator<< (unsigned long long v)
 
test_reporteroperator<< (unsigned long v)
 
test_reporteroperator<< (unsigned short c)
 
void output (void)
 
template<class Expr_T >
void pass (Expr_T &expr, std::string &message)
 Report a passed condition.
 

Public Attributes

bool add_empty_line { true }
 
verbosity_t verbosity {}
 

Protected Member Functions

void output_fail_prefix_ (std::string &message, const reflection::source_location &location)
 
void output_fail_suffix_ (bool abort)
 
void output_pass_prefix_ (std::string &message)
 
void output_pass_suffix_ (void)
 

Protected Attributes

colors colors_ {}
 
bool is_in_test_case_ = false
 
std::string out_ {}
 

Detailed Description

Reporter to display the test results. For failed tests it prints the actual values of the operands, with their types.

Definition at line 87 of file test-reporter.h.

Constructor & Destructor Documentation

◆ test_reporter()

micro_os_plus::micro_test_plus::test_reporter::test_reporter ( )
default

Member Function Documentation

◆ begin_test_case()

void micro_os_plus::micro_test_plus::test_reporter::begin_test_case ( const char * name)

Definition at line 280 of file test-reporter.cpp.

◆ begin_test_suite()

void micro_os_plus::micro_test_plus::test_reporter::begin_test_suite ( const char * name)

Definition at line 367 of file test-reporter.cpp.

◆ color()

auto micro_os_plus::micro_test_plus::test_reporter::color ( const bool cond)
inline

Definition at line 93 of file test-reporter.h.

◆ end_test_case()

void micro_os_plus::micro_test_plus::test_reporter::end_test_case ( const char * name)

Definition at line 300 of file test-reporter.cpp.

◆ end_test_suite()

void micro_os_plus::micro_test_plus::test_reporter::end_test_suite ( test_suite_base & suite)

Definition at line 387 of file test-reporter.cpp.

◆ endline()

void micro_os_plus::micro_test_plus::test_reporter::endline ( void )

Definition at line 123 of file test-reporter.cpp.

◆ fail()

template<class Expr_T >
void micro_os_plus::micro_test_plus::test_reporter::fail ( Expr_T & expr,
bool abort,
std::string & message,
const reflection::source_location & location )

Report a failed condition.

Definition at line 203 of file test-reporter-inlines.h.

◆ flush()

void micro_os_plus::micro_test_plus::test_reporter::flush ( void )

Flush the current buffered content.

Definition at line 130 of file test-reporter.cpp.

◆ operator<<() [1/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( bool v)

Definition at line 163 of file test-reporter.cpp.

◆ operator<<() [2/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( char * s)

Definition at line 156 of file test-reporter.cpp.

◆ operator<<() [3/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( char c)

Definition at line 142 of file test-reporter.cpp.

◆ operator<<() [4/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const char * s)

Definition at line 149 of file test-reporter.cpp.

◆ operator<<() [5/36]

template<class Lhs_T , class Rhs_T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const detail::and_< Lhs_T, Rhs_T > & op)

Output operator to display and() expressions.

Definition at line 139 of file test-reporter-inlines.h.

◆ operator<<() [6/36]

template<class Lhs_T , class Rhs_T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const detail::eq_< Lhs_T, Rhs_T > & op)

Output operator to display eq() expressions.

Definition at line 91 of file test-reporter-inlines.h.

◆ operator<<() [7/36]

template<class Lhs_T , class Rhs_T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const detail::ge_< Lhs_T, Rhs_T > & op)

Output operator to display ge() expressions.

Definition at line 115 of file test-reporter-inlines.h.

◆ operator<<() [8/36]

template<class Lhs_T , class Rhs_T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const detail::gt_< Lhs_T, Rhs_T > & op)

Output operator to display gt() expressions.

Definition at line 107 of file test-reporter-inlines.h.

◆ operator<<() [9/36]

template<class Lhs_T , class Rhs_T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const detail::le_< Rhs_T, Lhs_T > & op)

Output operator to display le() expressions.

Definition at line 131 of file test-reporter-inlines.h.

◆ operator<<() [10/36]

template<class Lhs_T , class Rhs_T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const detail::lt_< Rhs_T, Lhs_T > & op)

Output operator to display lt() expressions.

Definition at line 123 of file test-reporter-inlines.h.

◆ operator<<() [11/36]

template<class Lhs_T , class Rhs_T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const detail::ne_< Lhs_T, Rhs_T > & op)

Output operator to display ne() expressions.

Definition at line 99 of file test-reporter-inlines.h.

◆ operator<<() [12/36]

template<class T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const detail::not_< T > & op)

Output operator to display not() expressions.

Definition at line 155 of file test-reporter-inlines.h.

◆ operator<<() [13/36]

template<class Expr_T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const detail::nothrow_< Expr_T > & op)

Definition at line 179 of file test-reporter-inlines.h.

◆ operator<<() [14/36]

template<class Lhs_T , class Rhs_T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const detail::or_< Lhs_T, Rhs_T > & op)

Output operator to display or() expressions.

Definition at line 147 of file test-reporter-inlines.h.

◆ operator<<() [15/36]

template<class Expr_T , class Exception_T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const detail::throws_< Expr_T, Exception_T > & op)

Definition at line 163 of file test-reporter-inlines.h.

◆ operator<<() [16/36]

template<class Expr_T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const detail::throws_< Expr_T, void > & op)

Definition at line 172 of file test-reporter-inlines.h.

◆ operator<<() [17/36]

template<class T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const T & t)

Output operator to types with a getter.

◆ operator<<() [18/36]

template<class T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( const type_traits::genuine_integral_value< T > & v)

Output operator to display genuine integers, without the type suffix.

Definition at line 66 of file test-reporter-inlines.h.

◆ operator<<() [19/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( double v)

Definition at line 264 of file test-reporter.cpp.

◆ operator<<() [20/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( float v)

Definition at line 256 of file test-reporter.cpp.

◆ operator<<() [21/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( long double v)

Definition at line 271 of file test-reporter.cpp.

◆ operator<<() [22/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( signed char c)

Definition at line 177 of file test-reporter.cpp.

◆ operator<<() [23/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( signed int v)

Definition at line 209 of file test-reporter.cpp.

◆ operator<<() [24/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( signed long long v)

Definition at line 240 of file test-reporter.cpp.

◆ operator<<() [25/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( signed long v)

Definition at line 224 of file test-reporter.cpp.

◆ operator<<() [26/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( signed short c)

Definition at line 193 of file test-reporter.cpp.

◆ operator<<() [27/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( std::nullptr_t )

Definition at line 170 of file test-reporter.cpp.

◆ operator<<() [28/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( std::string_view sv)

Definition at line 135 of file test-reporter.cpp.

◆ operator<<() [29/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( T && t)

Output operator to display containers. Iterate all members.

Definition at line 76 of file test-reporter-inlines.h.

◆ operator<<() [30/36]

template<typename T >
test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( T * v)

Output operator to display any pointer.

Definition at line 45 of file test-reporter-inlines.h.

◆ operator<<() [31/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( test_reporter &(*)(test_reporter &) func)

Output operator to display the endl.

Definition at line 114 of file test-reporter.cpp.

◆ operator<<() [32/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( unsigned char c)

Definition at line 185 of file test-reporter.cpp.

◆ operator<<() [33/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( unsigned int v)

Definition at line 216 of file test-reporter.cpp.

◆ operator<<() [34/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( unsigned long long v)

Definition at line 248 of file test-reporter.cpp.

◆ operator<<() [35/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( unsigned long v)

Definition at line 232 of file test-reporter.cpp.

◆ operator<<() [36/36]

test_reporter & micro_os_plus::micro_test_plus::test_reporter::operator<< ( unsigned short c)

Definition at line 201 of file test-reporter.cpp.

◆ output()

void micro_os_plus::micro_test_plus::test_reporter::output ( void )

Definition at line 424 of file test-reporter.cpp.

◆ output_fail_prefix_()

void micro_os_plus::micro_test_plus::test_reporter::output_fail_prefix_ ( std::string & message,
const reflection::source_location & location )
protected

Definition at line 71 of file test-reporter.cpp.

◆ output_fail_suffix_()

void micro_os_plus::micro_test_plus::test_reporter::output_fail_suffix_ ( bool abort)
protected

Definition at line 102 of file test-reporter.cpp.

◆ output_pass_prefix_()

void micro_os_plus::micro_test_plus::test_reporter::output_pass_prefix_ ( std::string & message)
protected

Definition at line 47 of file test-reporter.cpp.

◆ output_pass_suffix_()

void micro_os_plus::micro_test_plus::test_reporter::output_pass_suffix_ ( void )
protected

Definition at line 63 of file test-reporter.cpp.

◆ pass()

template<class Expr_T >
void micro_os_plus::micro_test_plus::test_reporter::pass ( Expr_T & expr,
std::string & message )

Report a passed condition.

Definition at line 188 of file test-reporter-inlines.h.

Member Data Documentation

◆ add_empty_line

bool micro_os_plus::micro_test_plus::test_reporter::add_empty_line { true }

Definition at line 315 of file test-reporter.h.

◆ colors_

colors micro_os_plus::micro_test_plus::test_reporter::colors_ {}
protected

Definition at line 336 of file test-reporter.h.

◆ is_in_test_case_

bool micro_os_plus::micro_test_plus::test_reporter::is_in_test_case_ = false
protected

Definition at line 339 of file test-reporter.h.

◆ out_

std::string micro_os_plus::micro_test_plus::test_reporter::out_ {}
protected

Definition at line 337 of file test-reporter.h.

◆ verbosity

verbosity_t micro_os_plus::micro_test_plus::test_reporter::verbosity {}

Definition at line 317 of file test-reporter.h.


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