. Q: How to pronounce "unit--"?
A: unit minus minus, or just unit minus.
. Q: Why use this name?
A: C++ add many fantastic features on C. unit--'s aim is to take advantage of
these features, and remove as much duplicated work as possible. The focus
is on minus :-)
. Q: How to write a test case?
A: open self_test/unit--.selftest.cpp with your C++ program editer,
there is a tutorial. There is also an HTML version available.
. Q: How to use fixtures like setUp() and tearDown()?
A: C++ itself has a nice solution, i.e. constructor and destructor
check case #4 of tutorial for an example.
. Q: How to get more information rather than merely "xxx is supposed to be true"?
with assertTrue() ?
A: try the following style:
. Q: Should I add a semicolon at end of each testCase and testSuite?
A: For a testSuite, It's neither necessary nor harmful to the semantic.
For a testCase, do not add semicolon, or test code between following
braces won't be recognized by your compiler.
. Q: VisualAge C++(xlC) can compile the unit tests successfully, but the compiled
program says: total 0 test case(s)
A: 1. quick and dirty sulotion:
avoid -qipa, -O4 or -O5 options and add -qstrict -qxcall -qkeepinlines options
2. better but a little bothering sulotion:
avoid -qipa, -O4 or -O5 options for only link phase, and
add -qstrict -qxcall -qkeepinlines options for both compile and link phase
the -qipa option of xlC (default for -O4 and -O5) will do analyse across functions
to get unused variable eliminated, even if the initialization has side effects.
this behavior is not compliant to the standard. Ref ISO/IEC 14882:1998 sec 3.6.2
|assertTrue(xxx && "xxx cannot be false here");|