public void testReadString16_UTF8Missing2ndByte() { // Test with bad UTF-8 encoding, missing 2nd byte of two byte value byte[] input = { 0x00, 0x0D, 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xC2, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 }; MemoryStream stream = new MemoryStream(input); EndianBinaryReader reader = new EndianBinaryReader(stream); reader.ReadString16(); }
public void readString16Helper(byte[] input, char[] expect) { MemoryStream stream = new MemoryStream(input); EndianBinaryReader reader = new EndianBinaryReader(stream); char[] result = reader.ReadString16().ToCharArray(); for(int i = 0; i < expect.Length; ++i) { Assert.AreEqual(expect[i], result[i]); } }
public void testReadString16_3byteEncodingMissingLastByte() { // Test with three byte encode that's missing a last byte. byte[] input = { 0x00, 0x02, 0xE8, 0xA8 }; MemoryStream stream = new MemoryStream(input); EndianBinaryReader reader = new EndianBinaryReader(stream); reader.ReadString16(); }