Unit tests to automatically test intended behaviour. More...
Classes | |
| class | test::TestCase |
| Base class for tests. More... | |
| class | test::TestSuite |
| Suite of tests. More... | |
Namespaces | |
| namespace | test |
Unit tests. | |
Unit tests to automatically test intended behaviour.
int main(int argc, char** argv) { try { test::TestSuite t("Constrained Matrix Eigenvalue Problems"); test::GolubExample t1; t.addTest(&t1); test::MaxwellTransmissionEVP t2; t.addTest(&t2); test::GolubExampleSum t3; t.addTest(&t3); t.run(); return t.report(); } catch (concepts::ExceptionBase& e) { std::cout << e << std::endl; } return 1; }
doc/test.hh.template, a template for a header file of a new test and in doc/test.cc.template, a template for an implementation file of the test are provided. Header file template: /** @file filename.cc Description of file
@author Joe Foo, 2004
*/
#ifndef testname_hh
#define testname_hh
#include "basics/testcase.hh"
namespace test {
// ************************************************************** Testname **
/** Description of class
@author Joe Foo, 2004
*/
class Testname : public TestCase {
public:
virtual ~Testname() {}
virtual void run();
/// @name Test routines
//@{
/// Description of testValue function
void testValue();
//@}
};
} // namespace test
#endif // testname_hh
/* Tests something
*/
#include "test.hh"
namespace test {
// ************************************************************** Testname **
void Testname::run() {
testValue();
}
void Testname::testValue() {
_test(true);
}
} // namespace test
int main(int, char**) {
try {
test::Testname t;
t.run();
return t.report();
}
catch (concepts::ExceptionBase& e) {
std::cout << e << std::endl;
}
return 1;
}