public void MaxLong() { var x = "ffffffffffffffff7f".ToHexBuffer(); Assert.AreEqual(9, Varint.RequiredBytes(long.MaxValue)); CollectionAssert.AreEqual(x, Varint.Encode(long.MaxValue)); Assert.AreEqual(long.MaxValue, Varint.DecodeInt64(x)); }
public void Empty() { var bytes = new byte[0]; ExceptionAssert.Throws <EndOfStreamException>(() => Varint.DecodeInt64(bytes)); }
public void Unterminated() { var bytes = "ff".ToHexBuffer(); ExceptionAssert.Throws <InvalidDataException>(() => Varint.DecodeInt64(bytes)); }
public void TooBig_Int64() { var bytes = "ffffffffffffffffff7f".ToHexBuffer(); ExceptionAssert.Throws <InvalidDataException>(() => Varint.DecodeInt64(bytes)); }
public void Empty() { var bytes = new byte[0]; ExceptionAssert.Throws <InvalidDataException>(() => Varint.DecodeInt64(bytes)); }