blob: 4020d167ff5ce62b53c7943550a3e5aebd3a29d3 (
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
|
// //////////////////////////////////////////////////////////////////////////
// Header file DumperListener.h for class DumperListener
// (c)Copyright 2000, Baptiste Lepilleur.
// Created: 2002/04/19
// //////////////////////////////////////////////////////////////////////////
#ifndef DUMPERLISTENER_H
#define DUMPERLISTENER_H
#include <stack>
#include <cppunit/TestListener.h>
#include <cppunit/TestPath.h>
/// TestListener that prints a flatten or hierarchical view of the test tree.
class DumperListener : public CPPUNIT_NS::TestListener
{
public:
DumperListener( bool flatten );
virtual ~DumperListener();
void startTest( CPPUNIT_NS::Test *test );
void endTest( CPPUNIT_NS::Test *test );
void startSuite( CPPUNIT_NS::Test *suite );
void endSuite( CPPUNIT_NS::Test *suite );
void endTestRun( CPPUNIT_NS::Test *test,
CPPUNIT_NS::TestResult *eventManager );
private:
/// Prevents the use of the copy constructor.
DumperListener( const DumperListener &other );
/// Prevents the use of the copy operator.
void operator =( const DumperListener &other );
void printPath( CPPUNIT_NS::Test *test,
bool isSuite );
void printFlattenedPath( bool isSuite );
void printIndentedPathChild();
std::string makeIndentString( int indentLevel );
private:
bool m_flatten;
CPPUNIT_NS::TestPath m_path;
int m_suiteCount;
int m_testCount;
int m_suiteWithTestCount;
std::stack<bool> m_suiteHasTest;
};
// Inlines methods for DumperListener:
// -----------------------------------
#endif // DUMPERLISTENER_H
|