Implements Assert macro.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-03-22 11:14:47 +01:00
parent 5710329f39
commit 0fe488b1c2
2 changed files with 38 additions and 0 deletions

14
tests/AssertTests.cpp Normal file
View File

@@ -0,0 +1,14 @@
#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\""));
}