Some versions of Marshmallow had mock methods and mock objects too. -- PEZ I added some example unit tests for my physics engine here that may be of use when writing your own tests. The purpose of unit tests is to catch bugs anywhere in your system (that you've written tests for) when you make code changes (and run the tests). A project I worked on would do a nightly run of the tests to get a report on the success rate and another tool measured lines of code that the tests touched. The goal was 90-100% code coverage and 100% success rate on tests. Some things that are not practical to test for could include environmental states (running out of memory) and i/o errors. Pretty hard to deliberately reproduce. Anyway .. PEZ perked up at the mention that I'd written 76 unit tests to cover my physics subsystem, and I'm also working on covering other systems (like turret and radar operation) as well. -- Martin Alan Pedersen
|