CppUnit - The Unit Testing Library

CppUnit project page | FAQ

TestPath.h
Go to the documentation of this file.
1#ifndef CPPUNIT_TESTPATH_H
2#define CPPUNIT_TESTPATH_H
3
4#include <cppunit/Portability.h>
5
6#if CPPUNIT_NEED_DLL_DECL
7#pragma warning( push )
8#pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
9#endif
10
11#include <deque>
12#include <string>
13
14 CPPUNIT_NS_BEGIN
15
16
17class Test;
18
29 class CPPUNIT_API TestPath
30{
31public:
36 TestPath();
37
42 TestPath( Test *root );
43
51 TestPath( const TestPath &otherPath,
52 int indexFirst,
53 int count = -1 );
54
70 TestPath( Test *searchRoot,
71 const std::string &pathAsString );
72
76 TestPath( const TestPath &other );
77
78 virtual ~TestPath();
79
83 virtual bool isValid() const;
84
88 virtual void add( Test *test );
89
93 virtual void add( const TestPath &path );
94
100 virtual void insert( Test *test, int index );
101
108 virtual void insert( const TestPath &path, int index );
109
114 virtual void removeTests();
115
120 virtual void removeTest( int index );
121
126 virtual void up();
127
131 virtual int getTestCount() const;
132
138 virtual Test *getTestAt( int index ) const;
139
144 virtual Test *getChildTest() const;
145
156 virtual std::string toString() const;
157
162 TestPath &operator =( const TestPath &other );
163
164protected:
169 void checkIndexValid( int index ) const;
170
172 typedef std::deque<std::string> PathTestNames;
173
180 bool splitPathString( const std::string &pathAsString,
181 PathTestNames &testNames );
182
192 Test *findActualRoot( Test *searchRoot,
193 const std::string &pathAsString,
194 PathTestNames &testNames );
195
196protected:
197 typedef std::deque<Test *> Tests;
198 Tests m_tests;
199
200};
201
202
203 CPPUNIT_NS_END
204
205#endif // CPPUNIT_TESTPATH_H
206
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
Test
Base class for all test objects.
Definition Test.h:26
TestPath::checkIndexValid
void checkIndexValid(int index) const
Checks that the specified test index is within valid range.
Definition TestPath.cpp:185
TestPath::getChildTest
virtual Test * getChildTest() const
Get the last test of the path.
Definition TestPath.cpp:178
TestPath::findActualRoot
Test * findActualRoot(Test *searchRoot, const std::string &pathAsString, PathTestNames &testNames)
Finds the actual root of a path string and get the path string name components.
Definition TestPath.cpp:208
TestPath::TestPath
TestPath()
Constructs an invalid path.
Definition TestPath.cpp:10
TestPath::removeTest
virtual void removeTest(int index)
Removes the test at the specified index of the path.
Definition TestPath.cpp:147
TestPath::splitPathString
bool splitPathString(const std::string &pathAsString, PathTestNames &testNames)
Splits a path string into its test name components.
Definition TestPath.cpp:230
TestPath::add
virtual void add(Test *test)
Adds a test to the path.
Definition TestPath.cpp:105
TestPath::up
virtual void up()
Removes the last test.
Definition TestPath.cpp:155
TestPath::removeTests
virtual void removeTests()
Removes all the test from the path.
Definition TestPath.cpp:139
TestPath::toString
virtual std::string toString() const
Returns the path as a string.
Definition TestPath.cpp:193
TestPath::getTestAt
virtual Test * getTestAt(int index) const
Returns the test of the specified index.
Definition TestPath.cpp:170
TestPath::PathTestNames
std::deque< std::string > PathTestNames
A list of test names.
Definition TestPath.h:172
TestPath::m_tests
Tests m_tests
Definition TestPath.h:198
TestPath::getTestCount
virtual int getTestCount() const
Returns the number of tests in the path.
Definition TestPath.cpp:163
TestPath::isValid
virtual bool isValid() const
Tests if the path contains at least one test.
Definition TestPath.cpp:98
TestPath::Tests
std::deque< Test * > Tests
Definition TestPath.h:197
TestPath::insert
virtual void insert(Test *test, int index)
Inserts a test at the specified index.
Definition TestPath.cpp:120

| Send comments to: CppUnit Developers