Go through the following steps to work through the recipe:
- From a new Terminal, run the following to download the source code:
> cd ~/
> git clone https://github.com/PacktPublishing/Advanced-CPP-CookBook.git
> cd Advanced-CPP-CookBook/chapter07
- To compile the source code, run the following:
> cmake .
> make recipe01_examples
- Once the source code is compiled, you can execute each example in this recipe by running the following commands:
> ./recipe01_example01
===========================================================================
All tests passed (1 assertion in 1 test case)
> ./recipe01_example02
===========================================================================
All tests passed (6 assertions in 1 test case)
> ./recipe01_example03
===========================================================================
All tests passed (8 assertions in 1 test case)
> ./recipe01_example04
===========================================================================
All tests passed (1 assertion in 1 test case)
> ./recipe01_example05
...
===========================================================================
test cases: 1 | 1 passed
assertions: - none -
> ./recipe01_example06
...
===========================================================================
test cases: 5 | 3 passed | 2 failed
assertions: 8 | 6 passed | 2 failed
> ./recipe01_example07
===========================================================================
test cases: 1 | 1 passed
assertions: - none -
> ./recipe01_example08
===========================================================================
All tests passed (3 assertions in 1 test case)
In the next section, we will step through each of these examples and explain what each example program does and how it relates to the lessons being taught in this recipe.