mirror of
https://github.com/thunderbrewhq/bc.git
synced 2025-12-12 01:52:30 +00:00
feat(test): add test for assertion handlers
This commit is contained in:
parent
4b14419350
commit
aa22100cbc
1 changed files with 21 additions and 0 deletions
21
test/Debug.cpp
Normal file
21
test/Debug.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
#include "test/Test.hpp"
|
||||||
|
#include "bc/Debug.hpp"
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue