diff options
author | Jordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com> | 2019-12-04 01:32:25 +0300 |
---|---|---|
committer | Jordan Maples [MSFT] <49793787+JordanMaples@users.noreply.github.com> | 2019-12-04 01:32:25 +0300 |
commit | 2b10729386062479641951e822e4257066655863 (patch) | |
tree | 8a6888152a800ecee4d5be08ebaf08c6e31f8eff /tests/assertion_tests.cpp | |
parent | 7e99e76c9761d0d0b0848b91f8648830670ee872 (diff) |
gtest migration
Diffstat (limited to 'tests/assertion_tests.cpp')
-rw-r--r-- | tests/assertion_tests.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/assertion_tests.cpp b/tests/assertion_tests.cpp index 0c509ad..6aa3830 100644 --- a/tests/assertion_tests.cpp +++ b/tests/assertion_tests.cpp @@ -20,33 +20,37 @@ #pragma warning(disable : 26440 26426) // from catch #endif -#include <catch/catch.hpp> // for AssertionHandler, StringRef, CHECK, CHECK... +#include <gtest/gtest.h> #include <gsl/gsl_assert> // for fail_fast (ptr only), Ensures, Expects using namespace gsl; +namespace +{ int f(int i) { Expects(i > 0 && i < 10); return i; } -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; } +} // namespace + +TEST(assertion_tests, expects) +{ + EXPECT_EQ(f(2), 2); + EXPECT_DEATH(f(10), ".*"); +} + -TEST_CASE("ensures") +TEST(assertion_tests, ensures) { - CHECK(g(2) == 3); - CHECK_THROWS_AS(g(9), fail_fast); + EXPECT_EQ(g(2), 3); + EXPECT_DEATH(g(9), ".*"); } |