Update of /cvsroot/mockpp/mockpp/mockpp/examples/tutorial
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15261/mockpp/examples/tutorial
Modified Files:
cppunit.cpp
Log Message:
fixes bcb5, msvc
Index: cppunit.cpp
===================================================================
RCS file: /cvsroot/mockpp/mockpp/mockpp/examples/tutorial/cppunit.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cppunit.cpp 10 Dec 2005 20:07:21 -0000 1.13
+++ cppunit.cpp 28 Dec 2005 19:43:08 -0000 1.14
@@ -17,10 +17,14 @@
#include <mockpp/chaining/ChainableMockObject.h>
#include <mockpp/chaining/ChainingMockObjectSupport.h>
+#if defined(MOCKPP_USE_CPPUNIT)
+
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
+#endif
+
#include "Calculator.h"
using mockpp::eq;
@@ -71,11 +75,17 @@
/** A helper class for the unit tests
* @internal
*/
-class Calculator_test : public CppUnit::TestFixture
+class Calculator_test
+#if defined(MOCKPP_USE_CPPUNIT)
+ : public CppUnit::TestFixture
+#endif
+
{
public:
- CPPUNIT_TEST_SUITE( Calculator_test );
+#if defined(MOCKPP_USE_CPPUNIT)
+
+ CPPUNIT_TEST_SUITE( Calculator_test );
CPPUNIT_TEST(test_add);
CPPUNIT_TEST(test_sub);
CPPUNIT_TEST(test_add_v);
@@ -84,6 +94,8 @@
CPPUNIT_TEST(test_network_read_c);
CPPUNIT_TEST_SUITE_END();
+#endif
+
public:
void test_add();
@@ -94,9 +106,12 @@
void test_network_read_c();
};
+#if defined(MOCKPP_USE_CPPUNIT)
+
// Automatically register tests
CPPUNIT_TEST_SUITE_REGISTRATION(Calculator_test);
+#endif
// Test add(int) method
void Calculator_test::test_add()
@@ -267,10 +282,14 @@
if (argc != 1)
global_error = argc; // disturb tests
+#if defined(MOCKPP_USE_CPPUNIT)
// create tests and run them
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactory ®istry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest(registry.makeTest());
return runner.run() ? 0 : 1;
+#else
+ return 0;
+#endif
}
|