diff options
Diffstat (limited to 'src/unitsuite.h')
-rw-r--r-- | src/unitsuite.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/unitsuite.h b/src/unitsuite.h index db249b2..6e9270a 100644 --- a/src/unitsuite.h +++ b/src/unitsuite.h | |||
@@ -8,7 +8,42 @@ | |||
8 | namespace Bu | 8 | namespace Bu |
9 | { | 9 | { |
10 | /** | 10 | /** |
11 | * Provides a unit testing framework. This is pretty easy to use, probably | ||
12 | * the best way to get started is to use ch to generate a template, or use | ||
13 | * the code below with appropriate tweaks: | ||
14 | *@code | ||
15 | * #include "unitsuite.h" | ||
16 | * | ||
17 | * class Unit : public Bu::UnitSuite | ||
18 | * { | ||
19 | * public: | ||
20 | * Unit() | ||
21 | * { | ||
22 | * setName("Example"); | ||
23 | * addTest( Unit::test ); | ||
24 | * } | ||
25 | * | ||
26 | * virtual ~Unit() { } | ||
27 | * | ||
28 | * // | ||
29 | * // Tests go here | ||
30 | * // | ||
31 | * void test() | ||
32 | * { | ||
33 | * unitTest( 1 == 1 ); | ||
34 | * } | ||
35 | * }; | ||
36 | * | ||
37 | * int main( int argc, char *argv[] ) | ||
38 | * { | ||
39 | * return Unit().run( argc, argv ); | ||
40 | * } | ||
11 | * | 41 | * |
42 | @endcode | ||
43 | * The main function can contain other things, but using this one exactly | ||
44 | * makes all of the test suites work exactly the same. Using the optional | ||
45 | * setName at the top of the constructor replaces the class name with the | ||
46 | * chosen name when printing out stats and info. | ||
12 | */ | 47 | */ |
13 | class UnitSuite | 48 | class UnitSuite |
14 | { | 49 | { |