コード例 #1
0
        public void AutoMatonU10FFFF()
        {
            var expected = new char[] { (char)0xdbc0, (char)0xdc00, (char)0xdbc0, (char)0xdc30, (char)0xdbff, (char)0xdfff };
            var bytes    = Encoding.UTF8.GetBytes(expected);
            var actual   = Utf8AutoMatonDecoder.GetStringFromUtf8(bytes, 0, bytes.Length).ToArray();

            Assert.Equal(expected.Select(x => (int)x), actual.Select(x => (int)x));
        }
コード例 #2
0
        public void AutoMatonU7F()
        {
            var expected = new char[] { (char)0x00, (char)0x7f, (char)0x3f };
            var bytes    = Encoding.UTF8.GetBytes(expected);
            var actual   = Utf8AutoMatonDecoder.GetStringFromUtf8(bytes, 0, bytes.Length).ToArray();

            Assert.Equal(expected, actual);
        }
コード例 #3
0
        public void Automaton()
        {
            var data = CreateBytes(CodePoint, Length);

            for (int i = 0; i < LoopNum; i++)
            {
                Utf8AutoMatonDecoder.GetStringFromUtf8(data, 0, data.Length);
            }
        }
コード例 #4
0
        public void AutoMatonLong()
        {
            var expected = Enumerable.Range(0, 256).Select(x => (char)0x12).ToArray();
            var bytes    = Encoding.UTF8.GetBytes(expected);

            for (int i = 0; i < 2; i++)
            {
                var actual = Utf8AutoMatonDecoder.GetStringFromUtf8(bytes, 0, bytes.Length).ToArray();
                Assert.Equal(expected, actual);
            }
        }