mirror of
https://github.com/ttroy50/cmake-examples.git
synced 2025-12-18 12:14:36 +03:00
29 lines
1.1 KiB
Plaintext
29 lines
1.1 KiB
Plaintext
= Unit Testing
|
|
|
|
:toc:
|
|
:toc-placement!:
|
|
|
|
toc::[]
|
|
|
|
[[intro]]
|
|
Introduction
|
|
------------
|
|
|
|
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 link:https://cmake.org/Wiki/CMake/Testing_With_CTest[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:
|
|
|
|
* http://www.boost.org/doc/libs/1_56_0/libs/test/doc/html/utf/user-guide.html[Boost Unit Test Framework]
|
|
* https://github.com/google/googletest[Google Test - Download]
|
|
* https://github.com/philsquared/Catch[Catch]
|