Dawn/src/dawnshared/assert/assert.cpp
2023-02-07 21:22:57 -08:00

40 lines
720 B
C++

/**
* Copyright (c) 2022 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#include "assert.hpp"
#if ASSERTS_ENABLED == 0
#elif ASSERTS_ENABLED == 1
void assertTrue(bool_t x) {
if(x != true) {
throw "Assertion Failed";
free(0);
}
assert(x == true);
}
void assertFalse(bool_t x) {
assertTrue(!x);
}
void assertUnreachable() {
assertTrue(false);
}
void assertNotNull(void *pointer) {
assertTrue(pointer != nullptr && pointer != NULL);
}
void assertNull(void *pointer) {
assertTrue(pointer == NULL || pointer == nullptr);
}
void assertDeprecated() {
assertUnreachable();
}
#endif