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)); }
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); }
public void Automaton() { var data = CreateBytes(CodePoint, Length); for (int i = 0; i < LoopNum; i++) { Utf8AutoMatonDecoder.GetStringFromUtf8(data, 0, data.Length); } }
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); } }