Seamly2D
Code documentation
qmu::Test::QmuParserTester Class Reference

Test cases for unit testing. More...

#include <qmuparsertest.h>

Inheritance diagram for qmu::Test::QmuParserTester:
Collaboration diagram for qmu::Test::QmuParserTester:

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_typem_vTestFun
 

Static Private Attributes

static int c_iCount = 0
 

Detailed Description

Test cases for unit testing.

(C) 2004-2011 Ingo Berg

Definition at line 57 of file qmuparsertest.h.

Member Typedef Documentation

◆ testfun_type

typedef int( QmuParserTester::* qmu::Test::QmuParserTester::testfun_type) ()

Definition at line 61 of file qmuparsertest.h.

Constructor & Destructor Documentation

◆ QmuParserTester()

qmu::Test::QmuParserTester::QmuParserTester ( QObject *  parent = nullptr)
explicit

Member Function Documentation

◆ Abort()

void qmu::Test::QmuParserTester::Abort ( )
staticprivate

Internal error in test class Test is going to be aborted.

Definition at line 1528 of file qmuparsertest.cpp.

Referenced by Run().

◆ add()

static qreal qmu::Test::QmuParserTester::add ( qreal  v1,
qreal  v2 
)
inlinestaticprivate

Definition at line 190 of file qmuparsertest.h.

Referenced by EqnTest().

◆ AddTest()

void qmu::Test::QmuParserTester::AddTest ( testfun_type  a_pFun)
private

Definition at line 1110 of file qmuparsertest.cpp.

References m_vTestFun.

Referenced by QmuParserTester().

◆ EqnTest()

◆ EqnTestBulk()

int qmu::Test::QmuParserTester::EqnTestBulk ( const QString &  a_str,
double  a_fRes[4],
bool  a_fPass 
)
staticprivate

◆ EqnTestWithVarChange()

int qmu::Test::QmuParserTester::EqnTestWithVarChange ( const QString &  a_str,
double  a_fRes1,
double  a_fVar1,
double  a_fRes2,
double  a_fVar2 
)
staticprivate

Evaluate a tet expression.

Returns
1 in case of a failure, 0 otherwise.

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().

◆ f1of1()

static qreal qmu::Test::QmuParserTester::f1of1 ( qreal  v)
inlinestaticprivate

Definition at line 85 of file qmuparsertest.h.

Referenced by EqnTest(), and TestNames().

◆ f1of2()

static qreal qmu::Test::QmuParserTester::f1of2 ( qreal  v,
qreal   
)
inlinestaticprivate

Definition at line 90 of file qmuparsertest.h.

Referenced by EqnTest(), and TestNames().

◆ f1of3()

static qreal qmu::Test::QmuParserTester::f1of3 ( qreal  v,
qreal  ,
qreal   
)
inlinestaticprivate

Definition at line 100 of file qmuparsertest.h.

Referenced by EqnTest().

◆ f1of4()

static qreal qmu::Test::QmuParserTester::f1of4 ( qreal  v,
qreal  ,
qreal  ,
qreal   
)
inlinestaticprivate

Definition at line 115 of file qmuparsertest.h.

Referenced by EqnTest().

◆ f1of5()

static qreal qmu::Test::QmuParserTester::f1of5 ( qreal  v,
qreal  ,
qreal  ,
qreal  ,
qreal   
)
inlinestaticprivate

Definition at line 135 of file qmuparsertest.h.

Referenced by EqnTest().

◆ f2of2()

static qreal qmu::Test::QmuParserTester::f2of2 ( qreal  ,
qreal  v 
)
inlinestaticprivate

Definition at line 95 of file qmuparsertest.h.

Referenced by EqnTest().

◆ f2of3()

static qreal qmu::Test::QmuParserTester::f2of3 ( qreal  ,
qreal  v,
qreal   
)
inlinestaticprivate

Definition at line 105 of file qmuparsertest.h.

Referenced by EqnTest().

◆ f2of4()

static qreal qmu::Test::QmuParserTester::f2of4 ( qreal  ,
qreal  v,
qreal  ,
qreal   
)
inlinestaticprivate

Definition at line 120 of file qmuparsertest.h.

Referenced by EqnTest().

◆ f2of5()

static qreal qmu::Test::QmuParserTester::f2of5 ( qreal  ,
qreal  v,
qreal  ,
qreal  ,
qreal   
)
inlinestaticprivate

Definition at line 140 of file qmuparsertest.h.

Referenced by EqnTest().

◆ f3of3()

static qreal qmu::Test::QmuParserTester::f3of3 ( qreal  ,
qreal  ,
qreal  v 
)
inlinestaticprivate

