Beispiel #1
0
        public static void IsWhiteSpace_AllInputs()
        {
            // This tests calls Rune.IsWhiteSpace for every possible input, ensuring that
            // the runtime agrees with the data in the core Unicode files.

            foreach (Rune rune in AllRunes())
            {
                Assert.Equal(UnicodeData.IsWhiteSpace(rune.Value), Rune.IsWhiteSpace(rune));
            }
        }
Beispiel #2
0
        public static void IsWhiteSpace_Char_AllInputs()
        {
            // This tests calls char.IsWhiteSpace for every possible input, ensuring that
            // the runtime agrees with the data in the core Unicode files.

            for (uint i = 0; i <= char.MaxValue; i++)
            {
                if (UnicodeData.IsWhiteSpace(i) != char.IsWhiteSpace((char)i))
                {
                    // We'll build up the exception message ourselves so the dev knows what code point failed.
                    throw new AssertActualExpectedException(
                              expected: UnicodeData.IsWhiteSpace(i),
                              actual: char.IsWhiteSpace((char)i),
                              userMessage: FormattableString.Invariant($@"char.IsWhiteSpace('\u{i:X4}') returned wrong value."));
                }
            }
        }