blob: 2012f7f6e1588c670c0d1dacce8f1dee90711afa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
Introduction
------------
CxxTest is a JUnit/CppUnit/xUnit-like framework for C++.
Its advantages over existing alternatives are that it:
- Doesn't require RTTI
- Doesn't require member template functions
- Doesn't require exception handling
- Doesn't require any external libraries (including memory management,
file/console I/O, graphics libraries)
This makes it extremely portable and usable.
CxxTest is available under the GNU Lesser General Public Licence (LGPL).
See http://www.gnu.org/copyleft/lesser.html for the license.
Simple user's guide
-------------------
1. Create a test suite header file:
MyTest.h:
#include <cxxtest/TestSuite.h>
class MyTestSuite : public CxxTest::TestSuite
{
public:
void testAddition( void )
{
TS_ASSERT( 1 + 1 > 1 );
TS_ASSERT_EQUALS( 1 + 1, 2 );
}
};
2. Generate the tests file:
# cxxtestgen.pl -o tests.cpp MyTestSuite.h
3. Create a main function that runs the tests
main.cpp:
#include <cxxtest/ErrorPrinter.h>
int main( void )
{
CxxText::ErrorPrinter::runAllTests();
return 0;
}
4. Compile and run!
# g++ -o main main.cpp tests.cpp
# ./main
Running 1 test(s).OK!
Advanced User's Guide
---------------------
See docs/guide.html.
|