22 lines
817 B
C++
22 lines
817 B
C++
#include "../extern/catch.hpp"
|
|
#include "../src/Assert.hpp"
|
|
void TestWrapper(bool wrapperExpression) { Assert(wrapperExpression) }
|
|
void TestWrapperNotNull(void* value) { AssertNotNull(value) }
|
|
|
|
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\""));
|
|
}
|
|
|
|
TEST_CASE("Multiple asserts", "[Utilities]") {
|
|
Assert(true)
|
|
Assert(true)
|
|
Assert(true)
|
|
}
|
|
|
|
TEST_CASE("AssertNotNull throws if nullptr", "[Utilities]") { REQUIRE_THROWS(TestWrapperNotNull(nullptr)); }
|