00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
#ifndef SH_UNITTEST_H
00022
#define SH_UNITTEST_H
00023
00024
#include <string>
00025
#include <vector>
00026
00027
#include "common.h"
00028
00029
#include "Test.h"
00030
#include "TestCategoryCaller.h"
00031
00032
class TestCategory ;
00033
class TestSuite ;
00034
00035 #define ADDTESTCATEGORY(UTCLASS,CMETHOD) \
00036
addTestCategory (new TestCategoryCaller<UTCLASS> (strip_test(#CMETHOD), getSuite(), this, &UTCLASS::CMETHOD))
00037
00038 class UnitTest :
public Test {
00039
public:
00043 UnitTest (std::string n,
TestSuite* s) :
Test(n,s),
GlobsBackup(NULL) {} ;
00044
00045
~UnitTest (
void) ;
00046
00054
virtual void setup (
void) ;
00055
00056
void run (
void) ;
00057
00061
virtual void cleanup (
void) ;
00062
00063
protected:
00064
void addTestCategory (
TestCategory *tc) ;
00065
00066
void addTestResult (
bool r) ;
00067
00068 char *
strip_test (
char* s)
00069 {
return (s + 4) ; } ;
00070
00071
private:
00072 std::vector<TestCategory*>
TestCategories ;
00073
00075 Globals GlobsBackup ;
00076 } ;
00077
00078
#endif // ndef SH_UNITTEST_H