4
#include <cppunit/extensions/HelperMacros.h>
5
#include "MockTestListener.h"
8
class OrthodoxTest : public CPPUNIT_NS::TestFixture
10
CPPUNIT_TEST_SUITE( OrthodoxTest );
11
CPPUNIT_TEST( testValue );
12
CPPUNIT_TEST( testValueBadConstructor );
13
CPPUNIT_TEST( testValueBadInvert );
14
CPPUNIT_TEST( testValueBadEqual );
15
CPPUNIT_TEST( testValueBadNotEqual );
16
CPPUNIT_TEST( testValueBadCall );
17
CPPUNIT_TEST( testValueBadAssignment );
18
CPPUNIT_TEST_SUITE_END();
22
virtual ~OrthodoxTest();
25
virtual void tearDown();
28
void testValueBadConstructor();
29
void testValueBadInvert();
30
void testValueBadEqual();
31
void testValueBadNotEqual();
32
void testValueBadCall();
33
void testValueBadAssignment();
39
Value( int value =0 ) : m_value( value ) {}
41
Value& operator= ( const Value& v )
47
bool operator ==( const Value &other ) const
49
return m_value == other.m_value;
52
bool operator !=( const Value &other )
54
return !( *this == other );
59
return Value( -1 - m_value );
67
class ValueBadConstructor : public Value
72
static int serialNumber = 0;
73
m_value = ++serialNumber;
76
ValueBadConstructor( int value ) : Value( value ) {}
78
ValueBadConstructor operator !()
80
return ValueBadConstructor( -1 - m_value );
85
class ValueBadInvert : public Value
88
ValueBadInvert( int value =0 ) : Value( value ) {}
90
ValueBadInvert operator !()
92
return ValueBadInvert( 1 );
97
class ValueBadEqual : public Value
100
ValueBadEqual( int value =0 ) : Value( value ) {}
102
ValueBadEqual operator !()
104
return ValueBadEqual( -1 - m_value );
107
bool operator ==( const ValueBadEqual &other ) const
109
return m_value != other.m_value;
114
class ValueBadNotEqual : public Value
117
ValueBadNotEqual( int value =0 ) : Value( value ) {}
119
ValueBadNotEqual operator !()
121
return ValueBadNotEqual( -1 - m_value );
124
bool operator !=( const ValueBadNotEqual &other )
126
return m_value == other.m_value;
131
class ValueBadCall : public Value
134
ValueBadCall( int value =0 ) : Value( value ) {}
136
ValueBadCall( const ValueBadCall &other )
138
static int serialNumber = 0;
139
m_value = ++serialNumber;
142
ValueBadCall operator !()
144
return ValueBadCall( -1 - m_value );
149
class ValueBadAssignment: public Value
152
ValueBadAssignment( int value =0 ) : Value( value ) {}
154
ValueBadAssignment operator !()
156
return ValueBadAssignment( -1 - m_value );
159
ValueBadAssignment &operator =( const ValueBadAssignment &other )
168
OrthodoxTest( const OrthodoxTest © );
169
void operator =( const OrthodoxTest © );
172
CPPUNIT_NS::TestResult *m_result;
173
MockTestListener *m_testListener;
178
#endif // ORTHODOXTEST_H