RingRacers/src/tests/testbase.hpp
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

6 lines
164 B
C++

#ifndef __SRB2_TESTS_TESTBASE_HPP__
#define __SRB2_TESTS_TESTBASE_HPP__
#define SRB2_ASSERT_HANDLER srb2::NoOpAssertHandler
#endif // __SRB2_TESTS_TESTBASE_HPP__