CppUnit - The Unit Testing Library

CppUnit project page | FAQ

TestFailure.h
Go to the documentation of this file.
1#ifndef CPPUNIT_TESTFAILURE_H // -*- C++ -*-
2#define CPPUNIT_TESTFAILURE_H
3
4#include <cppunit/Portability.h>
5#include <string>
6
7 CPPUNIT_NS_BEGIN
8
9
10class Exception;
11class SourceLine;
12class Test;
13
14
24 class CPPUNIT_API TestFailure
25{
26public:
27 TestFailure( Test *failedTest,
28 Exception *thrownException,
29 bool isError );
30
31 virtual ~TestFailure ();
32
33 virtual Test *failedTest() const;
34
35 virtual Exception *thrownException() const;
36
37 virtual SourceLine sourceLine() const;
38
39 virtual bool isError() const;
40
41 virtual std::string failedTestName() const;
42
43 virtual TestFailure *clone() const;
44
45protected:
46 Test *m_failedTest;
47 Exception *m_thrownException;
48 bool m_isError;
49
50private:
51 TestFailure( const TestFailure &other );
52 TestFailure &operator =( const TestFailure& other );
53};
54
55
56 CPPUNIT_NS_END
57
58#endif // CPPUNIT_TESTFAILURE_H
CPPUNIT_API
#define CPPUNIT_API
Definition CppUnitApi.h:27
Portability.h
CPPUNIT_NS_END
#define CPPUNIT_NS_END
Definition Portability.h:106
CPPUNIT_NS_BEGIN
#define CPPUNIT_NS_BEGIN
Definition Portability.h:105
Exception
Exceptions thrown by failed assertions.
Definition Exception.h:20
SourceLine
Represents a source line location.
Definition SourceLine.h:31
TestFailure::TestFailure
TestFailure(Test *failedTest, Exception *thrownException, bool isError)
Constructs a TestFailure with the given test and exception.
Definition TestFailure.cpp:9
TestFailure::isError
virtual bool isError() const
Indicates if the failure is a failed assertion or an error.
Definition TestFailure.cpp:50
TestFailure::sourceLine
virtual SourceLine sourceLine() const
Gets the failure location.
Definition TestFailure.cpp:42
TestFailure::m_failedTest
Test * m_failedTest
Definition TestFailure.h:46
TestFailure::failedTestName
virtual std::string failedTestName() const
Gets the name of the failed test.
Definition TestFailure.cpp:58
TestFailure::thrownException
virtual Exception * thrownException() const
Gets the thrown exception. Never NULL.
Definition TestFailure.cpp:34
TestFailure::failedTest
virtual Test * failedTest() const
Gets the failed test.
Definition TestFailure.cpp:26
TestFailure::m_thrownException
Exception * m_thrownException
Definition TestFailure.h:47
TestFailure::m_isError
bool m_isError
Definition TestFailure.h:48
TestFailure::TestFailure
TestFailure(const TestFailure &other)
TestFailure::clone
virtual TestFailure * clone() const
Definition TestFailure.cpp:65
Test
Base class for all test objects.
Definition Test.h:26

| Send comments to: CppUnit Developers