summaryrefslogtreecommitdiff
path: root/examples/cppunittest/MessageTest.h
blob: 4c757e8179743b56c69b8204582273e73d53493f (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
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
76
#ifndef MESSAGETEST_H
#define MESSAGETEST_H

#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/Message.h>
#include <stdexcept>


/// Unit tests for MessageTest
class MessageTest : public CPPUNIT_NS::TestFixture
{
  CPPUNIT_TEST_SUITE( MessageTest );
  CPPUNIT_TEST( testDefaultConstructor );
  CPPUNIT_TEST_EXCEPTION( testDetailAtThrowIfBadIndex, std::invalid_argument );
  CPPUNIT_TEST_EXCEPTION( testDetailAtThrowIfBadIndex2, std::invalid_argument );
  CPPUNIT_TEST( testAddDetail );
  CPPUNIT_TEST( testAddDetail2 );
  CPPUNIT_TEST( testAddDetail3 );
  CPPUNIT_TEST( testAddDetailEmptyMessage );
  CPPUNIT_TEST( testAddDetailMessage );
  CPPUNIT_TEST( testSetShortDescription );
  CPPUNIT_TEST( testClearDetails );
  CPPUNIT_TEST( testConstructor );
  CPPUNIT_TEST( testConstructorDetail1 );
  CPPUNIT_TEST( testConstructorDetail2 );
  CPPUNIT_TEST( testConstructorDetail3 );
  CPPUNIT_TEST( testDetailsNone );
  CPPUNIT_TEST( testDetailsSome );
  CPPUNIT_TEST( testEqual );
  CPPUNIT_TEST( testNotEqual );
  CPPUNIT_TEST_SUITE_END();

public:
  MessageTest();

  virtual ~MessageTest();

  void setUp();
  void tearDown();

  void testDefaultConstructor();
  void testDetailAtThrowIfBadIndex();
  void testDetailAtThrowIfBadIndex2();
  void testAddDetail();
  void testAddDetail2();
  void testAddDetail3();
  void testAddDetailEmptyMessage();
  void testAddDetailMessage();
  void testSetShortDescription();
  void testClearDetails();

  void testConstructor();
  void testConstructorDetail1();
  void testConstructorDetail2();
  void testConstructorDetail3();

  void testDetailsNone();
  void testDetailsSome();

  void testEqual();
  void testNotEqual();

private:
  /// Prevents the use of the copy constructor.
  MessageTest( const MessageTest &other );

  /// Prevents the use of the copy operator.
  void operator =( const MessageTest &other );

private:
  CPPUNIT_NS::Message *m_message;
};



#endif  // MESSAGETEST_H