Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil MacIntosh <neilmac@microsoft.com>2017-07-13 23:53:56 +0300
committerGitHub <noreply@github.com>2017-07-13 23:53:56 +0300
commitb2ee48433448556a7be63074f8aaf45ab47a95c1 (patch)
treedf94d91f17334f50c33dfea4763f3b4b282f5f85 /tests/assertion_tests.cpp
parent1f87ef73f1477e8adafa8b10ccee042897612a20 (diff)
Move from unittest-cpp to catch for unit testing. (#533)
Many thanks to @rianquinn. This should fix #495, #494 and #529.
Diffstat (limited to 'tests/assertion_tests.cpp')
-rw-r--r--tests/assertion_tests.cpp45
1 files changed, 20 insertions, 25 deletions
diff --git a/tests/assertion_tests.cpp b/tests/assertion_tests.cpp
index b817a6d..42966d1 100644
--- a/tests/assertion_tests.cpp
+++ b/tests/assertion_tests.cpp
@@ -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);
- }
+ Expects(i > 0 && i < 10);
+ return i;
+}
- int g(int i)
- {
- i++;
- Ensures(i > 0 && i < 10);
- return i;
- }
+TEST_CASE("expects")
+{
+ CHECK(f(2) == 2);
+ CHECK_THROWS_AS(f(10), fail_fast);
+}
- TEST(ensures)
- {
- CHECK(g(2) == 3);
- CHECK_THROW(g(9), fail_fast);
- }
+int g(int i)
+{
+ i++;
+ Ensures(i > 0 && i < 10);
+ return i;
}
-int main(int, const char* []) { return UnitTest::RunAllTests(); }
+TEST_CASE("ensures")
+{
+ CHECK(g(2) == 3);
+ CHECK_THROWS_AS(g(9), fail_fast);
+}