File: TestSetUpTest.h

package info (click to toggle)
cppunit 1.13.2-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,980 kB
  • ctags: 3,579
  • sloc: cpp: 18,338; sh: 14,983; ansic: 3,011; makefile: 423; xml: 58; csh: 6
file content (63 lines) | stat: -rw-r--r-- 1,073 bytes parent folder | download | duplicates (11)
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
#ifndef TESTSETUPTEST_H
#define TESTSETUPTEST_H

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


class TestSetUpTest : public CPPUNIT_NS::TestFixture
{
  CPPUNIT_TEST_SUITE( TestSetUpTest );
  CPPUNIT_TEST( testRun );
  CPPUNIT_TEST_SUITE_END();

public:
  TestSetUpTest();
  virtual ~TestSetUpTest();

  void setUp();
  void tearDown();

  void testRun();

private:
  class MockSetUp : public CPPUNIT_NS::TestSetUp
  {
  public:
    MockSetUp( CPPUNIT_NS::Test *test )
        : CPPUNIT_NS::TestSetUp( test )
        , m_setUpCalled( false )
        , m_tearDownCalled( false )
    {
    }

    void setUp() 
    {
      m_setUpCalled = true;
    }

    void tearDown()
    {
      m_tearDownCalled = true;
    }

    void verify()
    {
      CPPUNIT_ASSERT( m_setUpCalled );
      CPPUNIT_ASSERT( m_tearDownCalled );
    }

  private:
    bool m_setUpCalled;
    bool m_tearDownCalled;
  };

  TestSetUpTest( const TestSetUpTest &copy );
  void operator =( const TestSetUpTest &copy );

private:
};



#endif  // TESTSETUPTEST_H