16#include "../core/enum_type.hpp"
18#include "../3rdparty/catch2/catch.hpp"
20#include "../safeguards.h"
22enum TestEnum : int8_t {
28TEST_CASE(
"EnumOverOptimisation_BoundsCheck")
30 TestEnum negative_one =
static_cast<TestEnum
>(-1);
31 CHECK(negative_one < ZERO);
33 TestEnum three =
static_cast<TestEnum
>(3);
37enum class TestEnumFlags : uint8_t {
44TEST_CASE(
"EnumOverOptimisation_Bitmask")
46 TestEnumFlags three = TestEnumFlags::One | TestEnumFlags::Two;
47 CHECK(
HasFlag(three, TestEnumFlags::One));
48 CHECK(
HasFlag(three, TestEnumFlags::Two));
#define DECLARE_ENUM_AS_BIT_SET(enum_type)
Operators to allow to work with enum as with type safe bit set in C++.
debug_inline constexpr bool HasFlag(const T x, const T y)
Checks if a value in a bitset enum is set.