Unit testing refers to the practice of testing certain functions and areas (units) of our code. This gives us the ability to verify that our functions work as expected.
It is expected that the reader will have some understanding of the unit test process, but the contents exposed here will be covered at a much higher level of detail in Chapter 14, Application Testing.
At the beginning of this chapter, we included the most important parts of the application included in the companion source code for this chapter. The source code defined a calculator with support for two operations: pow and add.
The pow operation expects two numbers as its arguments and has two possible execution paths:
- The pow function will throw an exception if one of the two arguments provided is not a number
- The pow function will return a number if both arguments are valid numbers...