Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        public void Empty()
        {
            var bytes = new byte[0];

            ExceptionAssert.Throws <EndOfStreamException>(() => Varint.DecodeInt64(bytes));
        }
Esempio n. 3
0
        public void Unterminated()
        {
            var bytes = "ff".ToHexBuffer();

            ExceptionAssert.Throws <InvalidDataException>(() => Varint.DecodeInt64(bytes));
        }
Esempio n. 4
0
        public void TooBig_Int64()
        {
            var bytes = "ffffffffffffffffff7f".ToHexBuffer();

            ExceptionAssert.Throws <InvalidDataException>(() => Varint.DecodeInt64(bytes));
        }
Esempio n. 5
0
        public void Empty()
        {
            var bytes = new byte[0];

            ExceptionAssert.Throws <InvalidDataException>(() => Varint.DecodeInt64(bytes));
        }