summaryrefslogtreecommitdiff
path: root/examples/cppunittest/TestCaseTest.h
blob: 16a6e37970bbb63924c91d652724b372e1c0b93c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// //////////////////////////////////////////////////////////////////////////
// Header file TestCaseTest.h for class TestCaseTest
// (c)Copyright 2000, Baptiste Lepilleur.
// Created: 2000/06/09
// //////////////////////////////////////////////////////////////////////////
#ifndef TESTCASETEST_H
#define TESTCASETEST_H

#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/TestResult.h>


class TestCaseTest : public CppUnit::TestCase
{
  CPPUNIT_TEST_SUITE( TestCaseTest );
  CPPUNIT_TEST( testSetUpFailure );
  CPPUNIT_TEST( testRunTestFailure );
  CPPUNIT_TEST( testTearDownFailure );
  CPPUNIT_TEST( testFailAll );
  CPPUNIT_TEST( testNoFailure );
  CPPUNIT_TEST( testDefaultRun );
  CPPUNIT_TEST( testCountTestCases );
  CPPUNIT_TEST( testDefaultConstructor );
  CPPUNIT_TEST( testConstructorWithName );
  CPPUNIT_TEST_SUITE_END();

public:
  TestCaseTest();

  virtual ~TestCaseTest();

  virtual void setUp();
  virtual void tearDown();

  void testSetUpFailure();
  void testRunTestFailure();
  void testTearDownFailure();
  void testFailAll();
  void testNoFailure();
  void testDefaultRun();
  void testTwoRun();

  void testCountTestCases();

  void testDefaultConstructor();
  void testConstructorWithName();


private:
  TestCaseTest( const TestCaseTest &copy );
  void operator =( const TestCaseTest &copy );

  void checkFailure( bool failSetUp, 
                     bool failRunTest,
                     bool failTearDown );

  void checkResult( int failures,
                    int errors,
                    int testsRun,
                    CppUnit::TestResult *result );
private:
  CppUnit::TestResult *m_result;
};


#endif  // TESTCASETEST_H