Definition at line 110 of file qmuparsertest.h.

Referenced by EqnTest().

◆ f3of4()

static qreal qmu::Test::QmuParserTester::f3of4 ( qreal  ,
qreal  ,
qreal  v,
qreal   
)
inlinestaticprivate

Definition at line 125 of file qmuparsertest.h.

Referenced by EqnTest().

◆ f3of5()

static qreal qmu::Test::QmuParserTester::f3of5 ( qreal  ,
qreal  ,
qreal  v,
qreal  ,
qreal   
)
inlinestaticprivate

Definition at line 145 of file qmuparsertest.h.

Referenced by EqnTest().

◆ f4of4()

static qreal qmu::Test::QmuParserTester::f4of4 ( qreal  ,
qreal  ,
qreal  ,
qreal  v 
)
inlinestaticprivate

Definition at line 130 of file qmuparsertest.h.

Referenced by EqnTest().

◆ f4of5()

static qreal qmu::Test::QmuParserTester::f4of5 ( qreal  ,
qreal  ,
qreal  ,
qreal  v,
qreal   
)
inlinestaticprivate

Definition at line 150 of file qmuparsertest.h.

Referenced by EqnTest().

◆ f5of5()

static qreal qmu::Test::QmuParserTester::f5of5 ( qreal  ,
qreal  ,
qreal  ,
qreal  ,
qreal  v 
)
inlinestaticprivate

Definition at line 155 of file qmuparsertest.h.

Referenced by EqnTest().

◆ FirstArg()

static qreal qmu::Test::QmuParserTester::FirstArg ( const qreal *  a_afArg,
int  a_iArgc 
)
inlinestaticprivate

Definition at line 200 of file qmuparsertest.h.

Referenced by EqnTest().

◆ IsHexVal()

int qmu::Test::QmuParserTester::IsHexVal ( const QString &  a_szExpr,
int *  a_iPos,
qreal *  a_fVal,
const QLocale &  locale,
const QChar &  decimal,
const QChar &  thousand 
)
staticprivate

Definition at line 77 of file qmuparsertest.cpp.

Referenced by EqnTest().

◆ land()

static qreal qmu::Test::QmuParserTester::land ( qreal  v1,
qreal  v2 
)
inlinestaticprivate

Definition at line 195 of file qmuparsertest.h.

Referenced by EqnTest().

◆ LastArg()

static qreal qmu::Test::QmuParserTester::LastArg ( const qreal *  a_afArg,
int  a_iArgc 
)
inlinestaticprivate

Definition at line 210 of file qmuparsertest.h.

Referenced by EqnTest().

◆ Max()

static qreal qmu::Test::QmuParserTester::Max ( qreal  a_fVal1,
qreal  a_fVal2 
)
inlinestaticprivate

Definition at line 165 of file qmuparsertest.h.

Referenced by EqnTest().

◆ Mega()

static qreal qmu::Test::QmuParserTester::Mega ( qreal  a_fVal)
inlinestaticprivate

Definition at line 280 of file qmuparsertest.h.

Referenced by EqnTest().

◆ Micro()

static qreal qmu::Test::QmuParserTester::Micro ( qreal  a_fVal)
inlinestaticprivate

Definition at line 285 of file qmuparsertest.h.

◆ Milli()

static qreal qmu::Test::QmuParserTester::Milli ( qreal  a_fVal)
inlinestaticprivate

Definition at line 290 of file qmuparsertest.h.

Referenced by EqnTest(), and ThrowTest().

◆ Min()

static qreal qmu::Test::QmuParserTester::Min ( qreal  a_fVal1,
qreal  a_fVal2 
)
inlinestaticprivate

Definition at line 160 of file qmuparsertest.h.

Referenced by EqnTest().

◆ Ping()

static qreal qmu::Test::QmuParserTester::Ping ( )
inlinestaticprivate

Definition at line 245 of file qmuparsertest.h.

Referenced by EqnTest(), and ThrowTest().

◆ plus2()

static qreal qmu::Test::QmuParserTester::plus2 ( qreal  v1)
inlinestaticprivate

Definition at line 170 of file qmuparsertest.h.

Referenced by EqnTest().

◆ Rnd()

static qreal qmu::Test::QmuParserTester::Rnd ( qreal  v)
inlinestaticprivate

Definition at line 235 of file qmuparsertest.h.

◆ RndWithString()

static qreal qmu::Test::QmuParserTester::RndWithString ( const char_type )
inlinestaticprivate

Definition at line 240 of file qmuparsertest.h.

◆ Run

void qmu::Test::QmuParserTester::Run ( )
privateslot

