CppUnit
CppUnit is a unit test framework for C programming. It's the Java tool JUnit modeled.
CppUnit testing program units (most classes). To create a new test, a new class is created, which is extended with CppUnit macros. The methods of the class to be registered as a test. Within the methods of other classes can be tested now methods. This one tests usually whether a particular input produces a correct output. The results of the tests can be machine-readable displays XML as text output or with the provided GUI -based programs.
Features
CppUnit has the following properties:
- XML output with elements for additional information
- Compiler -like text output to integrate with IDEs
- Macros for the easy creation of test suites
- Support for hierarchical tests ( tests that are composed of simpler tests)
- Test registration for faster code generation
- Test Plug -in for faster compile / test cycle (self testable dynamic library )
- Protective mechanism to encapsulate test execution, allows the interception of exceptions that are not of the standard exception ( std :: exception ) are derived.
- MfcTestRunner, one on the Microsoft Foundation Classes ( MFC) based test runner
- QtTestRunner, one based on Qt 4 graphical test runner
- Curse Test Runner, a curses -based test runner
- WxWidgetsTestRunner, a wxWidgets -based test runner
Example
This example shows a unit test. The calculator class is the object to be tested, KalkulatorTest the unit test. ( For the execution of the test program the starting point has to be modified. )
Class calculator
... class calculator { public: / / Calculate the root of k squareRoot double (double k) {return sqrt (k); } }; class KalkulatorTest
# include
- CppUnit homepage ( English)
- CppUnit tutorial - Unit testing with C
Single Documents
- Programming tool
- Test Software