summaryrefslogtreecommitdiff
path: root/examples/cppunittest/TrackedTestCase.h
blob: f665c50e66c067bcb3e8217fda8fb2e44810437e (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
#ifndef TRACKEDTESTCASE_H
#define TRACKEDTESTCASE_H

#include <cppunit/TestCase.h>


class Tracker
{
public:
  virtual ~Tracker() {}

  virtual void onConstructor() {}
  virtual void onDestructor() {}
  virtual void onSetUp() {}
  virtual void onTearDown() {}
  virtual void onTest() {};
};


class TrackedTestCase : public CPPUNIT_NS::TestCase
{
public:
  TrackedTestCase();

  virtual ~TrackedTestCase();

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

  void test();

  static void setTracker( Tracker *tracker );
  static void removeTracker();

private:
  TrackedTestCase( const TrackedTestCase &copy );

  void operator =( const TrackedTestCase &copy );

private:
  static Tracker *ms_tracker;
};


#endif  // TRACKEDTESTCASE_H