Menu

[r251]: / trunk / cppunit / examples / cppunittest / MockTestCase.h  Maximize  Restore  History

Download this file

76 lines (55 with data), 1.8 kB

 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
67
68
69
70
71
72
73
74
75
#ifndef MOCKTESTCASE_H
#define MOCKTESTCASE_H
#include <cppunit/TestCase.h>
/*! \class MockTestCase
* \brief This class represents a mock test case.
*/
class MockTestCase : public CppUnit::TestCase
{
public:
typedef CppUnit::TestCase SuperClass; // work around VC++ call to super class method.
/*! Constructs a MockTestCase object.
*/
MockTestCase( std::string name );
/// Destructor.
virtual ~MockTestCase();
void setExpectedSetUpCall( int callCount = 1 );
void setExpectedTearDownCall( int callCount = 1 );
void setExpectedRunTestCall( int callCount = 1 );
void setExpectedCountTestCasesCall( int callCount = 1 );
void makeSetUpThrow();
void makeTearDownThrow();
void makeRunTestThrow();
void makeFindTestPathPassFor( const CppUnit::Test *testFound );
void verify();
protected:
int countTestCases() const;
void setUp();
void tearDown();
void runTest();
// bool findTestPath( const CppUnit::Test *test,
// CppUnit::TestPath &testPath );
private:
/// Prevents the use of the copy constructor.
MockTestCase( const MockTestCase &copy );
/// Prevents the use of the copy operator.
void operator =( const MockTestCase &copy );
private:
bool m_hasSetUpExpectation;
int m_expectedSetUpCall;
int m_actualSetUpCall;
bool m_hasTearDownExpectation;
int m_expectedTearDownCall;
int m_actualTearDownCall;
bool m_expectRunTestCall;
int m_expectedRunTestCallCount;
int m_actualRunTestCallCount;
bool m_expectCountTestCasesCall;
int m_expectedCountTestCasesCallCount;
mutable int m_actualCountTestCasesCallCount;
bool m_setUpThrow;
bool m_tearDownThrow;
bool m_runTestThrow;
const CppUnit::Test *m_passingTest;
};
#endif // MOCKTESTCASE_H
MongoDB Logo MongoDB