Unit testing is a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation. This can involve taking a class, function, or algorithm and writing test cases that can be run to verify that the unit is working correctly.
CMake includes a tool called CTest
which allows you to enable the make test
target to run automated tests such as unit tests.
There are many unit-testing frameworks available which can be used to help automate and ease the development of unit tests. In these examples I show how to use some of these frameworks and call them using the CMake testing utility CTest.
The examples here include using the following frameworks: