Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

How to compile Cppunit test cases?
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!

Report this thread to moderator Post Follow-up to this message
Old Post
Markus Dehmann
08-27-04 01:57 AM


Re: How to compile Cppunit test cases?
Markus 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




Report this thread to moderator Post Follow-up to this message
Old Post
Phlip
08-27-04 01:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Extreme Programming archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:53 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.