From 5f3e6085a215ed05be84b444468743fb9b232bd9 Mon Sep 17 00:00:00 2001 From: Timothy Date: Wed, 14 Jul 2021 10:20:41 +1000 Subject: [PATCH] AK/Tests: Add test for EnumBits has_any_flag() This test will pass when any flag in the mask is present in the value. --- Tests/AK/TestEnumBits.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Tests/AK/TestEnumBits.cpp b/Tests/AK/TestEnumBits.cpp index f49e13b2635..bb53857e345 100644 --- a/Tests/AK/TestEnumBits.cpp +++ b/Tests/AK/TestEnumBits.cpp @@ -68,3 +68,11 @@ TEST_CASE(has_flag) EXPECT(!has_flag(intro, VideoIntro::Well)); EXPECT(!has_flag(intro, VideoIntro::CompleteIntro)); } + +TEST_CASE(has_any_flag) +{ + auto intro = VideoIntro::Hello | VideoIntro::Friends; + EXPECT(has_any_flag(intro, VideoIntro::Friends)); + EXPECT(!has_any_flag(intro, VideoIntro::Well)); + EXPECT(has_any_flag(intro, VideoIntro::CompleteIntro)); +}