From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- mfbt/tests/TestEnumeratedArray.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'mfbt/tests') diff --git a/mfbt/tests/TestEnumeratedArray.cpp b/mfbt/tests/TestEnumeratedArray.cpp index dfc1a37f17..d5ec9ebbb3 100644 --- a/mfbt/tests/TestEnumeratedArray.cpp +++ b/mfbt/tests/TestEnumeratedArray.cpp @@ -4,17 +4,25 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "mozilla/ArrayUtils.h" #include "mozilla/EnumeratedArray.h" +#include "mozilla/EnumTypeTraits.h" using mozilla::EnumeratedArray; -enum class AnimalSpecies { Cow, Sheep, Pig, Count }; +enum class AnimalSpecies { Cow, Sheep, Pig }; -using TestArray = EnumeratedArray; +template <> +struct mozilla::MaxContiguousEnumValue { + static constexpr AnimalSpecies value = AnimalSpecies::Pig; +}; + +using TestArray = EnumeratedArray; void TestInitialValueByConstructor() { // Style 1 TestArray headCount(1, 2, 3); + MOZ_RELEASE_ASSERT(mozilla::ArrayLength(headCount) == 3); MOZ_RELEASE_ASSERT(headCount[AnimalSpecies::Cow] == 1); MOZ_RELEASE_ASSERT(headCount[AnimalSpecies::Sheep] == 2); MOZ_RELEASE_ASSERT(headCount[AnimalSpecies::Pig] == 3); -- cgit v1.2.3