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 82 of file UnitTest.h.

Public Member Functions

 UnitTester (std::string name)
virtual ~UnitTester ()
int run_tests (int argc, const char *argv[])
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_


Member Typedef Documentation

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

Definition at line 83 of file UnitTest.h.


Constructor & Destructor Documentation

oasys::UnitTester::UnitTester ( std::string  name  )  [inline]

Definition at line 86 of file UnitTest.h.

virtual oasys::UnitTester::~UnitTester (  )  [inline, virtual]

Definition at line 91 of file UnitTest.h.


Member Function Documentation

int oasys::UnitTester::run_tests ( int  argc,
const char *  argv[] 
) [inline]

Definition at line 93 of file UnitTest.h.

References add_tests(), failed_, oasys::FatalSignals::init(), oasys::Log::init(), input_, oasys::LOG_NOTICE, name_, passed_, print_header(), print_results(), print_tcl_header(), print_tcl_tail(), oasys::str2level(), tests_, oasys::UNIT_TEST_FAILED, oasys::UNIT_TEST_INPUT, and oasys::UNIT_TEST_PASSED.

void oasys::UnitTester::print_tcl_header (  )  [inline]

Definition at line 209 of file UnitTest.h.

References name_.

Referenced by run_tests().

void oasys::UnitTester::print_tcl_tail (  )  [inline]

Definition at line 212 of file UnitTest.h.

References failed_, input_, passed_, and tests_.

Referenced by run_tests().

void oasys::UnitTester::print_header (  )  [inline]

Definition at line 216 of file UnitTest.h.

References name_.

Referenced by run_tests().

void oasys::UnitTester::print_results (  )  [inline]

Definition at line 220 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 239 of file UnitTest.h.

References tests_.


Member Data Documentation

std::string oasys::UnitTester::name_ [private]

Definition at line 244 of file UnitTest.h.

Referenced by print_header(), print_results(), print_tcl_header(), and run_tests().

UnitTestList oasys::UnitTester::tests_ [private]

Definition at line 245 of file UnitTest.h.

Referenced by add(), print_tcl_tail(), and run_tests().

int oasys::UnitTester::passed_ [private]

Definition at line 247 of file UnitTest.h.

Referenced by print_results(), print_tcl_tail(), and run_tests().

int oasys::UnitTester::failed_ [private]

Definition at line 248 of file UnitTest.h.

Referenced by print_results(), print_tcl_tail(), and run_tests().

int oasys::UnitTester::input_ [private]

Definition at line 249 of file UnitTest.h.

Referenced by print_tcl_tail(), and run_tests().


The documentation for this class was generated from the following file:
Generated on Fri Dec 22 14:48:08 2006 for DTN Reference Implementation by  doxygen 1.5.1