Chapter 7. CppUnit
Overview
CppUnit is a port of JUnit to C++, and was originally authored by Michael Feathers and Jerome Lacoste. Its basic architecture and usage closely follow the xUnit model. The implementation details differ from JUnit as a result of design choices by CppUnit’s developers and language differences between Java and C++. CppUnit’s implementation makes full use of advanced C++ language features, including templates, abstract classes, nested classes, and the Standard Template Library (STL) It also makes extensive use of C macros, which some consider inelegant and error-prone, but are definitely useful here. CppUnit is designed to be thread-safe.
CppUnit is open source software released under the GNU Lesser General Public License. This license makes the code free for use, modification, and redistribution. For details, refer to http://www.gnu.org.
The CppUnit project is based at http://cppunit.sourceforge.net. The information given here is for CppUnit Version 1.8.0.
Architecture
CppUnit contains 24 ordinary classes, 4 abstract classes, 7 template classes, and several nested classes and helper macros. Everything belongs to the namespace “CppUnit” or one of its subordinate namespaces. The CppUnit namespaces are shown in Figure 7-1.
![]() |
Most of the code belongs to the main namespace, "CppUnit.” The namespace "Asserter” contains assertion functions ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
