oasys::UnitTester Class Reference

#include <UnitTest.h>

List of all members.


Detailed Description

UnitTester runs all unit test and produces a nice format which hooks into the parsing script.

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_

Member Typedef Documentation

typedef std::vector<UnitTest*> oasys::UnitTester::UnitTestList [private]

Definition at line 105 of file UnitTest.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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]

Definition at line 233 of file UnitTest.h.

References name_.

Referenced by run_tests().

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]

Definition at line 240 of file UnitTest.h.

References name_.

Referenced by run_tests().

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]

Override this to add your tests.

Referenced by run_tests().

void oasys::UnitTester::add ( UnitTest unit  )  [inline, protected]

Add a unit test to the suite.

Definition at line 263 of file UnitTest.h.

References tests_.


Member Data Documentation

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]

Definition at line 273 of file UnitTest.h.

Referenced by print_tcl_tail(), and run_tests().

const char* oasys::UnitTester::progname_ [private]

Definition at line 274 of file UnitTest.h.

Referenced by init().

bool oasys::UnitTester::in_tcl_ [private]

Definition at line 275 of file UnitTest.h.

Referenced by init(), and run_tests().


The documentation for this class was generated from the following file:
Generated on Sat Sep 8 08:36:26 2007 for DTN Reference Implementation by  doxygen 1.5.3