steghide  0.5.1
UnitTest.h
Go to the documentation of this file.
1 /*
2  * steghide 0.5.1 - a steganography program
3  * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at>
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  *
19  */
20 
21 #ifndef SH_UNITTEST_H
22 #define SH_UNITTEST_H
23 
24 #include <string>
25 #include <vector>
26 
27 #include "common.h"
28 
29 #include "Test.h"
30 #include "TestCategoryCaller.h"
31 // declared here to avoid circulating includes
32 class TestCategory ;
33 class TestSuite ;
34 
35 #define ADDTESTCATEGORY(UTCLASS,CMETHOD) \
36  addTestCategory (new TestCategoryCaller<UTCLASS> (strip_test(#CMETHOD), getSuite(), this, &UTCLASS::CMETHOD))
37 
38 class UnitTest : public Test {
39  public:
43  UnitTest (std::string n, TestSuite* s) : Test(n,s), GlobsBackup(NULL) {} ;
44 
45  ~UnitTest (void) ;
46 
54  virtual void setup (void) ;
55 
56  void run (void) ;
57 
61  virtual void cleanup (void) ;
62 
63  protected:
64  void addTestCategory (TestCategory *tc) ;
65 
66  void addTestResult (bool r) ;
67 
68  char *strip_test (char* s)
69  { return (s + 4) ; } ;
70 
71  private:
72  std::vector<TestCategory*> TestCategories ;
73 
76 } ;
77 
78 #endif // ndef SH_UNITTEST_H