76#define _test(cond) do_test(cond, #cond, __FILE__, __LINE__)
78#define _numtest(num, orig) do_numtest(num, orig, #num, #orig, __FILE__, __LINE__)
80#define _numtesttol(num, orig, tol) do_numtest(num, orig, #num, #orig, __FILE__, __LINE__, tol)
82#define _fail(str) do_fail(str, __FILE__, __LINE__)
119 virtual void reset() { m_nPass = m_nFail = 0; }
123 const char* fname,
long lineno);
126 const string& lbl2,
const char* fname,
long lineno,
127 const double tol = 1e-10);
128 bool do_numtest(std::complex<double> num, std::complex<double> orig,
129 const string& lbl,
const string& lbl2,
const char* fname,
130 long lineno,
const double tol = 1e-10);
135 const char* fname,
long lineno);
148 m_osptr(osptr), m_nPass(0), m_nFail(0) {
150 m_osptr = &std::cout;
const ostream * getStream() const
Returns output stream.
TestCase(ostream *osptr=0)
void setStream(ostream *osptr)
Sets the output stream.
virtual void run()=0
Runs the tests. Must be overwritten by the specialization.
bool do_numtest(double num, double orig, const string &lbl, const string &lbl2, const char *fname, long lineno, const double tol=1e-10)
Internal function to do a numerical test.
long getNumFailed() const
Returns number of failed tests.
void do_fail(const string &lbl, const char *fname, long lineno)
virtual void reset()
Resets the counters for the failed and passed tests.
long getNumPassed() const
Returns number of passed tests.
void _succeed()
Explicitly succeds a test.
bool do_test(bool cond, const string &lbl, const char *fname, long lineno)
Internal function to do a test.