Testing and program analysis
Program analysis and testing go hand in hand to assure the quality of our solutions. For example, running Valgrind becomes more consistent when test code is used. For this reason, we'll configure those two things together. Figure 12.5 illustrates the execution flow and files needed to set them up (a few snippets will be added to the src
directory):
As we already know, tests live in the test
directory, and their listfile gets executed from the top-level listfile with the add_subdirectory()
command. Let's see what's inside:
chapter-12/01-full-project/test/CMakeLists.txt
include(Testing) add_subdirectory(calc) add_subdirectory(calc_console)
Testing utilities defined in the Testing
module are included at this level to allow both target groups (from the calc
and the calc_console
directories) to use them:
chapter-12/01-full-project/cmake...