35JUCE_DECLARE_SCOPED_ENUM_BITWISE_OPERATORS (TestEnum)
38class EnumHelperTest final :
public UnitTest
41 EnumHelperTest() :
UnitTest (
"EnumHelpers", UnitTestCategories::containers) {}
45 using detail::TestEnum;
49 beginTest (
"Default initialised enum is 'none'");
52 expect (! hasBitValueSet (e, TestEnum{}));
55 beginTest (
"withBitValueSet sets correct bit on empty enum");
57 e = withBitValueSet (e, TestEnum::other);
58 expect (e == TestEnum::other);
59 expect (hasBitValueSet (e, TestEnum::other));
62 beginTest (
"withBitValueSet sets correct bit on non-empty enum");
64 e = withBitValueSet (e, TestEnum::one);
65 expect (hasBitValueSet (e, TestEnum::one));
68 beginTest (
"withBitValueCleared clears correct bit");
70 e = withBitValueCleared (e, TestEnum::one);
71 expect (e != TestEnum::one);
72 expect (hasBitValueSet (e, TestEnum::other));
73 expect (! hasBitValueSet (e, TestEnum::one));
79 expect ((e & TestEnum::one) != TestEnum{});
81 expect ((e & TestEnum::other) != TestEnum{});
84 expect ((e & TestEnum::one) == TestEnum{});
85 expect ((e & TestEnum::other) != TestEnum{});
90static EnumHelperTest enumHelperTest;
UnitTest(const String &name, const String &category=String())
void beginTest(const String &testName)
void expect(bool testResult, const String &failureMessage=String())