Re: Unit Testing in C++
- From: "Malcolm" <regniztar@xxxxxxxxxxxxxx>
- Date: Sat, 28 Oct 2006 12:31:29 +0100
"Paulo Matos" <pocmatos@xxxxxxxxx> wrote in message
news:1161943505.055829.127480@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi all,The class has a public interface that will support various operations.
I'm quite curious on how you would go to perform unit testing in C++.
One way is to use one of the 'lot' of libraries available for the
purpose cppunit, c++unit, *unit in general... Other way would be to
tailor your tests manually. I would love to hear about experiences with
these methods and particular libraries. Which one has met your needs or
which one do you suggest.
Therefore you write a unti of test code to instantiate one or more instances
of the class, then call every method.
Ideally the tests will be extensive enough to make sure that every line of
code is executed at least once.
Unfortunately, for a non-trivial class, there is no way to ensure that all
cases have been tested thoroughly. C++ is particularly difficult to test
because classes store state throughout the system. Therefore
mymathobj.sqrt(4);
mymathobj.tan(PI);
might give the right results
mymathobj.tan(PI);
mymathobj.sqrt(4);
might give the wrong result.
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
.
- References:
- Unit Testing in C++
- From: Paulo Matos
- Unit Testing in C++
- Prev by Date: Re: finding primes
- Next by Date: Re: Scoring a good programming job by releasing OpenSource
- Previous by thread: Re: Unit Testing in C++
- Next by thread: enqueue data structure
- Index(es):
Relevant Pages
|