示例#1
0
        public static void Fold_String_By_Char()
        {
            for (int i = 0; i <= 0xffff; i++)
            {
                var expected = i;
                if (CharUnicodeInfoTestData.CaseFoldingPairs.TryGetValue((char)i, out int foldedCharOut))
                {
                    expected = foldedCharOut;
                }

                var foldedChar = (int)SimpleCaseFolding.SimpleCaseFold((char)i);
                Assert.Equal(((char)expected).ToString(), ((char)foldedChar).ToString());
            }
        }
示例#2
0
        public static void Fold_Char_Surrogate()
        {
            for (int i = 0x10000; i <= 0x1ffff; i++)
            {
                var expected = i;
                if (CharUnicodeInfoTestData.CaseFoldingPairs.TryGetValue(i, out int foldedOut))
                {
                    expected = foldedOut;
                }

                var expectedString = Char.ConvertFromUtf32(expected);
                var value          = Char.ConvertFromUtf32(i);
                var foldedString   = SimpleCaseFolding.SimpleCaseFold(value);
                Assert.Equal(expectedString, foldedString);
            }
        }