More fixes for Assert.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
2d4cc2cd80
commit
aa1b90554f
|
@ -6,14 +6,12 @@
|
|||
|
||||
#ifndef NO_ASSERT
|
||||
#define Assert(expr) \
|
||||
{ \
|
||||
if (!(expr)) { \
|
||||
std::stringstream ss; \
|
||||
ss << "ASSERTION FAILED: [" << __FILENAME__ << " (" << __LINE__ << ")] \""; \
|
||||
ss << #expr << "\""; \
|
||||
throw std::logic_error(ss.str()); \
|
||||
} \
|
||||
};
|
||||
if (!(expr)) { \
|
||||
std::stringstream ss; \
|
||||
ss << "ASSERTION FAILED: [" << __FILENAME__ << " (" << __LINE__ << ")] \""; \
|
||||
ss << #expr << "\""; \
|
||||
throw std::logic_error(ss.str()); \
|
||||
}
|
||||
#else
|
||||
// Assert is empty if NO_ASSERT is defined.
|
||||
#define Assert(expr)
|
||||
|
|
|
@ -14,4 +14,11 @@ TEST_CASE("Assert throws if false with message", "[Utilities]") {
|
|||
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)); }
|
||||
|
|
Loading…
Reference in New Issue