Visual Studio 2015 complained about calling UT_THROW with zero arguments.
Visual Studio 6 complained about calling UT_CATCH with an empty second
argument. For these cases, I added UT_RETHROW(ExceptionName).
I also added a catch of RequiredCheckException to ExecuteTest to avoid
two error messages on each failed REQUIRE check.
Was able to remove ThrowingTestReporter::SetDecorated and
::GetDecorated by changing RequiredCheckTestReporter to accept
its TestResults by reference. This simple change removed
several if-checks and some functions.
(1) unreachable code in for loop shenanigans is eliminated.
(2) code after a failing REQUIRE check no longer executes. Used a
decorating TestReporter to achive this.
I changed the definition of the REQUIRE macro to use for loops and
some comma operator shenanigans to allow things like:
REQUIRE
{
CHECK(...);
CHECK_EQUAL(..., ...);
}
or
REQUIRE CHECK(...);
I updated the tests and they all passed on my machine. My only
concern is that some compilers might complain about the unreachable
code in the (throw UnitTest::AssertException(), true) expression.
test when an assert fails.
The following macro has been added:
REQUIRE
An example of when these type of checks are useful:
std::vector<int> v = foo();
REQUIRE(CHECK_EQUAL(3, v.size())); // test stops here on a fail
// so we don't segfault looking at
// v[0] below.
CHECK_EQUAL(1, v[0]);
CHECK_EQUAL(2, v[1]);
CHECK_EQUAL(3, v[2]);
Multiple checks are supported as follows:
REQUIRE({
CHECK_EQUAL(1, 2);
CHECK(true);
};
In the multiple check scenario, all the checks in the REQUIRE block will
be run. After which, if any failures were reported, the TEST case will
be stopped.
When UNITTEST_NO_EXCEPTIONS is defined, REQUIRE is a noop.
* Add some headers to the list of installed files.
* Specify the "foreign" strictness so that automake does not complain
about missing files.
* Specify a directory for m4 macros as suggested by libtoolize.
* Add autotools-generated files to gitignore.