Theoretica
A C++ numerical and automatic mathematical library
|
Error checking module. More...
Classes | |
class | assert_result |
Result of assertion checking of a function. More... | |
class | errno_result |
Result of errno checking of a function. More... | |
class | exception_result |
Result of exception checking of a function. More... | |
class | err_settings |
Global settings of the error testing module. More... | |
class | err_results |
error checking More... | |
Functions | |
void | setup (const std::string &moduleName, int argc=0, const char **argv=nullptr) |
Setup error checking module. More... | |
void | terminate (bool exit=true) |
Terminate the error testing environment. More... | |
void | assert (const std::string &name, bool exp, std::string description="", bool quiet=false) |
Assert that an expression is true. More... | |
template<typename Function , typename InputType > | |
void | check_errno (const std::string &name, Function f, InputType x, int expected_errno, bool quiet=false) |
Check errno value after function call. More... | |
template<typename Function , typename InputType > | |
void | check_errno (const std::string &name, Function f, std::function< InputType()> generator, int expected_errno, bool quiet=false) |
Check errno value after function call. More... | |
template<typename Function , typename InputType > | |
void | check_errno (const std::string &name, Function f, InputType x, std::vector< int > &expected_flags, bool quiet=false) |
Check errno value after function call. More... | |
template<typename Function , typename InputType > | |
void | check_errno (const std::string &name, Function f, std::function< InputType()> generator, std::vector< int > &expected_flags, bool quiet=false) |
Check errno value after function call. More... | |
template<typename Function , typename InputType > | |
void | check_exception (const std::string &name, Function f, InputType x, bool quiet=false) |
Check that an exception is thrown during a function call. More... | |
template<typename Function , typename InputType > | |
void | check_exception (const std::string &name, Function f, std::function< InputType()> generator, bool quiet=false) |
Check that an exception is thrown during a function call. More... | |
template<typename ExceptionType , typename Function , typename InputType > | |
void | check_exception (const std::string &name, Function f, InputType x, bool quiet=false) |
Check that an exception is thrown during a function call and that the type of the exception is correct. More... | |
template<typename ExceptionType , typename Function , typename InputType > | |
void | check_exception (const std::string &name, Function f, std::function< InputType()> generator, bool quiet=false) |
Check that an exception is thrown during a function call and that the type of the exception is correct. More... | |
Variables | |
struct chebyshev::err::err_settings | settings |
struct chebyshev::err::err_results | results |
Error checking module.
This module provides functions to test error reporting with different methods. Assertions are checked with err::assert, while the value of errno after a function call can be checked using err::check_errno and the throwing of exceptions can be checked using check_exception.
|
inline |
Assert that an expression is true.
name | Name of the check (function name or test case name). |
exp | Expression to test for truth. |
description | Description of the assertion. |
|
inline |
Check errno value after function call.
name | The name of the function or test case |
f | The function to test |
x | The input value to evaluate the function at |
expected_errno | The expected value of errno |
|
inline |
Check errno value after function call.
name | The name of the function or test case |
f | The function to test |
x | The input value to evaluate the function at |
expected_flags | A list of the expected errno flags |
|
inline |
Check errno value after function call.
name | The name of the function or test case |
f | The function to test |
generator | A function which takes in an index and returns a (potentially random) input value |
expected_errno | The expected value of errno |
void chebyshev::err::check_errno | ( | const std::string & | name, |
Function | f, | ||
std::function< InputType()> | generator, | ||
std::vector< int > & | expected_flags, | ||
bool | quiet = false |
||
) |
Check errno value after function call.
name | The name of the function or test case |
f | The function to test |
generator | A function which takes in an index and returns a (potentially random) input value |
expected_flags | A list of the expected errno flags |
|
inline |
Check that an exception is thrown during a function call.
name | The name of the function or test case |
f | The function to test |
x | The input value to use |
|
inline |
Check that an exception is thrown during a function call and that the type of the exception is correct.
name | The name of the function or test case |
f | The function to test |
x | The input value to use |
|
inline |
Check that an exception is thrown during a function call.
name | The name of the function or test case |
f | The function to test |
generator | A function which takes in an index and returns a (potentially random) input value |
|
inline |
Check that an exception is thrown during a function call and that the type of the exception is correct.
name | The name of the function or test case |
f | The function to test |
generator | A function which takes in an index and returns a (potentially random) input value |
|
inline |
Setup error checking module.
moduleName | Name of the module under test. |
argc | The number of command line arguments |
argv | A list of C-style strings containing the command line arguments. |
|
inline |
Terminate the error testing environment.
If test cases have been run, their results will be printed.
exit | Whether to exit after terminating the module. |