Redirecting the output results
This is a simple edit that should not cause any real change to the application so far. Right now, the runTests
function uses std::cout
directly when displaying the results. We’re going to change this so that the main
function will pass std::cout
as an argument to runTests
. Nothing will actually change because we’ll still be using std::cout
for the results but this is a better design because it lets the testing application decide where to send the results, instead of the testing library.
By the testing library, I mean the Test.h
file. This is the file that other applications will include in order to create and run tests. With the project we have so far, it’s a bit different because we’re writing tests to test the library itself. So, the whole application is just the Test.h
file and the tests
folder containing the testing application.
We first need to change main.cpp
to include iostream
and then pass std::cout
to runTests...