#include <UnitTest.h>
Output of the UnitTester is directed (for now) to stderr as a Tcl list:
{ "testname" { {1 firstTest P} {2 secondTest F} {3 thirdTest I} } {2 1 1 1} }
Definition at line 104 of file UnitTest.h.
Public Member Functions | |
UnitTester (std::string name) | |
virtual | ~UnitTester () |
void | init (int argc, const char *argv[], bool init_log) |
int | run_tests () |
void | print_tcl_header () |
void | print_tcl_tail () |
void | print_header () |
void | print_results () |
Protected Member Functions | |
virtual void | add_tests ()=0 |
Override this to add your tests. | |
void | add (UnitTest *unit) |
Add a unit test to the suite. | |
Private Types | |
typedef std::vector < UnitTest * > | UnitTestList |
Private Attributes | |
std::string | name_ |
UnitTestList | tests_ |
int | passed_ |
int | failed_ |
int | input_ |
const char * | progname_ |
bool | in_tcl_ |
typedef std::vector<UnitTest*> oasys::UnitTester::UnitTestList [private] |
Definition at line 105 of file UnitTest.h.
oasys::UnitTester::UnitTester | ( | std::string | name | ) | [inline] |
Definition at line 108 of file UnitTest.h.
virtual oasys::UnitTester::~UnitTester | ( | ) | [inline, virtual] |
Definition at line 113 of file UnitTest.h.
void oasys::UnitTester::init | ( | int | argc, | |
const char * | argv[], | |||
bool | init_log | |||
) | [inline] |
Definition at line 115 of file UnitTest.h.
References end, dtnsim::gettimeofday(), in_tcl_, oasys::FatalSignals::init(), oasys::Log::init(), oasys::LOG_NOTICE, name_, progname_, oasys::Random::seed(), oasys::str2level(), and tests_.
int oasys::UnitTester::run_tests | ( | ) | [inline] |
Definition at line 175 of file UnitTest.h.
References add_tests(), failed_, in_tcl_, input_, passed_, print_header(), print_results(), print_tcl_header(), print_tcl_tail(), tests_, oasys::UNIT_TEST_FAILED, oasys::UNIT_TEST_INPUT, and oasys::UNIT_TEST_PASSED.
void oasys::UnitTester::print_tcl_header | ( | ) | [inline] |
void oasys::UnitTester::print_tcl_tail | ( | ) | [inline] |
Definition at line 236 of file UnitTest.h.
References failed_, input_, passed_, and tests_.
Referenced by run_tests().
void oasys::UnitTester::print_header | ( | ) | [inline] |
void oasys::UnitTester::print_results | ( | ) | [inline] |
Definition at line 244 of file UnitTest.h.
References failed_, name_, and passed_.
Referenced by run_tests().
virtual void oasys::UnitTester::add_tests | ( | ) | [protected, pure virtual] |
void oasys::UnitTester::add | ( | UnitTest * | unit | ) | [inline, protected] |
std::string oasys::UnitTester::name_ [private] |
Definition at line 268 of file UnitTest.h.
Referenced by init(), print_header(), print_results(), and print_tcl_header().
UnitTestList oasys::UnitTester::tests_ [private] |
Definition at line 269 of file UnitTest.h.
Referenced by add(), init(), print_tcl_tail(), and run_tests().
int oasys::UnitTester::passed_ [private] |
Definition at line 271 of file UnitTest.h.
Referenced by print_results(), print_tcl_tail(), and run_tests().
int oasys::UnitTester::failed_ [private] |
Definition at line 272 of file UnitTest.h.
Referenced by print_results(), print_tcl_tail(), and run_tests().
int oasys::UnitTester::input_ [private] |
const char* oasys::UnitTester::progname_ [private] |
bool oasys::UnitTester::in_tcl_ [private] |