I am currently implementing a ray tracer for Windows Mobile 6.0 that we intend to use for our semester project. Our semester project deals with Distributed Rendering on Mobile Devices, using ray tracing.
We have chosen to follow the Test Driven Development (TDD) method where test cases are written before the actual coding begins. TDD "requires" that we employ some form of automated testing framework to automatically run tests to verify the test cases. As we are using C++, we have a multitude of choices with regard to the Unit testing framework.
I have come across CppUnitLite which is a very simple unit testing framework for C++, without any fancy features (a comparison of different frameworks can be found here: http://gamesfromwithin.com/exploring-the-c-unit-testing-framework-jungle)
Simply put, CppUnitLite allows one to fast and easily write unit tests, though not very object orientated (not a always a bad thing) as the example shows:
TEST (GetLength_0_1,Block)
{
Block block = Block(0,0,100,100);
CHECK(block.GetLength() == 10000);
}
The TEST macro is used to denote a unit test. The macro takes two arguments, the name of the test and the category of the test. In the example above, I have a Block class which has a GetLength method. The CHECK macro allows assertions to be made, e.g. to assert that the given Block has the length of 10000.
If any of the assertions fail, the console will tell me at exactly what line the assertion failed. This even works on Windows Mobile 6.0, as long as a debugger is attached to the device where the unit testing framework is running.
Programming in General
ray tracer, Cpp Unit Lite