Test cases for unit testing. More...
#include <qmuparsertest.h>
Public Types | |
typedef int(QmuParserTester::* | testfun_type) () |
Public Member Functions | |
QmuParserTester (QObject *parent=nullptr) | |
Private Slots | |
void | Run () |
Private Member Functions | |
void | AddTest (testfun_type a_pFun) |
int | TestNames () |
Check muParser name restriction enforcement. More... | |
int | TestSyntax () |
int | TestMultiArg () |
int | TestPostFix () |
int | TestExpression () |
int | TestInfixOprt () |
int | TestBinOprt () |
int | TestVarConst () |
int | TestInterface () |
int | TestException () |
int | TestStrArg () |
int | TestIfThenElse () |
int | TestBulkMode () |
Static Private Member Functions | |
static int | EqnTest (const QString &a_str, double a_fRes, bool a_fPass) |
Evaluate a tet expression. More... | |
static int | EqnTestWithVarChange (const QString &a_str, double a_fRes1, double a_fVar1, double a_fRes2, double a_fVar2) |
Evaluate a tet expression. More... | |
static int | ThrowTest (const QString &a_str, int a_iErrc, bool a_bFail=true) |
static int | EqnTestBulk (const QString &a_str, double a_fRes[4], bool a_fPass) |
Test an expression in Bulk Mode. More... | |
static qreal | f1of1 (qreal v) |
static qreal | f1of2 (qreal v, qreal) |
static qreal | f2of2 (qreal, qreal v) |
static qreal | f1of3 (qreal v, qreal, qreal) |
static qreal | f2of3 (qreal, qreal v, qreal) |
static qreal | f3of3 (qreal, qreal, qreal v) |
static qreal | f1of4 (qreal v, qreal, qreal, qreal) |
static qreal | f2of4 (qreal, qreal v, qreal, qreal) |
static qreal | f3of4 (qreal, qreal, qreal v, qreal) |
static qreal | f4of4 (qreal, qreal, qreal, qreal v) |
static qreal | f1of5 (qreal v, qreal, qreal, qreal, qreal) |
static qreal | f2of5 (qreal, qreal v, qreal, qreal, qreal) |
static qreal | f3of5 (qreal, qreal, qreal v, qreal, qreal) |
static qreal | f4of5 (qreal, qreal, qreal, qreal v, qreal) |
static qreal | f5of5 (qreal, qreal, qreal, qreal, qreal v) |
static qreal | Min (qreal a_fVal1, qreal a_fVal2) |
static qreal | Max (qreal a_fVal1, qreal a_fVal2) |
static qreal | plus2 (qreal v1) |
static qreal | times3 (qreal v1) |
static qreal | sqr (qreal v1) |
static qreal | sign (qreal v) |
static qreal | add (qreal v1, qreal v2) |
static qreal | land (qreal v1, qreal v2) |
static qreal | FirstArg (const qreal *a_afArg, int a_iArgc) |
static qreal | LastArg (const qreal *a_afArg, int a_iArgc) |
static qreal | Sum (const qreal *a_afArg, int a_iArgc) |
static qreal | Rnd (qreal v) |
static qreal | RndWithString (const char_type *) |
static qreal | Ping () |
static qreal | ValueOf (const QString &) |
static qreal | StrFun1 (const QString &v1) |
static qreal | StrFun2 (const QString &v1, qreal v2) |
static qreal | StrFun3 (const QString &v1, qreal v2, qreal v3) |
static qreal | StrToFloat (const QString &a_szMsg) |
static qreal | Mega (qreal a_fVal) |
static qreal | Micro (qreal a_fVal) |
static qreal | Milli (qreal a_fVal) |
static int | IsHexVal (const QString &a_szExpr, int *a_iPos, qreal *a_fVal, const QLocale &locale, const QChar &decimal, const QChar &thousand) |
static void | Abort () |
Internal error in test class Test is going to be aborted. More... | |
Private Attributes | |
QVector< testfun_type > | m_vTestFun |
Static Private Attributes | |
static int | c_iCount = 0 |
typedef int( QmuParserTester::* qmu::Test::QmuParserTester::testfun_type) () |
Definition at line 61 of file qmuparsertest.h.
|
explicit |
Definition at line 56 of file qmuparsertest.cpp.
References AddTest(), c_iCount, TestBinOprt(), TestBulkMode(), TestException(), TestExpression(), TestIfThenElse(), TestInfixOprt(), TestInterface(), TestMultiArg(), TestNames(), TestPostFix(), TestStrArg(), TestSyntax(), and TestVarConst().
|
staticprivate |
Internal error in test class Test is going to be aborted.
Definition at line 1528 of file qmuparsertest.cpp.
Referenced by Run().
|
inlinestaticprivate |
Definition at line 190 of file qmuparsertest.h.
Referenced by EqnTest().
|
private |
Definition at line 1110 of file qmuparsertest.cpp.
References m_vTestFun.
Referenced by QmuParserTester().
|
staticprivate |
Evaluate a tet expression.
Definition at line 1278 of file qmuparsertest.cpp.
References add(), c_iCount, qmu::QmuParserBase::DefineConst(), qmu::QmuParserBase::EnableOptimizer(), qmu::QmuParserBase::Eval(), f1of1(), f1of2(), f1of3(), f1of4(), f1of5(), f2of2(), f2of3(), f2of4(), f2of5(), f3of3(), f3of4(), f3of5(), f4of4(), f4of5(), f5of5(), FirstArg(), qmu::QmuParserError::GetMsg(), IsHexVal(), land(), LastArg(), Max(), Mega(), Milli(), Min(), Ping(), plus2(), qmu::prLAND, qmu::prPOW, QmuFuzzyComparePossibleNulls(), sign(), sqr(), StrFun1(), StrFun2(), StrFun3(), StrToFloat(), Sum(), times3(), and ValueOf().
Referenced by TestBinOprt(), TestExpression(), TestIfThenElse(), TestInfixOprt(), TestMultiArg(), TestPostFix(), TestStrArg(), TestSyntax(), and TestVarConst().
|
staticprivate |
Test an expression in Bulk Mode.
Definition at line 1469 of file qmuparsertest.cpp.
References c_iCount, qmu::QmuParserBase::DefineConst(), qmu::QmuParserBase::DefineVar(), qmu::QmuParserBase::Eval(), qmu::QmuParserError::GetExpr(), qmu::QmuParserError::GetMsg(), and qmu::QmuParserBase::SetExpr().
|
staticprivate |
Evaluate a tet expression.
Definition at line 1221 of file qmuparsertest.cpp.
References c_iCount, qmu::QmuParserBase::DefineVar(), qmu::QmuParserBase::Eval(), qmu::QmuParserError::GetMsg(), and qmu::QmuParserBase::SetExpr().
Referenced by TestVarConst().
|
inlinestaticprivate |
Definition at line 85 of file qmuparsertest.h.
Referenced by EqnTest(), and TestNames().
|
inlinestaticprivate |
Definition at line 90 of file qmuparsertest.h.
Referenced by EqnTest(), and TestNames().
|
inlinestaticprivate |
Definition at line 100 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 115 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 135 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 95 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 105 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 120 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 140 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 110 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 125 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 145 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 130 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 150 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 155 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 200 of file qmuparsertest.h.
Referenced by EqnTest().
|
staticprivate |
Definition at line 77 of file qmuparsertest.cpp.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 195 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 210 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 165 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 280 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 285 of file qmuparsertest.h.
|
inlinestaticprivate |
Definition at line 290 of file qmuparsertest.h.
Referenced by EqnTest(), and ThrowTest().
|
inlinestaticprivate |
Definition at line 160 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 245 of file qmuparsertest.h.
Referenced by EqnTest(), and ThrowTest().
|
inlinestaticprivate |
Definition at line 170 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 235 of file qmuparsertest.h.
|
inlinestaticprivate |
Definition at line 240 of file qmuparsertest.h.
|
privateslot |
Definition at line 1117 of file qmuparsertest.cpp.
References Abort(), c_iCount, qmu::QmuParserError::GetMsg(), qmu::QmuParserError::GetToken(), and m_vTestFun.
|
inlinestaticprivate |
Definition at line 185 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 180 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 255 of file qmuparsertest.h.
Referenced by EqnTest(), and ThrowTest().
|
inlinestaticprivate |
Definition at line 261 of file qmuparsertest.h.
Referenced by EqnTest(), and ThrowTest().
|
inlinestaticprivate |
Definition at line 267 of file qmuparsertest.h.
Referenced by EqnTest(), and ThrowTest().
|
inlinestaticprivate |
Definition at line 273 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 220 of file qmuparsertest.h.
Referenced by EqnTest().
|
private |
Definition at line 222 of file qmuparsertest.cpp.
References EqnTest().
Referenced by QmuParserTester().
|
private |
Definition at line 184 of file qmuparsertest.cpp.
References EQN_TEST_BULK.
Referenced by QmuParserTester().
|
private |
Definition at line 1011 of file qmuparsertest.cpp.
References qmu::ecDIV_BY_ZERO, qmu::ecDOMAIN_ERROR, qmu::ecMISSING_PARENS, qmu::ecOPRT_TYPE_CONFLICT, qmu::ecSTR_RESULT, qmu::ecSTRING_EXPECTED, qmu::ecTOO_FEW_PARAMS, qmu::ecTOO_MANY_PARAMS, qmu::ecUNASSIGNABLE_TOKEN, qmu::ecUNEXPECTED_EOF, qmu::ecUNEXPECTED_FUN, qmu::ecUNEXPECTED_OPERATOR, qmu::ecUNEXPECTED_PARENS, qmu::ecUNEXPECTED_VAL, qmu::ecUNTERMINATED_STRING, qmu::ecVAL_EXPECTED, and ThrowTest().
Referenced by QmuParserTester().
|
private |
Definition at line 811 of file qmuparsertest.cpp.
References EqnTest().
Referenced by QmuParserTester().
|
private |
Definition at line 901 of file qmuparsertest.cpp.
References qmu::ecMISPLACED_COLON, qmu::ecMISSING_ELSE_CLAUSE, qmu::ecUNASSIGNABLE_TOKEN, qmu::ecUNEXPECTED_CONDITIONAL, EqnTest(), and ThrowTest().
Referenced by QmuParserTester().
|
private |
Definition at line 687 of file qmuparsertest.cpp.
References EqnTest().
Referenced by QmuParserTester().
|
private |
Definition at line 109 of file qmuparsertest.cpp.
References qmu::QmuParserBase::DefineVar(), qmu::QmuParserBase::Eval(), qmu::QmuParserBase::RemoveVar(), and qmu::QmuParserBase::SetExpr().
Referenced by QmuParserTester().
|
private |
Definition at line 588 of file qmuparsertest.cpp.
References EqnTest().
Referenced by QmuParserTester().
|
private |
Check muParser name restriction enforcement.
Definition at line 290 of file qmuparsertest.cpp.
References qmu::QmuParserBase::ClearConst(), qmu::QmuParserBase::ClearPostfixOprt(), qmu::QmuParserBase::EnableBuiltInOprt(), f1of1(), f1of2(), and PARSER_THROWCHECK.
Referenced by QmuParserTester().
|
private |
Definition at line 756 of file qmuparsertest.cpp.
References qmu::ecUNASSIGNABLE_TOKEN, qmu::ecUNEXPECTED_EOF, qmu::ecUNEXPECTED_PARENS, EqnTest(), and ThrowTest().
Referenced by QmuParserTester().
|
private |
Definition at line 155 of file qmuparsertest.cpp.
References EqnTest().
Referenced by QmuParserTester().
|
private |
Definition at line 402 of file qmuparsertest.cpp.
References qmu::ecUNEXPECTED_EOF, EqnTest(), and ThrowTest().
Referenced by QmuParserTester().
|
private |
Definition at line 455 of file qmuparsertest.cpp.
References qmu::QmuParserBase::DefineVar(), EqnTest(), EqnTestWithVarChange(), qmu::QmuParserBase::GetUsedVar(), qmu::QmuParserBase::GetVar(), and qmu::QmuParserBase::SetExpr().
Referenced by QmuParserTester().
|
staticprivate |
Definition at line 1169 of file qmuparsertest.cpp.
References c_iCount, qmu::QmuParserBase::DefineFun(), qmu::QmuParserBase::DefinePostfixOprt(), qmu::QmuParserBase::DefineVar(), qmu::QmuParserBase::Eval(), qmu::QmuParserError::GetCode(), qmu::QmuParserError::GetMsg(), Milli(), Ping(), qmu::QmuParserBase::SetExpr(), StrFun1(), StrFun2(), StrFun3(), and ValueOf().
Referenced by TestException(), TestIfThenElse(), TestPostFix(), and TestSyntax().
|
inlinestaticprivate |
Definition at line 175 of file qmuparsertest.h.
Referenced by EqnTest().
|
inlinestaticprivate |
Definition at line 250 of file qmuparsertest.h.
Referenced by EqnTest(), and ThrowTest().
|
staticprivate |
Definition at line 71 of file qmuparsertest.h.
Referenced by EqnTest(), EqnTestBulk(), EqnTestWithVarChange(), QmuParserTester(), Run(), and ThrowTest().
|
private |
Definition at line 70 of file qmuparsertest.h.