public void NegativeEncode() { var varint = new VarInt32(-1); Assert.That(varint.GetEncodedValue(), Is.EqualTo(new byte[] { 0xff, 0xff, 0xff, 0xff, 0xf })); varint = new VarInt32(int.MinValue); Assert.That(varint.GetEncodedValue(), Is.EqualTo(new byte[] { 0x80, 0x80, 0x80, 0x80, 0x8 })); }
public void QuadByteEncode() { var varint = new VarInt32(0x200000); Assert.That(varint.GetEncodedValue(), Is.EqualTo(new byte[] { 0x80, 0x80, 0x80, 0x01 })); varint = new VarInt32(0xfffffff); Assert.That(varint.GetEncodedValue(), Is.EqualTo(new byte[] { 0xff, 0xff, 0xff, 0x7f })); }
public void FullByteEncode() { var varint = new VarInt32(0x10000000); Assert.That(varint.GetEncodedValue(), Is.EqualTo(new byte[] { 0x80, 0x80, 0x80, 0x80, 0x01 })); varint = new VarInt32(int.MaxValue); Assert.That(varint.GetEncodedValue(), Is.EqualTo(new byte[] { 0xff, 0xff, 0xff, 0xff, 0x7 })); }