blob: 314f1cc645eb585e960c688a9358aea7590c6aeb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#ifndef CPPUNIT_TESTRESULTCOLLECTOR_H
#define CPPUNIT_TESTRESULTCOLLECTOR_H
#include <cppunit/Portability.h>
#if CPPUNIT_NEED_DLL_DECL
#pragma warning( push )
#pragma warning( disable: 4251 4660 ) // X needs to have dll-interface to be used by clients of class Z
#endif
#include <cppunit/TestSuccessListener.h>
#include <deque>
CPPUNIT_NS_BEGIN
/*! \brief Collects test result.
* \ingroup WritingTestResult
* \ingroup BrowsingCollectedTestResult
*
* A TestResultCollector is a TestListener which collects the results of executing
* a test case. It is an instance of the Collecting Parameter pattern.
*
* The test framework distinguishes between failures and errors.
* A failure is anticipated and checked for with assertions. Errors are
* unanticipated problems signified by exceptions that are not generated
* by the framework.
* \see TestListener, TestFailure.
*/
class CPPUNIT_API TestResultCollector : public TestSuccessListener
{
public:
typedef std::deque<TestFailure *> TestFailures;
typedef std::deque<Test *> Tests;
/*! Constructs a TestResultCollector object.
*/
TestResultCollector( SynchronizationObject *syncObject = nullptr );
/// Destructor.
virtual ~TestResultCollector() override;
void startTest( Test *test ) override;
void addFailure( const TestFailure &failure ) override;
virtual void reset() override;
virtual int runTests() const;
virtual int testErrors() const;
virtual int testFailures() const;
virtual int testFailuresTotal() const;
virtual const TestFailures& failures() const;
virtual const Tests &tests() const;
protected:
void freeFailures();
Tests m_tests;
TestFailures m_failures;
int m_testErrors;
private:
/// Prevents the use of the copy constructor.
TestResultCollector( const TestResultCollector © );
/// Prevents the use of the copy operator.
void operator =( const TestResultCollector © );
};
CPPUNIT_NS_END
#if CPPUNIT_NEED_DLL_DECL
#pragma warning( pop )
#endif
#endif // CPPUNIT_TESTRESULTCOLLECTOR_H
|