Enhancing the testing library to support assertions
The passing grades test from the previous section has two confirms that we’re going to improve in this section. It looks like this:
TEST("Test passing grades")
{
bool result = isPassingGrade(0);
if (result)
{
throw 1;
}
result = isPassingGrade(100);
if (not result)
{
throw 1;
}
}
In the first confirm, we want to make sure that result
is false because we know that a score of 0 should not be a passing grade. And for the second confirm, we want to make sure that, this time, result
is true because we know that a score of 100 should lead to a passing grade.
Can you see how the if
condition needs to be the opposite of what we’...