NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
This class handles assertions and throws the corresponding exception, if the assertion fails. It is currently used as global singleton, but is not restricted to this pattern. More...
#include <error.hpp>
Public Member Functions | |
Assertion () | |
void | reset () |
Resets the assertion handler. More... | |
void | resetStats () |
Resets the internal statistic variables for accumulating the total number of executed and the number of failed tests. More... | |
void | enable (const std::string &sExpr) |
Enables the assertion handler using the passed expression. More... | |
void | checkAssertion (mu::value_type *v, int nNum) |
Checks the return value of a muParser evaluated result. More... | |
void | checkAssertion (const Matrix &_mMatrix) |
Checks the return value of the matrix operation. More... | |
void | checkAssertion (const StringResult &strRes) |
Checks the return vale of the string parser in the not-numerical-only case. More... | |
AssertionStats | getStats () const |
Returns the current tests stats. More... | |
Private Member Functions | |
void | assertionFail () |
This member function is a wrapper around the assertion error. More... | |
Private Attributes | |
std::string | sAssertedExpression |
bool | assertionMode |
AssertionStats | stats |
This class handles assertions and throws the corresponding exception, if the assertion fails. It is currently used as global singleton, but is not restricted to this pattern.
|
private |
This member function is a wrapper around the assertion error.
Definition at line 183 of file error.cpp.
References SyntaxError::ASSERTION_ERROR, AssertionStats::failed(), findCommand(), sAssertedExpression, and stats.
Referenced by checkAssertion().
void Assertion::checkAssertion | ( | const Matrix & | _mMatrix | ) |
Checks the return value of the matrix operation.
_mMatrix | const Matrix& |
Definition at line 271 of file error.cpp.
References assertionFail(), assertionMode, Matrix::data(), stats, and AssertionStats::succeeded().
void Assertion::checkAssertion | ( | const StringResult & | strRes | ) |
Checks the return vale of the string parser in the not-numerical-only case.
strRes | const StringResult& |
Definition at line 298 of file error.cpp.
References assertionFail(), assertionMode, StringResult::bOnlyLogicals, NumeReKernel::getInstance(), NumeReKernel::getParser(), mu::ParserBase::SetExpr(), stats, AssertionStats::succeeded(), StringResult::vNoStringVal, and StringResult::vResult.
void Assertion::checkAssertion | ( | mu::value_type * | v, |
int | nNum | ||
) |
Checks the return value of a muParser evaluated result.
v | mu::value_type* |
nNum | int |
Definition at line 244 of file error.cpp.
References assertionFail(), assertionMode, stats, and AssertionStats::succeeded().
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), NumeRe::StringParser::evalAndFormat(), NumeReKernel::MainLoop(), performMatrixOperation(), and Procedure::ProcCalc().
void Assertion::enable | ( | const std::string & | sExpr | ) |
Enables the assertion handler using the passed expression.
sExpr | const std::string& |
Definition at line 228 of file error.cpp.
References assertionMode, and sAssertedExpression.
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), NumeReKernel::MainLoop(), and Procedure::ProcCalc().
AssertionStats Assertion::getStats | ( | ) | const |
Returns the current tests stats.
Definition at line 328 of file error.cpp.
References stats.
Referenced by Procedure::execute(), and FlowCtrl::updateTestStats().
void Assertion::reset | ( | ) |
Resets the assertion handler.
Definition at line 196 of file error.cpp.
References assertionMode, and sAssertedExpression.
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), Procedure::execute(), and NumeReKernel::MainLoop().
void Assertion::resetStats | ( | ) |
Resets the internal statistic variables for accumulating the total number of executed and the number of failed tests.
Definition at line 214 of file error.cpp.
References AssertionStats::reset(), and stats.
Referenced by NumeReKernel::MainLoop().
|
private |
Definition at line 551 of file error.hpp.
Referenced by checkAssertion(), enable(), and reset().
|
private |
Definition at line 550 of file error.hpp.
Referenced by assertionFail(), enable(), and reset().
|
private |
Definition at line 553 of file error.hpp.
Referenced by assertionFail(), checkAssertion(), getStats(), and resetStats().