1 #define CATCH_CONFIG_MAIN 2 #include <catch2/catch.hpp> 3 4 TEST_CASE("Tests that run") { 5 // All of these should be run and be reported 6 CHECK(1 == 2); 7 CHECK(1 == 1); 8 CHECK(1 != 3); 9 CHECK(1 == 4); 10 } 11 12 13 14 TEST_CASE("Tests that abort") { 15 // Avoid abort and other exceptional exits -- there is no way 16 // to tell CMake that abort is the desired outcome of a test. __anon889dc0600102()17 std::set_terminate([](){exit(1);}); 18 REQUIRE(1 == 1); 19 REQUIRE(1 != 2); 20 REQUIRE(1 == 3); 21 // We should not get here, because the test above aborts 22 REQUIRE(1 != 4); 23 } 24