
Quoting jon@...18...:
I just did an initial checkin to add CxxTest.
I've just updated src/libnr/nr-point-fns-test.h
I moved the variables out of the first test, and up to the suite and changed the suite to use dynamic creation via createSuite() and destroySuite(). This gets those variables setup at the point when the suite execution is started, and only once so that all the tests in the suite can use them. (They're member variables instead of static ones so that we don't hit problems with static initialization order)
However... I noticed that in the existing *-test.cpp file it checked two of those variables to be sure they were valid before running the test. It had used asserts, but I really don't want to quit the whole program...
So I then overrode the virtual setUp() method (often paired with tearDown() ). This gets called just before each test in the suite, and gets counted towards each test's pass/fail state. So it just checks if the 'valid' boolean set in the suite constructor is true.