Another boner of a moment in my programming life

K.I.L.E.R

Retarded moron
Veteran
I've spent some time trying to write my own unit test framework for myself, I'm still unhappy with it due to the shear work necessary to get a single test up and running.
Funny enough after several months of straight Java programming, going back to C++ there are some things I miss and others I don't.

One of the benefits of Java is that (if you use Eclipse or Netbeans anyway) you can make the debugger redundant.
I've not had to use a debugger for months, I simply like to do test driven development. I write up my object's behaviour and do 100 or so asserts between each call.
The thing with test driven development is that these object calls are in a certain order.
So sprinkling asserts in your main program can be avoided (which is quite messy anyway).
I've written 7 or so tests for a single behaviour, not because the behaviour was complex, but because I have to know how a single behaviour works under every state in order to have 100% predictability.

In any case finding a frequently updated unit test platform for C++ is a pain in the ass. I've come across a few but they are outdated, Apache have a notice(few months back when I looked) on their website stating that people shouldn't use their test framework.

The 2 that have caught my eye are Boost.Test and TUT.
Can someone recommend me the preferred one?

In any case the reason I made this thread was to say how eerily wonderful it is to go back to using a debugger. I fixed up a problem prior to this post (was no bug, but a silly programmer) which had nothing to do with a bug but with me accidentally leaving something out.

Anyone else have a similar experience?
 
I think it's generally easier to:

1) check all your parameters and other needed data for validity upon entry
2) check if you can calculate a valid result
3) calculate it
4) check if it is indeed a valid result
5) return the result

and:

write your own test function that check the boundaries.

The nice thing about that, is that it requires you to define the boundaries in detail, and makes your code pretty much bullet-proof. But slower.

If you want speed, you can put the in-function checking between IFDEFs, as long as you don't adjust them there if needed (which I tend to do).
 
Back
Top