public void ReadUnalignedBytes() { var tapedate = new byte[] { 0x01, 0x02, 0x10, 0x20, 0xaa, 0x55 }; var expected = new byte[] { 0x08, 0x10, 0x81, 0x05, 0x52 }; var tape = new CasTape(new MemoryStream(tapedate)); tape.ReadBit(); tape.ReadBit(); tape.ReadBit(); foreach (var b in expected) { Assert.Equal(b, tape.ReadByte()); } }
public void ReadBits() { var tapedata = new byte[] { 0x01, 0x02, 0x10, 0x20, 0xaa, 0x55 }; var expected = new bool[] { false, false, false, false, false, false, false, true, false, false, false, false, false, false, true, false, false, false, false, true, false, false, false, false, false, false, true, false, false, false, false, false, true, false, true, false, true, false, true, false, false, true, false, true, false, true, false, true }; var tape = new CasTape(new MemoryStream(tapedata)); foreach (var b in expected) { Assert.Equal(b, tape.ReadBit()); } }