Move from unittest-cpp to catch for unit testing. (#533)

Many thanks to @rianquinn. This should fix #495, #494 and #529.
This commit is contained in:
Neil MacIntosh
2017-07-13 13:53:56 -07:00
committed by GitHub
parent 1f87ef73f1
commit b2ee484334
24 changed files with 4315 additions and 4292 deletions
+22 -27
View File
@@ -14,38 +14,33 @@
//
///////////////////////////////////////////////////////////////////////////////
#include <UnitTest++/UnitTest++.h>
#include <catch/catch.hpp>
#include <gsl/gsl>
using namespace gsl;
SUITE(assertion_tests)
int f(int i)
{
int f(int i)
{
Expects(i > 0 && i < 10);
return i;
}
TEST(expects)
{
CHECK(f(2) == 2);
CHECK_THROW(f(10), fail_fast);
}
int g(int i)
{
i++;
Ensures(i > 0 && i < 10);
return i;
}
TEST(ensures)
{
CHECK(g(2) == 3);
CHECK_THROW(g(9), fail_fast);
}
Expects(i > 0 && i < 10);
return i;
}
int main(int, const char* []) { return UnitTest::RunAllTests(); }
TEST_CASE("expects")
{
CHECK(f(2) == 2);
CHECK_THROWS_AS(f(10), fail_fast);
}
int g(int i)
{
i++;
Ensures(i > 0 && i < 10);
return i;
}
TEST_CASE("ensures")
{
CHECK(g(2) == 3);
CHECK_THROWS_AS(g(9), fail_fast);
}