~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to lib/cppunit-1.10.0/examples/cppunittest/TestTest.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2006-11-11 10:32:06 UTC
  • Revision ID: james.westby@ubuntu.com-20061111103206-f3p0r9g0vq44rp3r
Tags: upstream-3.0.PRE5
ImportĀ upstreamĀ versionĀ 3.0.PRE5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "CoreSuite.h"
 
2
#include "TestTest.h"
 
3
 
 
4
 
 
5
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TestTest,
 
6
                                       coreSuiteName() );
 
7
 
 
8
 
 
9
TestTest::TestTest() : 
 
10
    CPPUNIT_NS::TestFixture()
 
11
{
 
12
}
 
13
 
 
14
 
 
15
TestTest::~TestTest()
 
16
{
 
17
}
 
18
 
 
19
 
 
20
void 
 
21
TestTest::setUp()
 
22
{
 
23
  m_suite = new CPPUNIT_NS::TestSuite( "suite" );
 
24
  m_test1 = new MockTestCase( "test1" );
 
25
  m_test2 = new MockTestCase( "test2" );
 
26
  m_suite->addTest( m_test1 );
 
27
  m_suite->addTest( m_test2 );
 
28
  
 
29
  m_path = new CPPUNIT_NS::TestPath();
 
30
}
 
31
 
 
32
 
 
33
void 
 
34
TestTest::tearDown()
 
35
{
 
36
  delete m_suite;
 
37
  delete m_path;
 
38
}
 
39
 
 
40
 
 
41
void 
 
42
TestTest::testFindTestPathPointerThis()
 
43
{
 
44
  CPPUNIT_ASSERT( m_test1->findTestPath( m_test1, *m_path ) );
 
45
  CPPUNIT_ASSERT_EQUAL( 1, m_path->getTestCount() );
 
46
  CPPUNIT_ASSERT( m_test1 == m_path->getChildTest() );
 
47
 
 
48
  m_path->removeTests();
 
49
 
 
50
  CPPUNIT_ASSERT( m_suite->findTestPath( m_suite, *m_path ) );
 
51
  CPPUNIT_ASSERT_EQUAL( 1, m_path->getTestCount() );
 
52
  CPPUNIT_ASSERT( m_suite == m_path->getChildTest() );
 
53
}
 
54
 
 
55
 
 
56
void 
 
57
TestTest::testFindTestPathPointer()
 
58
{
 
59
  CPPUNIT_ASSERT( m_suite->findTestPath( m_test1, *m_path ) );
 
60
  CPPUNIT_ASSERT_EQUAL( 2, m_path->getTestCount() );
 
61
  CPPUNIT_ASSERT( m_suite == m_path->getTestAt(0) );
 
62
  CPPUNIT_ASSERT( m_test1 == m_path->getTestAt(1) );
 
63
}
 
64
 
 
65
 
 
66
void 
 
67
TestTest::testFindTestPathPointerFail()
 
68
{
 
69
  MockTestCase test( "test" );
 
70
  CPPUNIT_ASSERT( !m_suite->findTestPath( &test, *m_path ) );
 
71
  CPPUNIT_ASSERT( !m_path->isValid() );
 
72
}
 
73
 
 
74
 
 
75
void 
 
76
TestTest::testFindTestPathNameThis()
 
77
{
 
78
  CPPUNIT_ASSERT( m_test1->findTestPath( "test1", *m_path ) );
 
79
  CPPUNIT_ASSERT_EQUAL( 1, m_path->getTestCount() );
 
80
  CPPUNIT_ASSERT( m_test1 == m_path->getChildTest() );
 
81
 
 
82
  m_path->removeTests();
 
83
 
 
84
  CPPUNIT_ASSERT( m_suite->findTestPath( "suite", *m_path ) );
 
85
  CPPUNIT_ASSERT_EQUAL( 1, m_path->getTestCount() );
 
86
  CPPUNIT_ASSERT( m_suite == m_path->getChildTest() );
 
87
}
 
88
 
 
89
 
 
90
void 
 
91
TestTest::testFindTestPathName()
 
92
{
 
93
  CPPUNIT_ASSERT( m_suite->findTestPath( "test2", *m_path ) );
 
94
  CPPUNIT_ASSERT_EQUAL( 2, m_path->getTestCount() );
 
95
  CPPUNIT_ASSERT( m_suite == m_path->getTestAt(0) );
 
96
  CPPUNIT_ASSERT( m_test2 == m_path->getTestAt(1) );
 
97
}
 
98
 
 
99
 
 
100
void 
 
101
TestTest::testFindTestPathNameFail()
 
102
{
 
103
  CPPUNIT_ASSERT( !m_suite->findTestPath( "bad-test", *m_path ) );
 
104
  CPPUNIT_ASSERT( !m_path->isValid() );
 
105
}
 
106
 
 
107
 
 
108
void 
 
109
TestTest::testFindTest()
 
110
{
 
111
  CPPUNIT_ASSERT( m_test1 == m_suite->findTest( "test1" ) );
 
112
}
 
113
 
 
114
 
 
115
void 
 
116
TestTest::testFindTestThrow()
 
117
{
 
118
  m_suite->findTest( "no-name" );
 
119
}
 
120
 
 
121
 
 
122
void 
 
123
TestTest::testResolveTestPath()
 
124
{
 
125
  CPPUNIT_NS::TestPath path1 = m_suite->resolveTestPath( "suite");
 
126
  CPPUNIT_ASSERT_EQUAL( 1, path1.getTestCount() );
 
127
  CPPUNIT_ASSERT( m_suite == path1.getTestAt(0) );
 
128
 
 
129
  CPPUNIT_NS::TestPath path2 = m_suite->resolveTestPath( "suite/test2");
 
130
  CPPUNIT_ASSERT_EQUAL( 2, path2.getTestCount() );
 
131
  CPPUNIT_ASSERT( m_suite == path2.getTestAt(0) );
 
132
  CPPUNIT_ASSERT( m_test2 == path2.getTestAt(1) );
 
133
}