◆ sign()

static qreal qmu::Test::QmuParserTester::sign ( qreal  v)
inlinestaticprivate

Definition at line 185 of file qmuparsertest.h.

Referenced by EqnTest().

◆ sqr()

static qreal qmu::Test::QmuParserTester::sqr ( qreal  v1)
inlinestaticprivate

Definition at line 180 of file qmuparsertest.h.

Referenced by EqnTest().

◆ StrFun1()

static qreal qmu::Test::QmuParserTester::StrFun1 ( const QString &  v1)
inlinestaticprivate

Definition at line 255 of file qmuparsertest.h.

Referenced by EqnTest(), and ThrowTest().

◆ StrFun2()

static qreal qmu::Test::QmuParserTester::StrFun2 ( const QString &  v1,
qreal  v2 
)
inlinestaticprivate

Definition at line 261 of file qmuparsertest.h.

Referenced by EqnTest(), and ThrowTest().

◆ StrFun3()

static qreal qmu::Test::QmuParserTester::StrFun3 ( const QString &  v1,
qreal  v2,
qreal  v3 
)
inlinestaticprivate

Definition at line 267 of file qmuparsertest.h.

Referenced by EqnTest(), and ThrowTest().

◆ StrToFloat()

static qreal qmu::Test::QmuParserTester::StrToFloat ( const QString &  a_szMsg)
inlinestaticprivate

Definition at line 273 of file qmuparsertest.h.

Referenced by EqnTest().

◆ Sum()

static qreal qmu::Test::QmuParserTester::Sum ( const qreal *  a_afArg,
int  a_iArgc 
)
inlinestaticprivate

Definition at line 220 of file qmuparsertest.h.

Referenced by EqnTest().

◆ TestBinOprt()

int qmu::Test::QmuParserTester::TestBinOprt ( )
private

Definition at line 222 of file qmuparsertest.cpp.

References EqnTest().

Referenced by QmuParserTester().

◆ TestBulkMode()

int qmu::Test::QmuParserTester::TestBulkMode ( )
private

Definition at line 184 of file qmuparsertest.cpp.

References EQN_TEST_BULK.

Referenced by QmuParserTester().

◆ TestException()

◆ TestExpression()

int qmu::Test::QmuParserTester::TestExpression ( )
private

Definition at line 811 of file qmuparsertest.cpp.

References EqnTest().

Referenced by QmuParserTester().

◆ TestIfThenElse()

int qmu::Test::QmuParserTester::TestIfThenElse ( )
private

◆ TestInfixOprt()

int qmu::Test::QmuParserTester::TestInfixOprt ( )
private

Definition at line 687 of file qmuparsertest.cpp.

References EqnTest().

Referenced by QmuParserTester().

◆ TestInterface()

int qmu::Test::QmuParserTester::TestInterface ( )
private

◆ TestMultiArg()

int qmu::Test::QmuParserTester::TestMultiArg ( )
private

Definition at line 588 of file qmuparsertest.cpp.

References EqnTest().

Referenced by QmuParserTester().

◆ TestNames()

int qmu::Test::QmuParserTester::TestNames ( )
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().

◆ TestPostFix()

int qmu::Test::QmuParserTester::TestPostFix ( )
private

◆ TestStrArg()

int qmu::Test::QmuParserTester::TestStrArg ( )
private

Definition at line 155 of file qmuparsertest.cpp.

References EqnTest().

Referenced by QmuParserTester().

◆ TestSyntax()

int qmu::Test::QmuParserTester::TestSyntax ( )
private

Definition at line 402 of file qmuparsertest.cpp.

References qmu::ecUNEXPECTED_EOF, EqnTest(), and ThrowTest().

Referenced by QmuParserTester().

◆ TestVarConst()

int qmu::Test::QmuParserTester::TestVarConst ( )
private

◆ ThrowTest()

◆ times3()

static qreal qmu::Test::QmuParserTester::times3 ( qreal  v1)
inlinestaticprivate

Definition at line 175 of file qmuparsertest.h.

Referenced by EqnTest().

◆ ValueOf()

static qreal qmu::Test::QmuParserTester::ValueOf ( const QString &  )
inlinestaticprivate

Definition at line 250 of file qmuparsertest.h.

Referenced by EqnTest(), and ThrowTest().

Member Data Documentation

◆ c_iCount

int qmu::Test::QmuParserTester::c_iCount = 0
staticprivate

◆ m_vTestFun

QVector<testfun_type> qmu::Test::QmuParserTester::m_vTestFun
private

Definition at line 70 of file qmuparsertest.h.

Referenced by AddTest(), and Run().


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