TDD in action
Let's see how to develop an Reverse Polish Notation (RPN) calculator application that follows the TDD approach. RPN is also known as the postfix notation. The expectation from the RPN Calculator application is to accept a postfix math expression as an input and return the evaluated result as the output.
Step by step, I would like to demonstrate how one can follow the TDD approach while developing an application. As the first step, I would like to explain the project directory structure, then we'll move forward. Let's create a folder named Ex2
with the following structure:
Figure 7.19
The googletest
folder is the gtest test library that has the necessary gtest
and gmock
header files. Now libgtest.a
is the Google test static library that we created in the previous exercise. We are going to use the make
utility to build our project, hence I have placed a Makefile
in the project home
directory. The src
directory will hold the production code, while the test directory will hold all...