xref: /haiku/headers/tools/cppunit/cppunit/TestFailure.h (revision 58481f0f6ef1a61ba07283f012cafbc2ed874ead)
1 #ifndef CPPUNIT_TESTFAILURE_H    // -*- C++ -*-
2 #define CPPUNIT_TESTFAILURE_H
3 
4 #include <cppunit/Portability.h>
5 #include <string>
6 
7 namespace CppUnit {
8 
9 class Exception;
10 class SourceLine;
11 class Test;
12 
13 
14 /*! \brief Record of a failed Test execution.
15  * \ingroup BrowsingCollectedTestResult
16  *
17  * A TestFailure collects a failed test together with
18  * the caught exception.
19  *
20  * TestFailure assumes lifetime control for any exception
21  * passed to it.
22  */
23 class CPPUNIT_API TestFailure
24 {
25 public:
26   TestFailure( Test *failedTest,
27                Exception *thrownException,
28                bool isError );
29 
30   virtual ~TestFailure ();
31 
32   virtual Test *failedTest() const;
33 
34   virtual Exception *thrownException() const;
35 
36   virtual SourceLine sourceLine() const;
37 
38   virtual bool isError() const;
39 
40   virtual std::string failedTestName() const;
41 
42   virtual std::string toString() const;
43 
44   virtual TestFailure *clone() const;
45 
46 protected:
47   Test *m_failedTest;
48   Exception *m_thrownException;
49   bool m_isError;
50 
51 private:
52   TestFailure( const TestFailure &other );
53   TestFailure &operator =( const TestFailure& other );
54 };
55 
56 
57 } // namespace CppUnit
58 
59 #endif // CPPUNIT_TESTFAILURE_H
60