From aa22100cbcb447ed69337134f6c735cde3d51a9d Mon Sep 17 00:00:00 2001 From: superp00t Date: Sun, 30 Mar 2025 23:35:13 -0400 Subject: [PATCH] feat(test): add test for assertion handlers --- test/Debug.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/Debug.cpp diff --git a/test/Debug.cpp b/test/Debug.cpp new file mode 100644 index 0000000..05d40e9 --- /dev/null +++ b/test/Debug.cpp @@ -0,0 +1,21 @@ +#include "test/Test.hpp" +#include "bc/Debug.hpp" +#include + +#if defined(WHOA_BUILD_ASSERTIONS) + +static bool s_assertion_failed = false; + +void AssertCallback(const char* a1, const char* a2, const char* a3, uint32_t a4) { + s_assertion_failed = true; +} + + +TEST_CASE("BC_ASSERT", "[debug]") { + SECTION("assertion fails when evaluating boolean expression") { + BC_ASSERT(0); + REQUIRE(s_assertion_failed); + } +} + +#endif