#include #include #define TL_ASSERT(cond) if (!(cond)) { throw std::runtime_error(std::string("assertion failure")); } #include TEST_CASE("Assertions", "[assertions]") { tl::expected o1 = 42; REQUIRE_THROWS_WITH(o1.error(), "assertion failure"); tl::expected o2 {tl::unexpect, 0}; REQUIRE_THROWS_WITH(*o2, "assertion failure"); struct foo { int bar; }; tl::expected o3 {tl::unexpect, 0}; REQUIRE_THROWS_WITH(o3->bar, "assertion failure"); }