~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/TestFailureTest.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 "TestFailureTest.h"
 
3
#include <cppunit/TestFailure.h>
 
4
#include <cppunit/Exception.h>
 
5
 
 
6
 
 
7
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TestFailureTest,
 
8
                                       coreSuiteName() );
 
9
 
 
10
 
 
11
TestFailureTest::TestFailureTest()
 
12
{
 
13
}
 
14
 
 
15
 
 
16
TestFailureTest::~TestFailureTest()
 
17
{
 
18
}
 
19
 
 
20
 
 
21
void 
 
22
TestFailureTest::setUp()
 
23
{
 
24
  m_exceptionDestroyed = false;
 
25
}
 
26
 
 
27
 
 
28
void 
 
29
TestFailureTest::tearDown()
 
30
{
 
31
}
 
32
 
 
33
 
 
34
void 
 
35
TestFailureTest::testConstructorAndGetters()
 
36
{
 
37
  CPPUNIT_NS::TestCase test;
 
38
  CPPUNIT_NS::Exception *error = new ObservedException( this );
 
39
  checkTestFailure( &test, error, false );
 
40
  CPPUNIT_ASSERT( m_exceptionDestroyed );
 
41
}
 
42
 
 
43
 
 
44
void 
 
45
TestFailureTest::testConstructorAndGettersForError()
 
46
{
 
47
  CPPUNIT_NS::TestCase test;
 
48
  CPPUNIT_NS::Exception *error = new ObservedException( this );
 
49
  checkTestFailure( &test, error, true );
 
50
  CPPUNIT_ASSERT( m_exceptionDestroyed );
 
51
}
 
52
 
 
53
 
 
54
void 
 
55
TestFailureTest::exceptionDestroyed()
 
56
{
 
57
  m_exceptionDestroyed = true;
 
58
}
 
59
 
 
60
 
 
61
void 
 
62
TestFailureTest::checkTestFailure( CPPUNIT_NS::Test *test, 
 
63
                                   CPPUNIT_NS::Exception *error,
 
64
                                   bool isError )
 
65
{
 
66
  CPPUNIT_NS::TestFailure failure( test, error, isError );
 
67
  CPPUNIT_ASSERT_EQUAL( test, failure.failedTest() );
 
68
  CPPUNIT_ASSERT_EQUAL( error, failure.thrownException() );
 
69
  CPPUNIT_ASSERT_EQUAL( isError, failure.isError() );
 
70
}