iaTest.h File Reference
#include <iaux/system/iaConsole.h>
#include <string>
#include <map>
#include <vector>
#include <iostream>

Classes

class  iaux::iaTest
 

Namespaces

namespace  iaux
 

Macros

#define IAUX_TEST(testGroup, testName)
 
#define IAUX_EXPECT_EQUAL(a, b)
 
#define IAUX_EXPECT_NOT_EQUAL(a, b)
 
#define IAUX_EXPECT_TRUE(value)
 
#define IAUX_EXPECT_FALSE(value)
 
#define IAUX_EXPECT_NEAR(a, b, epsilon)
 
#define IAUX_EXPECT_GREATER_THEN(a, b)
 
#define IAUX_EXPECT_LESS_THEN(a, b)
 
#define IAUX_EXPECT_NEAR_MATRIX(m1, m2, epsilon)
 

Macro Definition Documentation

◆ IAUX_EXPECT_EQUAL

#define IAUX_EXPECT_EQUAL (   a,
 
)
Value:
if ((a) != (b)) \
{ \
iaConsole::getInstance() << __IGOR_FILE_LINE__ << " - "; \
iaConsole::getInstance() << (a) << " is not equal to " << (b) << endl; \
_ok = false; \
}
#define __IGOR_FILE_LINE__
Definition: iaDefines.h:67
IGOR_INLINE iaConsole & endl(iaConsole &console)
Definition: iaConsole.h:486

◆ IAUX_EXPECT_FALSE

#define IAUX_EXPECT_FALSE (   value)
Value:
if (value) \
{ \
iaConsole::getInstance() << __IGOR_FILE_LINE__ << " - "; \
iaConsole::getInstance() << "value should be FALSE but is TRUE" << endl; \
_ok = false; \
}

◆ IAUX_EXPECT_GREATER_THEN

#define IAUX_EXPECT_GREATER_THEN (   a,
 
)
Value:
if ((a) <= (b)) \
{ \
iaConsole::getInstance() << __IGOR_FILE_LINE__ << " - "; \
iaConsole::getInstance() << a << " is not greater then " << b << endl; \
_ok = false; \
}

◆ IAUX_EXPECT_LESS_THEN

#define IAUX_EXPECT_LESS_THEN (   a,
 
)
Value:
if ((a) >= (b)) \
{ \
iaConsole::getInstance() << __IGOR_FILE_LINE__ << " - "; \
iaConsole::getInstance() << a << " is not less then " << b << endl; \
_ok = false; \
}

◆ IAUX_EXPECT_NEAR

#define IAUX_EXPECT_NEAR (   a,
  b,
  epsilon 
)
Value:
if (std::abs(((float64)a) - ((float64)b)) > epsilon) \
{ \
iaConsole::getInstance() << __IGOR_FILE_LINE__ << " - "; \
iaConsole::getInstance() << "diff of " << a << " and " << b << " is " << std::abs(((float64)a) - ((float64)b)) << " but should be smaller or equal to " << epsilon << endl; \
_ok = false; \
}
double float64
Definition: iaDefines.h:144

◆ IAUX_EXPECT_NEAR_MATRIX

#define IAUX_EXPECT_NEAR_MATRIX (   m1,
  m2,
  epsilon 
)
Value:
{ \
bool failed = false; \
for (int i = 0; i < 16; ++i) \
{ \
if (std::abs((m1[i]) - (m2[i])) > epsilon) \
{ \
failed = true; \
break; \
} \
} \
if (failed) \
{ \
iaConsole::getInstance() << __IGOR_FILE_LINE__ << " - "; \
iaConsole::getInstance() << "matrices are not equal" << endl; \
iaConsole::getInstance() << m1; \
iaConsole::getInstance() << "---------------------------------------------------------------------------" << endl; \
iaConsole::getInstance() << m2 << endl; \
_ok = false; \
} \
}

◆ IAUX_EXPECT_NOT_EQUAL

#define IAUX_EXPECT_NOT_EQUAL (   a,
 
)
Value:
if ((a) == (b)) \
{ \
iaConsole::getInstance() << __IGOR_FILE_LINE__ << " - "; \
iaConsole::getInstance() << (a) << " should be not equal to " << (b) << endl; \
_ok = false; \
}

◆ IAUX_EXPECT_TRUE

#define IAUX_EXPECT_TRUE (   value)
Value:
if (!(value)) \
{ \
iaConsole::getInstance() << __IGOR_FILE_LINE__ << " - "; \
iaConsole::getInstance() << "value should be TRUE but is FALSE" << endl; \
_ok = false; \
}

◆ IAUX_TEST

#define IAUX_TEST (   testGroup,
  testName 
)
Value:
class testGroup##_##testName : public iaTest \
{ \
public: \
testGroup##_##testName() { registerTest(this); }; \
const char *getGroupName() override \
{ \
return #testGroup; \
} \
const char *getName() override \
{ \
return #testName; \
} \
const char *getLocation() override \
{ \
} \
void run() override; \
}; \
testGroup##_##testName *testGroup##_##testName##_instance = new testGroup##_##testName(); \
void testGroup##_##testName::run()