Arbutils/tests/AssertTests.cpp

15 lines
545 B
C++
Raw Normal View History

2020-03-22 10:14:47 +00:00
#include "../extern/catch.hpp"
#include "../src/Assert.hpp"
void TestWrapper(bool wrapperExpression){Assert(wrapperExpression)}
TEST_CASE("Assert succeeds if true", "[Utilities]") {
REQUIRE_NOTHROW(TestWrapper(true));
}
TEST_CASE("Assert throws if false", "[Utilities]") { REQUIRE_THROWS(TestWrapper(false)); }
TEST_CASE("Assert throws if false with message", "[Utilities]") {
REQUIRE_THROWS_WITH(TestWrapper(false),
Catch::Matchers::Equals("ASSERTION FAILED: [AssertTests.cpp (3)] \"wrapperExpression\""));
}