Code Comments
Programming Forum and web based access to our favorite programming groups.All Cppunit examples in the cppunit/examples/ directory have very long and complex Makefiles with them. Is that necessary? If I want to use my own Cppunit test cases in my project, I certainly cannot write these complex Makefiles. I also don't use configure. So, how can I compile Cppunit test cases, just using simple g++ commands? I tried the following. It compiles, but does not run correctly: bash-2.05b$ g++ -c ExampleTestCase.cpp bash-2.05b$ g++ -c Main.cpp bash-2.05b$ g++ Main.o ExampleTestCase.o -lcppunit -ldl /usr/local/lib/libcppunit-1.10.so.2 bash-2.05b$ ./a.out ExampleTestCase::example : assertion ExampleTestCase::anotherExample : assertion ExampleTestCase::binaryExample : assertion ExampleTestCase::testAdd : assertion ExampleTestCase::testDivideByZeroFloatin g point exception But the correct test case run would be: ExampleTestCase::example : assertion ExampleTestCase::anotherExample : assertion ExampleTestCase::binaryExample : assertion ExampleTestCase::testAdd : assertion ExampleTestCase::testDivideByZero : OK ExampleTestCase::testEquals : assertion ExampleTestCase.cpp:7:Assertion [...] Failures !!! Run: 6 Failure total: 5 Failures: 5 Errors: 0 So, how can I compile these test cases in a simple way, without using 13KB Makefiles, and make them run correctly? Thanks!
Post Follow-up to this messageMarkus Dehmann wrote: > All Cppunit examples in the cppunit/examples/ directory have very long > and complex Makefiles with them. Is that necessary? Try this: http://www.xpsd.org/cgi-bin/wiki?NanoCppUnit It has a stray OutputDebugString in it, but other than that it's completely portable, and uses a TEST_() macro for the test collector pattern in C++. The problem with CppUnit is this: SUnit -> JUnit -> CppUnit. Each time they ported, they did not reconceptualize based on the target platform's balances and needs. So a rewrite of the raw TDD concept, in one header file with a few lines of code, can get you coding faster than all that excess. What CppUnit provides is a results object, and pluggable test runners. TDD doesn't need them, because if a test fails unexpectedly you only need to inspect the situation, then use Undo until things get better. -- Phlip http://industrialxp.org/community/b...tUserInterfaces
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.