~ubuntu-branches/ubuntu/jaunty/psi/jaunty

« back to all changes in this revision

Viewing changes to third-party/cppunit/cppunit/src/cppunit/TestFailure.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-08-28 18:46:52 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080828184652-iiik12dl91nq7cdi
Tags: 0.12-2
Uploading to unstable (Closes: Bug#494352)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <cppunit/Exception.h>
 
2
#include <cppunit/Test.h>
 
3
#include <cppunit/TestFailure.h>
 
4
 
 
5
CPPUNIT_NS_BEGIN
 
6
 
 
7
 
 
8
/// Constructs a TestFailure with the given test and exception.
 
9
TestFailure::TestFailure( Test *failedTest, 
 
10
                          Exception *thrownException,
 
11
                          bool isError ) :
 
12
    m_failedTest( failedTest ), 
 
13
    m_thrownException( thrownException ),
 
14
    m_isError( isError )
 
15
{
 
16
}
 
17
 
 
18
/// Deletes the owned exception.
 
19
TestFailure::~TestFailure()
 
20
 
21
  delete m_thrownException; 
 
22
}
 
23
 
 
24
/// Gets the failed test.
 
25
Test *
 
26
TestFailure::failedTest() const
 
27
 
28
  return m_failedTest; 
 
29
}
 
30
 
 
31
 
 
32
/// Gets the thrown exception. Never \c NULL.
 
33
Exception *
 
34
TestFailure::thrownException() const
 
35
 
36
  return m_thrownException; 
 
37
}
 
38
 
 
39
 
 
40
/// Gets the failure location.
 
41
SourceLine 
 
42
TestFailure::sourceLine() const
 
43
{
 
44
  return m_thrownException->sourceLine();
 
45
}
 
46
 
 
47
 
 
48
/// Indicates if the failure is a failed assertion or an error.
 
49
bool 
 
50
TestFailure::isError() const
 
51
{
 
52
  return m_isError;
 
53
}
 
54
 
 
55
 
 
56
/// Gets the name of the failed test.
 
57
std::string 
 
58
TestFailure::failedTestName() const
 
59
{
 
60
  return m_failedTest->getName();
 
61
}
 
62
 
 
63
 
 
64
TestFailure *
 
65
TestFailure::clone() const
 
66
{
 
67
  return new TestFailure( m_failedTest, m_thrownException->clone(), m_isError );
 
68
}
 
69
 
 
70
 
 
71
CPPUNIT_NS_END