Пример #1
0
            public void TestIncrementalWithUtf32()
            {
                var      bytes = new byte[] { 0xd8, 0xd9, 0x00, 0x00, 0xda, 0xdb, 0x00, 0x00, 0xdc, 0xdd, 0x00, 0x00, 0xde, 0xdf, 0x00, 0x00 };
                Encoding penc  = new PythonSurrogatePassEncoding(Encoding.UTF32);

                SurrogateTestHelpers.IncrementalTest(penc, bytes, roundTrip: false);
            }
Пример #2
0
            public void TestIncrementalWithUtf8()
            {
                // In UTF-8: Lone high surrogate (invalid), surrogate pair: high-low (valid), lone low surrogate (invalid)
                var      bytes = new byte[] { 0xed, 0xa7, 0x98, 0xed, 0xaf, 0x9a, 0xed, 0xb7, 0x9c, 0xed, 0xbf, 0x9e };
                Encoding penc  = new PythonSurrogatePassEncoding(Encoding.UTF8);

                SurrogateTestHelpers.IncrementalTest(penc, bytes, roundTrip: false);
            }
Пример #3
0
            public void TestIncrementalWithtUtf16()
            {
                // In UTF-16LE: lone low surrogate (invalid) Lone high surrogate (invalid), surrogate pair: high-low (valid),
                var      bytes = new byte[] { 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf };
                Encoding penc  = new PythonSurrogatePassEncoding(Encoding.Unicode);

                SurrogateTestHelpers.IncrementalTest(penc, bytes, roundTrip: false);
            }
Пример #4
0
            public void TestIncrementalWithtPythonAscii()
            {
                // intersperse with ASCII letters
                _bytes = _bytes.SelectMany((b, i) => new[] { (byte)('A' + i), b }).Concat(new[] { (byte)'Z' }).ToArray();
                Encoding penc = new PythonSurrogateEscapeEncoding(PythonAsciiEncoding.Instance);

                SurrogateTestHelpers.IncrementalTest(penc, _bytes, roundTrip: true);
            }
Пример #5
0
            public void TestIncrementalWithUtf32()
            {
                Encoding penc = new PythonSurrogateEscapeEncoding(Encoding.UTF32);

                SurrogateTestHelpers.IncrementalTest(penc, _bytes, roundTrip: true);
            }