Dave's Unit Test (DUT) is a simple unit testing infrastructure implemented in c-preprocessor macros and GNU make.
Here are some key features of "Dave s Unit Test":
· Test the (non-)equality of any types (including C++ classes) which can be compared using the = operator.
· Special purpose tests for the (non-)equality of floating point types allow for a user specified granularity in machine arithmetic.
· Built in string comparison tests.
· Able to test for the (non-)existence of C++ exceptions and to trap and report unexpected exceptions.
· Able to test for the (non-)existence of POSIX signals (i.e. signal (2)) and to trap and report on unexpected signals.
DUT has been tested with (and only with) various versions of gcc. As of 1 March 2008, the SVN head works with tcc 0.9.23 as well, but not with nwcc 0.7.5. At this point I do not know if this is a fault in my code or in the compiler.
If you know that it does or especially does not work with another compiler, please let me know.
Testing with other compilers turned up a miscellaneous "compatibility" issue: the behaviour of various libc function on bad input is not always specified. So on my PowerBook G4 the code
char *str4 = NULL;
throws a SIGBUS signal. But it does not on my Debian 4.0 machine. A fact which makes requiring certain code to raise a signal problematic.
· You'll need a c or c++ compiler with a working preprocessor (if objective c or the like works for you, let me know!)
· You must be able to link the code you're testing with c or c++, and you can only test object files which do not define main()
· GNU make
What's New in This Release:
· This version adds an optional, simple-minded locking mechanism based on POSIX semaphores.