Enhancing the test declaration to support multiple tests
While a single test works, trying to add another one does not build. This is what I tried to do in Creation.cpp
by adding another test. One of the tests is empty and the second test throws an int. These are the two scenarios we were just trying to work with:
#include "../Test.h"
TEST
{
}
TEST
{
throw 1;
}
The failure is due to the Test
class being declared twice, as well as the run
method. The TEST
macro declares a new global instance of the Test
class each time it’s used. Each instance is called test
. We don’t see the classes or the instances in the code because they are hidden by the TEST
macro.
We’ll need to modify the TEST
macro so that it will generate unique class and instance names. And while we’re doing that, let’s also fix the name of the test itself. We don’t want all tests to have the name "testCanBeCreated"
, and since the...