1 #ifndef MESSAGETEST_H 2 #define MESSAGETEST_H 3 4 #include <cppunit/extensions/HelperMacros.h> 5 #include <cppunit/Message.h> 6 #include <stdexcept> 7 8 9 /// Unit tests for MessageTest 10 class MessageTest : public CPPUNIT_NS::TestFixture 11 { 12 CPPUNIT_TEST_SUITE( MessageTest ); 13 CPPUNIT_TEST( testDefaultConstructor ); 14 CPPUNIT_TEST_EXCEPTION( testDetailAtThrowIfBadIndex, std::invalid_argument ); 15 CPPUNIT_TEST_EXCEPTION( testDetailAtThrowIfBadIndex2, std::invalid_argument ); 16 CPPUNIT_TEST( testAddDetail ); 17 CPPUNIT_TEST( testAddDetail2 ); 18 CPPUNIT_TEST( testAddDetail3 ); 19 CPPUNIT_TEST( testAddDetailEmptyMessage ); 20 CPPUNIT_TEST( testAddDetailMessage ); 21 CPPUNIT_TEST( testSetShortDescription ); 22 CPPUNIT_TEST( testClearDetails ); 23 CPPUNIT_TEST( testConstructor ); 24 CPPUNIT_TEST( testConstructorDetail1 ); 25 CPPUNIT_TEST( testConstructorDetail2 ); 26 CPPUNIT_TEST( testConstructorDetail3 ); 27 CPPUNIT_TEST( testDetailsNone ); 28 CPPUNIT_TEST( testDetailsSome ); 29 CPPUNIT_TEST( testEqual ); 30 CPPUNIT_TEST( testNotEqual ); 31 CPPUNIT_TEST_SUITE_END(); 32 33 public: 34 MessageTest(); 35 36 virtual ~MessageTest(); 37 38 void setUp(); 39 void tearDown(); 40 41 void testDefaultConstructor(); 42 void testDetailAtThrowIfBadIndex(); 43 void testDetailAtThrowIfBadIndex2(); 44 void testAddDetail(); 45 void testAddDetail2(); 46 void testAddDetail3(); 47 void testAddDetailEmptyMessage(); 48 void testAddDetailMessage(); 49 void testSetShortDescription(); 50 void testClearDetails(); 51 52 void testConstructor(); 53 void testConstructorDetail1(); 54 void testConstructorDetail2(); 55 void testConstructorDetail3(); 56 57 void testDetailsNone(); 58 void testDetailsSome(); 59 60 void testEqual(); 61 void testNotEqual(); 62 63 private: 64 /// Prevents the use of the copy constructor. 65 MessageTest( const MessageTest &other ); 66 67 /// Prevents the use of the copy operator. 68 void operator =( const MessageTest &other ); 69 70 private: 71 CPPUNIT_NS::Message *m_message; 72 }; 73 74 75 76 #endif // MESSAGETEST_H 77