58 lines
1.1 KiB
C++
58 lines
1.1 KiB
C++
/**
|
|
* Copyright (c) 2022 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#pragma once
|
|
#include "dawnlibs.hpp"
|
|
|
|
#define ASSERTS_ENABLED 1
|
|
|
|
#if ASSERTS_ENABLED == 0
|
|
|
|
static inline void assertTrue(bool_t x) {}
|
|
|
|
#elif ASSERTS_ENABLED == 1
|
|
|
|
/**
|
|
* Assert a given value to be true.
|
|
* @param x Value to assert as true.
|
|
*/
|
|
void assertTrue(bool_t x);
|
|
|
|
/**
|
|
* Asserts a given statement to be false.
|
|
* @param x Value to assert as false.
|
|
*/
|
|
void assertFalse(bool_t x);
|
|
|
|
/**
|
|
* Asserts that a given line of code is unreachable. Essentially a forced
|
|
* assertion failure, good for "edge cases"
|
|
*/
|
|
void assertUnreachable();
|
|
|
|
/**
|
|
* Assert a given pointer to not point to a null pointer.
|
|
* @param pointer Pointer to assert is not a null pointer.
|
|
*/
|
|
void assertNotNull(void *pointer);
|
|
|
|
/**
|
|
* Asserts a given pointer to be a nullptr.
|
|
* @param pointer Pointer to assert is nullptr.
|
|
*/
|
|
void assertNull(void *pointer);
|
|
|
|
/**
|
|
* Asserts a function as being deprecated.
|
|
*/
|
|
void assertDeprecated();
|
|
|
|
#else
|
|
|
|
#define assertTrue assert
|
|
|
|
#endif |