root / CCV-HAND / libs / poco / include / CppUnit / TestFailure.h @ 59

View | Annotate | Download (1.5 KB)

1
//
2
// TestFailure.h
3
//
4
// $Id: //poco/1.3/CppUnit/include/CppUnit/TestFailure.h#1 $
5
//
6
7
8
#ifndef CppUnit_TestFailure_INCLUDED
9
#define CppUnit_TestFailure_INCLUDED
10
11
12
#include "CppUnit/CppUnit.h"
13
#include "CppUnit/CppUnitException.h"
14
#include "CppUnit/Guards.h"
15
16
17
namespace CppUnit {
18
19
20
class Test;
21
22
23
/*
24
 * A TestFailure collects a failed test together with
25
 * the caught exception.
26
 *
27
 * TestFailure assumes lifetime control for any exception
28
 * passed to it.  The lifetime of tests is handled by
29
 * their TestSuite (if they have been added to one) or
30
 * whomever creates them.
31
 *
32
 * see TestResult
33
 * see TestSuite
34
 *
35
 */
36
class CppUnit_API TestFailure
37
{
38
        REFERENCEOBJECT (TestFailure)
39
40
public:
41
        TestFailure(Test* failedTest, CppUnitException* thrownException);
42
        ~TestFailure();
43
44
        Test* failedTest();
45
        CppUnitException* thrownException();
46
        std::string toString();
47
48
protected:
49
        Test* _failedTest;
50
        CppUnitException *_thrownException;
51
};
52
53
54
// Constructs a TestFailure with the given test and exception.
55
inline TestFailure::TestFailure(Test* failedTest, CppUnitException* thrownException): _failedTest(failedTest), _thrownException(thrownException)
56
{
57
}
58
59
60
// Deletes the owned exception.
61
inline TestFailure::~TestFailure()
62
{ 
63
        delete _thrownException;
64
}
65
66
67
// Gets the failed test.
68
inline Test* TestFailure::failedTest()
69
{
70
        return _failedTest;
71
}
72
73
74
// Gets the thrown exception.
75
inline CppUnitException* TestFailure::thrownException()
76
{
77
        return _thrownException;
78
}
79
80
81
} // namespace CppUnit
82
83
84
#endif // CppUnit_TestFailure_INCLUDED
85
86