17 #ifndef AGXUNIT_AGXUNIT_H
18 #define AGXUNIT_AGXUNIT_H
20 #include <agx/config/AGX_USE_UNIT_TESTS.h>
21 #if AGX_USE_UNIT_TESTS()
49 static UnitTestManager *instance();
54 void parseArgs(
int& argc,
char **argv );
57 bool reportError(
const AssertMessage &message,
const SourceCodeInfo& info );
59 void setEnable(
bool flag ) { m_enable = flag; }
60 bool getEnable( )
const {
return m_enable; }
62 bool getIsDeterminismTest()
const {
return m_determinismTest; }
64 void setDoOnlyFastTests(
bool flag ) { m_doOnlyFastTests = flag; }
65 bool getDoOnlyFastTests( )
const {
return m_doOnlyFastTests; }
67 void setPassOnExceptions(
bool flag ) { m_passOnExceptions = flag; }
68 bool getPassOnExceptions( )
const {
return m_passOnExceptions; }
79 bool m_doOnlyFastTests;
80 bool m_passOnExceptions;
81 bool m_determinismTest;
85 struct agxAssertion_utils
89 static bool equal(
const T& a,
const T&b)
96 std::ostringstream ost;
112 struct agxAssertion_utils<double>
114 static bool equal(
double a,
double b)
121 std::ostringstream str;
124 const int precision = DBL_DIG;
126 const int precision = 15;
128 str.precision( precision );
134 template <
typename T>
135 void agxAssertEquals(
const T& expected,
140 if ( !agxAssertion_utils<T>::equal(expected, actual ))
142 Assert::failNotEqual( agxAssertion_utils<T>::toString(expected),
143 agxAssertion_utils<T>::toString(actual),
157 SourceCodeInfo sourceLine,
169 SourceCodeInfo sourceLine,
183 SourceCodeInfo sourceInfo,
196 SourceCodeInfo sourceInfo,
201 #endif // AGX_USE_UNIT_TESTS()
203 #endif // AGXUNIT_AGXUNIT_H