public void TestReadSByte() { using (var cfile = new CFile(BuildStream("èaà\nüî"))) { Assert.Equal(-61, cfile.ReadSByte()); Assert.Equal(-88, cfile.ReadSByte()); Assert.Equal(97, cfile.ReadSByte()); Assert.Equal(-61, cfile.ReadSByte()); Assert.Equal(-96, cfile.ReadSByte()); Assert.Equal(10, cfile.ReadSByte()); Assert.Equal(-61, cfile.ReadSByte()); Assert.Equal(-68, cfile.ReadSByte()); Assert.Equal(-61, cfile.ReadSByte()); Assert.Equal(-82, cfile.ReadSByte()); Assert.Equal(0, cfile.ReadSByte()); Assert.Equal(0, cfile.ReadSByte()); Assert.Equal(true, cfile.EOF); } #if !NET_STANDARD using (var cfile = new CFile(BuildStream("èaà\nüî", Encoding.GetEncoding("windows-1252")))) { Assert.Equal(-24, cfile.ReadSByte()); Assert.Equal(97, cfile.ReadSByte()); Assert.Equal(-32, cfile.ReadSByte()); Assert.Equal(10, cfile.ReadSByte()); Assert.Equal(-4, cfile.ReadSByte()); Assert.Equal(-18, cfile.ReadSByte()); Assert.Equal(0, cfile.ReadSByte()); Assert.Equal(true, cfile.EOF); } #endif using (var cfile = new CFile(BuildStream("èaà\nüî"), Encoding.UTF8)) { Assert.Equal(-61, cfile.ReadSByte()); Assert.Equal(-88, cfile.ReadSByte()); Assert.Equal(97, cfile.ReadSByte()); Assert.Equal(-61, cfile.ReadSByte()); Assert.Equal(-96, cfile.ReadSByte()); Assert.Equal(10, cfile.ReadSByte()); Assert.Equal(-61, cfile.ReadSByte()); Assert.Equal(-68, cfile.ReadSByte()); Assert.Equal(-61, cfile.ReadSByte()); Assert.Equal(-82, cfile.ReadSByte()); Assert.Equal(0, cfile.ReadSByte()); Assert.Equal(true, cfile.EOF); } #if !NET_STANDARD using (var cfile = new CFile(BuildStream("èaà\nüî", Encoding.GetEncoding("windows-1252")), Encoding.GetEncoding("windows-1252"))) { Assert.Equal(-24, cfile.ReadSByte()); Assert.Equal(97, cfile.ReadSByte()); Assert.Equal(-32, cfile.ReadSByte()); Assert.Equal(10, cfile.ReadSByte()); Assert.Equal(-4, cfile.ReadSByte()); Assert.Equal(-18, cfile.ReadSByte()); Assert.Equal(0, cfile.ReadSByte()); Assert.Equal(true, cfile.EOF); } using (var cfile = new CFile(BuildStream("èaà\nüî", Encoding.UTF8), Encoding.GetEncoding("windows-1252"))) { Assert.Equal(-61, cfile.ReadSByte()); Assert.Equal(-88, cfile.ReadSByte()); Assert.Equal(97, cfile.ReadSByte()); Assert.Equal(-61, cfile.ReadSByte()); Assert.Equal(-96, cfile.ReadSByte()); Assert.Equal(10, cfile.ReadSByte()); Assert.Equal(-61, cfile.ReadSByte()); Assert.Equal(-68, cfile.ReadSByte()); Assert.Equal(-61, cfile.ReadSByte()); Assert.Equal(-82, cfile.ReadSByte()); Assert.Equal(0, cfile.ReadSByte()); Assert.Equal(0, cfile.ReadSByte()); Assert.Equal(true, cfile.EOF); } #endif using (var cfile = new CFile(BuildStream(new byte[] { 0, 0x01, 0x10, 0x80, 0xF0, 0xFF }))) { Assert.Equal(0, cfile.ReadSByte()); Assert.Equal(1, cfile.ReadSByte()); Assert.Equal(16, cfile.ReadSByte()); Assert.Equal(-128, cfile.ReadSByte()); Assert.Equal(-16, cfile.ReadSByte()); Assert.Equal(-1, cfile.ReadSByte()); Assert.Equal(0, cfile.ReadSByte()); Assert.Equal(0, cfile.ReadSByte()); Assert.Equal(true, cfile.EOF); } }
public void TestReadSByte() { using (var cfile = new CFile(BuildStream("èaà\nüî"))) { Assert.AreEqual(-61, cfile.ReadSByte()); Assert.AreEqual(-88, cfile.ReadSByte()); Assert.AreEqual(97, cfile.ReadSByte()); Assert.AreEqual(-61, cfile.ReadSByte()); Assert.AreEqual(-96, cfile.ReadSByte()); Assert.AreEqual(10, cfile.ReadSByte()); Assert.AreEqual(-61, cfile.ReadSByte()); Assert.AreEqual(-68, cfile.ReadSByte()); Assert.AreEqual(-61, cfile.ReadSByte()); Assert.AreEqual(-82, cfile.ReadSByte()); Assert.AreEqual(0, cfile.ReadSByte()); Assert.AreEqual(0, cfile.ReadSByte()); Assert.AreEqual(true, cfile.EOF); } using (var cfile = new CFile(BuildStream("èaà\nüî", Encoding.GetEncoding("windows-1252")))) { Assert.AreEqual(-24, cfile.ReadSByte()); Assert.AreEqual(97, cfile.ReadSByte()); Assert.AreEqual(-32, cfile.ReadSByte()); Assert.AreEqual(10, cfile.ReadSByte()); Assert.AreEqual(-4, cfile.ReadSByte()); Assert.AreEqual(-18, cfile.ReadSByte()); Assert.AreEqual(0, cfile.ReadSByte()); Assert.AreEqual(true, cfile.EOF); } using (var cfile = new CFile(BuildStream("èaà\nüî"), Encoding.UTF8)) { Assert.AreEqual(-61, cfile.ReadSByte()); Assert.AreEqual(-88, cfile.ReadSByte()); Assert.AreEqual(97, cfile.ReadSByte()); Assert.AreEqual(-61, cfile.ReadSByte()); Assert.AreEqual(-96, cfile.ReadSByte()); Assert.AreEqual(10, cfile.ReadSByte()); Assert.AreEqual(-61, cfile.ReadSByte()); Assert.AreEqual(-68, cfile.ReadSByte()); Assert.AreEqual(-61, cfile.ReadSByte()); Assert.AreEqual(-82, cfile.ReadSByte()); Assert.AreEqual(0, cfile.ReadSByte()); Assert.AreEqual(true, cfile.EOF); } using (var cfile = new CFile(BuildStream("èaà\nüî", Encoding.GetEncoding("windows-1252")), Encoding.GetEncoding("windows-1252"))) { Assert.AreEqual(-24, cfile.ReadSByte()); Assert.AreEqual(97, cfile.ReadSByte()); Assert.AreEqual(-32, cfile.ReadSByte()); Assert.AreEqual(10, cfile.ReadSByte()); Assert.AreEqual(-4, cfile.ReadSByte()); Assert.AreEqual(-18, cfile.ReadSByte()); Assert.AreEqual(0, cfile.ReadSByte()); Assert.AreEqual(true, cfile.EOF); } using (var cfile = new CFile(BuildStream("èaà\nüî", Encoding.UTF8), Encoding.GetEncoding("windows-1252"))) { Assert.AreEqual(-61, cfile.ReadSByte()); Assert.AreEqual(-88, cfile.ReadSByte()); Assert.AreEqual(97, cfile.ReadSByte()); Assert.AreEqual(-61, cfile.ReadSByte()); Assert.AreEqual(-96, cfile.ReadSByte()); Assert.AreEqual(10, cfile.ReadSByte()); Assert.AreEqual(-61, cfile.ReadSByte()); Assert.AreEqual(-68, cfile.ReadSByte()); Assert.AreEqual(-61, cfile.ReadSByte()); Assert.AreEqual(-82, cfile.ReadSByte()); Assert.AreEqual(0, cfile.ReadSByte()); Assert.AreEqual(0, cfile.ReadSByte()); Assert.AreEqual(true, cfile.EOF); } using (var cfile = new CFile(BuildStream(new byte[] { 0, 0x01, 0x10, 0x80, 0xF0, 0xFF }))) { Assert.AreEqual(0, cfile.ReadSByte()); Assert.AreEqual(1, cfile.ReadSByte()); Assert.AreEqual(16, cfile.ReadSByte()); Assert.AreEqual(-128, cfile.ReadSByte()); Assert.AreEqual(-16, cfile.ReadSByte()); Assert.AreEqual(-1, cfile.ReadSByte()); Assert.AreEqual(0, cfile.ReadSByte()); Assert.AreEqual(0, cfile.ReadSByte()); Assert.AreEqual(true, cfile.EOF); } }