RingRacers/src/tests/boolcompat.cpp
Eidolon 6af003771d Add SRB2_ASSERT, srb2::NotNull<T>
Add SRB2_ASSERT, superceding I_Assert

This assertion macro always expands to a call of srb2::do_assert, which
is overloaded with two templates: one which applies if the provided
Level is less than or equal to the SRB2_ASSERTION_LEVEL, and one which
is a no-op. When optimizations are enabled, this will verifiably remove
the evaluation of the expression in all cases, instead of evaluating the
expression and doing nothing with it.

Add srb2::NotNull wrapper utility

This is meant to be used in places where pointers are used as
parameters. It can be used with any pointer-like type, not just raw
pointers. During construction of NotNull, the pointer will be asserted
not-null in debug and paranoia builds, and in release optimizations with
no assertions, the code decays gracefully to standard pointer-passing.
2022-12-30 23:49:29 -06:00

9 lines
241 B
C++

#include "testbase.hpp"
#include <catch2/catch_test_macros.hpp>
#include "../doomtype.h"
TEST_CASE("C++ bool is convertible to doomtype.h boolean") {
REQUIRE(static_cast<boolean>(true) == 1);
REQUIRE(static_cast<boolean>(false) == 0);
}