DUNE PDELab (git)
Test suite for arithmetic types. More...
#include <dune/common/test/arithmetictestsuite.hh>
Classes | |
struct | Arithmetic |
tag denoting any arithmetic type More... | |
struct | Boolean |
tag denoting boolean types More... | |
struct | Floating |
tag denoting floating point types More... | |
struct | Integral |
tag denoting integral types More... | |
struct | Signed |
tag denoting signed integral types More... | |
struct | Unsigned |
tag denoting unsigned integral types More... | |
Public Member Functions | |
template<class T > | |
void | checkDefaultConstruct (Arithmetic arithmetic_tag) |
check the default constructors | |
template<class T > | |
void | checkExplicitIntConvert (Arithmetic arithmetic_tag) |
check explicit conversion from and to int | |
template<class T > | |
void | checkMoveConstruct (Arithmetic arithmetic_tag) |
check the move constructor | |
template<class T > | |
void | checkCopyConstruct (Arithmetic arithmetic_tag) |
check the copy constructor | |
template<class T > | |
void | checkMoveAssign (Arithmetic arithmetic_tag) |
check the move assignment operator | |
template<class T > | |
void | checkCopyAssign (Arithmetic arithmetic_tag) |
check the copy assignment operator | |
template<class T > | |
void | checkEqual (Arithmetic arithmetic_tag) |
check == and != More... | |
template<class T > | |
void | checkPostfixInc (Arithmetic arithmetic_tag) |
check postfix ++ More... | |
template<class T > | |
void | checkPostfixDec (Arithmetic arithmetic_tag) |
check postfix -- More... | |
template<class T > | |
void | checkPrefixPlus (Arithmetic arithmetic_tag) |
check prefix + More... | |
template<class T > | |
void | checkPrefixMinus (Arithmetic arithmetic_tag) |
check prefix - More... | |
template<class T > | |
void | checkPrefixNot (Arithmetic arithmetic_tag) |
check prefix ! More... | |
template<class T > | |
void | checkPrefixBitNot (Boolean arithmetic_tag) |
check prefix ~ More... | |
template<class T > | |
void | checkPrefixInc (Arithmetic arithmetic_tag) |
check postfix ++ More... | |
template<class T > | |
void | checkPrefixDec (Arithmetic arithmetic_tag) |
check postfix -- More... | |
template<class T > | |
void | checkInfixMul (Arithmetic arithmetic_tag) |
check infix * More... | |
template<class T > | |
void | checkInfixDiv (Arithmetic arithmetic_tag) |
check infix / More... | |
template<class T > | |
void | checkInfixRem (Arithmetic arithmetic_tag) |
check infix % More... | |
template<class T > | |
void | checkInfixPlus (Arithmetic arithmetic_tag) |
check infix + More... | |
template<class T > | |
void | checkInfixMinus (Arithmetic arithmetic_tag) |
check infix - More... | |
template<class T > | |
void | checkInfixLShift (Arithmetic arithmetic_tag) |
check infix << More... | |
template<class T > | |
void | checkInfixRShift (Arithmetic arithmetic_tag) |
check infix >> More... | |
template<class T > | |
void | checkInfixLess (Arithmetic arithmetic_tag) |
check infix < More... | |
template<class T > | |
void | checkInfixGreater (Arithmetic arithmetic_tag) |
check infix > More... | |
template<class T > | |
void | checkInfixLessEqual (Arithmetic arithmetic_tag) |
check infix <= More... | |
template<class T > | |
void | checkInfixGreaterEqual (Arithmetic arithmetic_tag) |
check infix >= More... | |
template<class T > | |
void | checkInfixBitAnd (Arithmetic arithmetic_tag) |
check infix & More... | |
template<class T > | |
void | checkInfixBitXor (Arithmetic arithmetic_tag) |
check infix ^ More... | |
template<class T > | |
void | checkInfixBitOr (Arithmetic arithmetic_tag) |
check infix | More... | |
template<class T > | |
void | checkInfixAnd (Arithmetic arithmetic_tag) |
check infix && More... | |
template<class T > | |
void | checkInfixOr (Arithmetic arithmetic_tag) |
check infix || More... | |
TestSuite (ThrowPolicy policy, std::string name="") | |
Create TestSuite. More... | |
TestSuite (std::string name="", ThrowPolicy policy=ThrowOnRequired) | |
Create TestSuite. More... | |
CollectorStream | check (bool condition, std::string name="") |
Check condition. More... | |
CollectorStream | require (bool condition, std::string name="") |
Check a required condition. More... | |
template<class Exception = AnyException, class Expression > | |
CollectorStream | checkThrow (Expression &&expr, std::string name="") |
Checks that the expression throws. More... | |
template<class Expression > | |
CollectorStream | checkNoThrow (Expression &&expr, std::string name="") |
Checks that the expression doesn't throw. More... | |
template<class Exception = AnyException, class Expression > | |
CollectorStream | requireThrow (Expression &&expr, std::string name="") |
Requires that the expression throws. More... | |
template<class Expression > | |
CollectorStream | requireNoThrow (Expression &&expr, std::string name="") |
Requires that the expression doesn't throw. More... | |
void | subTest (const TestSuite &subTest) |
Collect data from a sub-TestSuite. More... | |
operator bool () const | |
Check if this TestSuite failed. More... | |
std::string | name () const |
Query name. More... | |
bool | report () const |
Print a summary of this TestSuite. More... | |
int | exit () const |
Exit the test. More... | |
Static Public Member Functions | |
template<class T > | |
static constexpr auto | tag (T=T{}) |
determine arithmetic tag for the given type More... | |
Detailed Description
Test suite for arithmetic types.
You usually want to call the member function checkArithmetic()
. The individual component tests are however available for special needs.
Member Function Documentation
◆ check()
|
inlineinherited |
Check condition.
This will throw an exception if the check fails and if the AlwaysThrow policy was used on creation.
- Parameters
-
condition Checks if this is true and increases the failure counter if not. name A name to identify this check. Defaults to ""
- Returns
- A CollectorStream that can be used to create a diagnostic message to be printed on failure.
References Dune::TestSuite::name().
Referenced by Dune::TestSuite::checkNoThrow(), and Dune::TestSuite::checkThrow().
◆ checkEqual()
|
inline |
check ==
and !=
- Note
- We do not require the result to be implicitly convertible to bool, but it must be contextually convertible to bool.
◆ checkInfixAnd()
|
inline |
check infix &&
Applies to boolean, integral and floating point.
◆ checkInfixBitAnd()
|
inline |
check infix &
Applies to boolean and integral.
◆ checkInfixBitOr()
|
inline |
check infix |
Applies to boolean and integral.
◆ checkInfixBitXor()
|
inline |
check infix ^
Applies to boolean and integral.
◆ checkInfixDiv()
|
inline |
check infix /
Applies to boolean, integral, and floating point.
◆ checkInfixGreater()
|
inline |
check infix >
Applies to boolean, integral, and floating point.
◆ checkInfixGreaterEqual()
|
inline |
check infix >=
Applies to boolean, integral, and floating point.
◆ checkInfixLess()
|
inline |
check infix <
Applies to boolean, integral, and floating point.
◆ checkInfixLessEqual()
|
inline |
check infix <=
Applies to boolean, integral, and floating point.
◆ checkInfixLShift()
|
inline |
check infix <<
Applies to boolean and integral.
◆ checkInfixMinus()
|
inline |
check infix -
Applies to boolean, integral, and floating point.
◆ checkInfixMul()
|
inline |
check infix *
Applies to boolean, integral, and floating point.
◆ checkInfixOr()
|
inline |
check infix ||
Applies to boolean, integral and floating point.
◆ checkInfixPlus()
|
inline |
check infix +
Applies to boolean, integral, and floating point.
◆ checkInfixRem()
|
inline |
check infix %
Applies to boolean and integral.
◆ checkInfixRShift()
|
inline |
check infix >>
Applies to boolean and integral.
◆ checkNoThrow()
|
inlineinherited |
Checks that the expression doesn't throw.
This will throw an exception if the check fails and if the AlwaysThrow policy was used on creation.
- Parameters
-
expr A nullary functor that is expected not to throw an exception on evaluation name A name to identify this check. Defaults to ""
- Returns
- A CollectorStream that can be used to create a diagnostic message to be printed on failure.
- Example:
- CollectorStream checkNoThrow(Expression &&expr, std::string name="")Checks that the expression doesn't throw.Definition: testsuite.hh:163
References Dune::TestSuite::check(), and Dune::TestSuite::name().
◆ checkPostfixDec()
|
inline |
check postfix --
Applies to integral (no boolean), and floating point.
◆ checkPostfixInc()
|
inline |
check postfix ++
Applies to boolean (deprecated), integral, and floating point.
◆ checkPrefixBitNot()
|
inline |
check prefix ~
Applies to boolean and integral.
◆ checkPrefixDec()
|
inline |
check postfix --
Applies to integral (no boolean), and floating point.
◆ checkPrefixInc()
|
inline |
check postfix ++
Applies to boolean (deprecated), integral, and floating point.
◆ checkPrefixMinus()
|
inline |
check prefix -
Applies to boolean, integral, and floating point.
◆ checkPrefixNot()
|
inline |
check prefix !
Applies to boolean, integral, and floating point.
◆ checkPrefixPlus()
|
inline |
check prefix +
Applies to boolean, integral, and floating point.
◆ checkThrow()
|
inlineinherited |
Checks that the expression throws.
This will throw an exception if the check fails and if the AlwaysThrow policy was used on creation.
- Parameters
-
expr A nullary functor that is expected to throw an exception on evaluation that is of type Exception
or any exception if the template parameter is omitted.name A name to identify this check. Defaults to ""
- Returns
- A CollectorStream that can be used to create a diagnostic message to be printed on failure.
- Example:
- CollectorStream checkThrow(Expression &&expr, std::string name="")Checks that the expression throws.Definition: testsuite.hh:144
References Dune::TestSuite::check(), and Dune::TestSuite::name().
◆ exit()
|
inlineinherited |
Exit the test.
This will print a summary of the test and return an integer to be used on program exit.
- Returns
- 1 if any of the executed tests failed, otherwise 0.
References Dune::TestSuite::report().
◆ name()
|
inlineinherited |
Query name.
- Returns
- Name of this TestSuite
Referenced by Dune::TestSuite::check(), Dune::TestSuite::checkNoThrow(), Dune::TestSuite::checkThrow(), Dune::TestSuite::report(), Dune::TestSuite::require(), Dune::TestSuite::requireNoThrow(), and Dune::TestSuite::requireThrow().
◆ operator bool()
|
inlineexplicitinherited |
Check if this TestSuite failed.
- Returns
- False if any of the executed tests failed, otherwise true.
◆ report()
|
inlineinherited |
Print a summary of this TestSuite.
- Returns
- False if any of the executed tests failed, otherwise true.
References Dune::TestSuite::name().
Referenced by Dune::TestSuite::exit().
◆ require()
|
inlineinherited |
Check a required condition.
This will always throw an exception if the check fails.
- Parameters
-
condition Checks if this is true and increases the failure counter if not. name A name to identify this check. Defaults to ""
- Returns
- A CollectorStream that can be used to create a diagnostic message to be printed on failure.
References Dune::TestSuite::name().
Referenced by Dune::TestSuite::requireNoThrow(), and Dune::TestSuite::requireThrow().
◆ requireNoThrow()
|
inlineinherited |
Requires that the expression doesn't throw.
This will throw an exception if the check fails.
- Parameters
-
expr A nullary functor that is expected not to throw an exception on evaluation name A name to identify this check. Defaults to ""
- Returns
- A CollectorStream that can be used to create a diagnostic message to be printed on failure.
- Example:
- CollectorStream requireNoThrow(Expression &&expr, std::string name="")Requires that the expression doesn't throw.Definition: testsuite.hh:202
References Dune::TestSuite::name(), and Dune::TestSuite::require().
◆ requireThrow()
|
inlineinherited |
Requires that the expression throws.
This will throw an exception if the check fails.
- Parameters
-
expr A nullary functor that is expected to throw an exception on evaluation that is of type Exception
or any exception if the template parameter is omitted.name A name to identify this check. Defaults to ""
- Returns
- A CollectorStream that can be used to create a diagnostic message to be printed on failure.
- Example:
- CollectorStream requireThrow(Expression &&expr, std::string name="")Requires that the expression throws.Definition: testsuite.hh:183
References Dune::TestSuite::name(), and Dune::TestSuite::require().
◆ subTest()
|
inlineinherited |
Collect data from a sub-TestSuite.
This will incorporate the accumulated results of the sub-TestSuite into this one. If the sub-TestSuite failed, i.e., contained failed checks, a summary will be printed.
References Dune::TestSuite::subTest().
Referenced by Dune::TestSuite::subTest().
◆ tag()
|
inlinestaticconstexpr |
determine arithmetic tag for the given type
T
can be either one of the fundamental arithmetic types, in which case a default-constructed tag object for that type is returned. Or it can be a class derived from Arithmetic
, in which case a default-constructed object of that class is is returned.
◆ TestSuite() [1/2]
|
inline |
◆ TestSuite() [2/2]
|
inline |
The documentation for this class was generated from the following file:
- dune/common/test/arithmetictestsuite.hh