From 1e89700693e92bb9c78ace739c71431b74d91e22 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Sun, 3 Nov 2024 13:04:00 -0600 Subject: Rename FudUtf8 to Utf8. --- test/test_utf8.cpp | 82 +++++++++++++++++++++++++++--------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'test/test_utf8.cpp') diff --git a/test/test_utf8.cpp b/test/test_utf8.cpp index e5cb89a..a8e4969 100644 --- a/test/test_utf8.cpp +++ b/test/test_utf8.cpp @@ -65,7 +65,7 @@ constexpr size_t invalidAsciiSize = UINT8_MAX + 1 - validAsciiSize; constexpr size_t numControlChars = 33; constexpr char printableCharOffset = 0x20; -constexpr auto invalidAscii = FudUtf8::invalidAsciiCode.character(); +constexpr auto invalidAscii = Utf8::invalidAsciiCode.character(); auto invalidAsciiGenerator() { @@ -75,7 +75,7 @@ auto invalidAsciiGenerator() template auto toUtf8(T letter) { - return FudUtf8::make(static_cast(letter)); + return Utf8::make(static_cast(letter)); } template @@ -88,18 +88,18 @@ TEST(Utf8Test, Utf8Creation) { const Array threeByte = {THREE_BYTE}; - FudUtf8 utf8Point{FudUtf8::make(threeByte)}; + Utf8 utf8Point{Utf8::make(threeByte)}; ASSERT_NE(utf8Point.data(), nullptr); ASSERT_EQ(utf8Point.size(), 3); ASSERT_NE(utf8Point.hash(), -1); const Array asciiLetter = {'A'}; - utf8Point = FudUtf8::make(asciiLetter); + utf8Point = Utf8::make(asciiLetter); ASSERT_NE(utf8Point.data(), nullptr); ASSERT_EQ(utf8Point.size(), 1); const Array twoByte = {TWO_BYTE}; - utf8Point = FudUtf8::make(twoByte); + utf8Point = Utf8::make(twoByte); ASSERT_NE(utf8Point.data(), nullptr); ASSERT_EQ(utf8Point.size(), 2); ASSERT_NE(utf8Point.hash(), -1); @@ -109,13 +109,13 @@ TEST(Utf8Test, Utf8Creation) static_cast(FOUR_BYTE[1]), static_cast(FOUR_BYTE[2]), static_cast(FOUR_BYTE[3])}; - utf8Point = FudUtf8::make(fourByte); + utf8Point = Utf8::make(fourByte); ASSERT_NE(utf8Point.data(), nullptr); ASSERT_EQ(utf8Point.size(), 4); ASSERT_NE(utf8Point.hash(), -1); const Array invalidBytes = {0xFF, 0xFF, 0xFF, 0xFF}; - utf8Point = FudUtf8::make(invalidBytes); + utf8Point = Utf8::make(invalidBytes); ASSERT_EQ(utf8Point.data(), nullptr); ASSERT_EQ(utf8Point.size(), 0); ASSERT_EQ(utf8Point.hash(), -1); @@ -174,29 +174,29 @@ TEST(Utf8Test, Utf8MultiByte) ASSERT_TRUE(characterOpt.hasValue()); // MULTI_BYTE_LITERAL "test今日素敵はですねƩ®😀z" - const Array multiByteCharacters{ - FudUtf8::make(Utf8Variant{Ascii{'t'}}), - FudUtf8::make(Utf8Variant{Ascii{'e'}}), - FudUtf8::make(Utf8Variant{Ascii{'s'}}), - FudUtf8::make(Utf8Variant{Ascii{'t'}}), - FudUtf8::from(StringView{sizeof("今"), "今"}, 0), - FudUtf8::from(StringView{sizeof("日"), "日"}, 0), - FudUtf8::from(StringView{sizeof("素"), "素"}, 0), - FudUtf8::from(StringView{sizeof("敵"), "敵"}, 0), - FudUtf8::from(StringView{sizeof("は"), "は"}, 0), - FudUtf8::from(StringView{sizeof("で"), "で"}, 0), - FudUtf8::from(StringView{sizeof("す"), "す"}, 0), - FudUtf8::from(StringView{sizeof("ね"), "ね"}, 0), - FudUtf8::from(StringView{sizeof("Ʃ"), "Ʃ"}, 0), - FudUtf8::from(StringView{sizeof("®"), "®"}, 0), - FudUtf8::from(StringView{sizeof("😀"), "😀"}, 0), - FudUtf8::make(Utf8Variant{Ascii{'z'}}), + const Array multiByteCharacters{ + Utf8::make(Utf8Variant{Ascii{'t'}}), + Utf8::make(Utf8Variant{Ascii{'e'}}), + Utf8::make(Utf8Variant{Ascii{'s'}}), + Utf8::make(Utf8Variant{Ascii{'t'}}), + Utf8::from(StringView{sizeof("今"), "今"}, 0), + Utf8::from(StringView{sizeof("日"), "日"}, 0), + Utf8::from(StringView{sizeof("素"), "素"}, 0), + Utf8::from(StringView{sizeof("敵"), "敵"}, 0), + Utf8::from(StringView{sizeof("は"), "は"}, 0), + Utf8::from(StringView{sizeof("で"), "で"}, 0), + Utf8::from(StringView{sizeof("す"), "す"}, 0), + Utf8::from(StringView{sizeof("ね"), "ね"}, 0), + Utf8::from(StringView{sizeof("Ʃ"), "Ʃ"}, 0), + Utf8::from(StringView{sizeof("®"), "®"}, 0), + Utf8::from(StringView{sizeof("😀"), "😀"}, 0), + Utf8::make(Utf8Variant{Ascii{'z'}}), }; size_t idx = 0; while (characterOpt.hasValue()) { auto character = characterOpt.value(); - if (character != FudUtf8{Utf8Variant{Ascii{'\0'}}}) { + if (character != Utf8{Utf8Variant{Ascii{'\0'}}}) { EXPECT_TRUE(character.size() >= 1); ASSERT_LT(idx, multiByteCharacters.size()); EXPECT_EQ(character.size(), multiByteCharacters[idx].size()); @@ -209,7 +209,7 @@ TEST(Utf8Test, Utf8MultiByte) utf8Iter.reset(); ASSERT_TRUE(utf8Iter.next().hasValue()); - FudUtf8 invalid = FudUtf8::invalidAscii(); + Utf8 invalid = Utf8::invalidAscii(); ASSERT_FALSE(invalid.valid()); ASSERT_EQ(invalid.size(), 0); ASSERT_EQ(invalid.data(), nullptr); @@ -228,14 +228,14 @@ TEST(Utf8Test, Utf8IsAscii) ASSERT_FALSE(anyOf([&]() -> Option { return invalidCharIota().map(toLetter); }, static_cast(isAscii))); - FudUtf8 unicode{FudUtf8::invalidAscii()}; + Utf8 unicode{Utf8::invalidAscii()}; ASSERT_FALSE(isAscii(unicode)); charIota.set(0); - ASSERT_TRUE(allOf([&]() -> Option { return charIota().map(toUtf8); }, static_cast(isAscii))); + ASSERT_TRUE(allOf([&]() -> Option { return charIota().map(toUtf8); }, static_cast(isAscii))); invalidCharIota.set(invalidAsciiSize); - ASSERT_FALSE(anyOf([&]() -> Option { return invalidCharIota().map(toUtf8); }, static_cast(isAscii))); + ASSERT_FALSE(anyOf([&]() -> Option { return invalidCharIota().map(toUtf8); }, static_cast(isAscii))); } template @@ -280,7 +280,7 @@ TEST(Utf8Test, Utf8IsAlphanumeric) auto invalidAsciiChars = invalidAsciiGenerator(); ASSERT_FALSE(anyOf(invalidAsciiChars, static_cast(isAlphanumeric))); - ASSERT_FALSE(isAlphanumeric(FudUtf8{Ascii{invalidAscii}})); + ASSERT_FALSE(isAlphanumeric(Utf8{Ascii{invalidAscii}})); auto iotaGenerator = invalidAsciiGenerator(); auto generator = generate( @@ -317,7 +317,7 @@ TEST(Utf8Test, Utf8IsAlpha) auto invalidAsciiChars = invalidAsciiGenerator(); ASSERT_FALSE(anyOf(invalidAsciiChars, static_cast(isAlpha))); - ASSERT_FALSE(isAlpha(FudUtf8{Ascii{invalidAscii}})); + ASSERT_FALSE(isAlpha(Utf8{Ascii{invalidAscii}})); SpanGenerator alphaGenerator{alphaChars.span()}; auto utf8AlphaGenerator = [&]() { return alphaGenerator().map(toUtf8); }; @@ -349,7 +349,7 @@ TEST(Utf8Test, Utf8IsLower) auto invalidAsciiChars = invalidAsciiGenerator(); ASSERT_FALSE(anyOf(invalidAsciiChars, static_cast(isLowercase))); - ASSERT_FALSE(isLowercase(FudUtf8{Ascii{invalidAscii}})); + ASSERT_FALSE(isLowercase(Utf8{Ascii{invalidAscii}})); SpanGenerator lowerGenerator{lowerChars.span()}; auto utf8LowerGenerator = [&]() { return lowerGenerator().map(toUtf8); }; @@ -381,7 +381,7 @@ TEST(Utf8Test, Utf8IsUpper) auto invalidAsciiChars = invalidAsciiGenerator(); ASSERT_FALSE(anyOf(invalidAsciiChars, static_cast(isUppercase))); - ASSERT_FALSE(isUppercase(FudUtf8{Ascii{invalidAscii}})); + ASSERT_FALSE(isUppercase(Utf8{Ascii{invalidAscii}})); SpanGenerator upperGenerator{upperChars.span()}; auto utf8UpperGenerator = [&]() { return upperGenerator().map(toUtf8); }; @@ -413,7 +413,7 @@ TEST(Utf8Test, Utf8IsDigit) auto invalidAsciiChars = invalidAsciiGenerator(); ASSERT_FALSE(anyOf(invalidAsciiChars, static_cast(isDigit))); - ASSERT_FALSE(isDigit(FudUtf8{Ascii{invalidAscii}})); + ASSERT_FALSE(isDigit(Utf8{Ascii{invalidAscii}})); SpanGenerator digitGenerator{digitChars.span()}; auto utf8DigitGenerator = [&]() { return digitGenerator().map(toUtf8); }; @@ -445,7 +445,7 @@ TEST(Utf8Test, Utf8IsHexDigit) auto invalidAsciiChars = invalidAsciiGenerator(); ASSERT_FALSE(anyOf(invalidAsciiChars, static_cast(isHexDigit))); - ASSERT_FALSE(isHexDigit(FudUtf8{Ascii{invalidAscii}})); + ASSERT_FALSE(isHexDigit(Utf8{Ascii{invalidAscii}})); SpanGenerator hexDigitGenerator{hexDigitChars.span()}; auto utf8HexDigitGenerator = [&]() { return hexDigitGenerator().map(toUtf8); }; @@ -477,7 +477,7 @@ TEST(Utf8Test, Utf8IsControl) auto invalidAsciiChars = invalidAsciiGenerator(); ASSERT_FALSE(anyOf(invalidAsciiChars, static_cast(isControl))); - ASSERT_FALSE(isControl(FudUtf8{Ascii{invalidAscii}})); + ASSERT_FALSE(isControl(Utf8{Ascii{invalidAscii}})); SpanGenerator controlGenerator{controlChars.span()}; auto utf8ControlGenerator = [&]() { return controlGenerator().map(toUtf8); }; @@ -512,7 +512,7 @@ TEST(Utf8Test, Utf8IsGraphical) auto invalidAsciiChars = invalidAsciiGenerator(); ASSERT_FALSE(anyOf(invalidAsciiChars, static_cast(isGraphical))); - ASSERT_FALSE(isGraphical(FudUtf8{Ascii{invalidAscii}})); + ASSERT_FALSE(isGraphical(Utf8{Ascii{invalidAscii}})); SpanGenerator graphicalGenerator{graphicalChars.span()}; auto utf8GraphicalGenerator = [&]() { return graphicalGenerator().map(toUtf8); }; @@ -547,7 +547,7 @@ TEST(Utf8Test, Utf8IsSpace) auto invalidAsciiChars = invalidAsciiGenerator(); ASSERT_FALSE(anyOf(invalidAsciiChars, static_cast(isSpace))); - ASSERT_FALSE(isSpace(FudUtf8{Ascii{invalidAscii}})); + ASSERT_FALSE(isSpace(Utf8{Ascii{invalidAscii}})); SpanGenerator spaceGenerator{spaceChars.span()}; auto utf8SpaceGenerator = [&]() { return spaceGenerator().map(toUtf8); }; @@ -582,7 +582,7 @@ TEST(Utf8Test, Utf8IsBlank) auto invalidAsciiChars = invalidAsciiGenerator(); ASSERT_FALSE(anyOf(invalidAsciiChars, static_cast(isBlank))); - ASSERT_FALSE(isBlank(FudUtf8{Ascii{invalidAscii}})); + ASSERT_FALSE(isBlank(Utf8{Ascii{invalidAscii}})); SpanGenerator blankGenerator{blankChars.span()}; auto utf8BlankGenerator = [&]() { return blankGenerator().map(toUtf8); }; @@ -617,7 +617,7 @@ TEST(Utf8Test, Utf8IsPrintable) auto invalidAsciiChars = invalidAsciiGenerator(); ASSERT_FALSE(anyOf(invalidAsciiChars, static_cast(isPrintable))); - ASSERT_FALSE(isPrintable(FudUtf8{Ascii{invalidAscii}})); + ASSERT_FALSE(isPrintable(Utf8{Ascii{invalidAscii}})); SpanGenerator printableGenerator{printableChars.span()}; auto utf8PrintableGenerator = [&]() { return printableGenerator().map(toUtf8); }; @@ -652,7 +652,7 @@ TEST(Utf8Test, Utf8IsPunctuation) auto invalidAsciiChars = invalidAsciiGenerator(); ASSERT_FALSE(anyOf(invalidAsciiChars, static_cast(isPunctuation))); - ASSERT_FALSE(isPunctuation(FudUtf8{Ascii{invalidAscii}})); + ASSERT_FALSE(isPunctuation(Utf8{Ascii{invalidAscii}})); SpanGenerator punctuationGenerator{punctuationChars.span()}; auto utf8PunctuationGenerator = [&]() { return punctuationGenerator().map(toUtf8); }; -- cgit v1.2.3