1 #ifndef TESTCALLERTEST_H
2 #define TESTCALLERTEST_H
3 
4 #include <cppunit/extensions/HelperMacros.h>
5 #include <cppunit/TestCase.h>
6 #include <cppunit/TestResult.h>
7 #include <cppunit/TestSuite.h>
8 #include "MockTestListener.h"
9 #include "TrackedTestCase.h"
10 
11 class TestCallerTest : public CPPUNIT_NS::TestFixture,
12                               Tracker
13 {
14   CPPUNIT_TEST_SUITE( TestCallerTest );
15   CPPUNIT_TEST( testBasicConstructor );
16   CPPUNIT_TEST( testReferenceConstructor );
17   CPPUNIT_TEST( testPointerConstructor );
18 //  CPPUNIT_TEST( testExpectFailureException );
19 //  CPPUNIT_TEST( testExpectException );
20 //  CPPUNIT_TEST( testExpectedExceptionNotCaught );
21   CPPUNIT_TEST_SUITE_END();
22 public:
23   TestCallerTest();
24   virtual ~TestCallerTest();
25 
26   void setUp();
27   void tearDown();
28 
29   void testBasicConstructor();
30   void testReferenceConstructor();
31   void testPointerConstructor();
32 
33 //  void testExpectFailureException();
34 //  void testExpectException();
35 //  void testExpectedExceptionNotCaught();
36 
37 private:
38   class ExceptionThrower : public CPPUNIT_NS::TestCase
39   {
40   public:
41     void testThrowFailureException();
42     void testThrowException();
43     void testThrowNothing();
44   };
45 
46   virtual void onConstructor();
47   virtual void onDestructor();
48   virtual void onSetUp();
49   virtual void onTearDown();
50   virtual void onTest();
51 
52   void checkNothingButConstructorCalled();
53   void checkRunningSequenceCalled();
54   void checkTestName( std::string testName );
55 
56   TestCallerTest( const TestCallerTest &copy );
57   void operator =( const TestCallerTest &copy );
58 
59 private:
60   int m_constructorCount;
61   int m_destructorCount;
62   int m_setUpCount;
63   int m_tearDownCount;
64   int m_testCount;
65   const std::string m_testName;
66   MockTestListener *m_testListener;
67   CPPUNIT_NS::TestResult *m_result;
68 };
69 
70 
71 
72 // Inlines methods for TestCallerTest:
73 // -----------------------------------
74 
75 
76 
77 #endif  // TESTCALLERTEST_H
78