5 #include "cppunit/TestCaller.h" 6 #include "cppunit/TestCase.h" 7 #include "cppunit/TestSuite.h" 10 template<
class NDCCLASS>
class NDCTest :
public CppUnit::TestCase {
18 NDCTest(std::string name) : CppUnit::TestCase(name) {
22 suite->addTest(
new CppUnit::TestCaller<NDCTest>(
"testEmpty",
24 suite->addTest(
new CppUnit::TestCaller<NDCTest>(
"testPush",
26 suite->addTest(
new CppUnit::TestCaller<NDCTest>(
"testPush2",
28 suite->addTest(
new CppUnit::TestCaller<NDCTest>(
"testPop",
30 suite->addTest(
new CppUnit::TestCaller<NDCTest>(
"testClear",
39 _nDC =
new NDCCLASS();
47 assert(_nDC->_get() ==
"");
48 assert(_nDC->_getDepth() == 0);
52 _nDC->_push(
"push context 1");
53 assert(_nDC->_get() ==
"push context 1");
54 assert(_nDC->_getDepth() == 1);
59 _nDC->_push(
"push context 1");
60 _nDC->_push(
"push context 2");
61 assert(_nDC->_get() ==
"push context 1 push context 2");
62 assert(_nDC->_getDepth() == 2);
67 _nDC->_push(
"push context 1");
68 _nDC->_push(
"push context 2");
70 assert(_nDC->_get() ==
"push context 1");
71 assert(_nDC->_getDepth() == 1);
75 _nDC->_push(
"push context 1");
76 _nDC->_push(
"push context 2");
78 assert(_nDC->_get() ==
"");
79 assert(_nDC->_getDepth() == 0);
int countTestCases() const
NDCTest(std::string name)
virtual void registerTests(CppUnit::TestSuite *suite)