Example #1
0
        public void UnsignedDecodeMax()
        {
            var coder = new HeliumIntegerUnsigned(0, false, 1, 0);

            coder.Prepare(typeof(UInt64));
            var decoded = coder.Decode(new DecodeBuffer(UnsignedVlq.Encode(UnsignedVlq.MaxValue).ToArray()));

            Assert.Equal(UnsignedVlq.MaxValue, decoded);
        }
Example #2
0
        public void UnsignedDecodeNullableNull()
        {
            var coder = new HeliumIntegerUnsigned(0, true, 1, 0);

            coder.Prepare(typeof(UInt32?));
            var decoded = coder.Decode(new DecodeBuffer(UnsignedVlq.Encode(0).ToArray()));

            Assert.Equal((UInt32?)null, decoded);
        }
Example #3
0
        public void UnsignedDecodeMin()
        {
            var coder = new HeliumIntegerUnsigned(0, false, 1, 0);

            coder.Prepare(typeof(UInt32));
            var decoded = coder.Decode(new DecodeBuffer(UnsignedVlq.Encode(0).ToArray()));

            Assert.Equal((UInt32)0, decoded);
        }
Example #4
0
        public void UnsignedDecodeMinimumIncrement2()
        {
            var coder = new HeliumIntegerUnsigned(0, false, 10, 20);

            coder.Prepare(typeof(UInt32));
            var decoded = coder.Decode(new DecodeBuffer(new byte[] {
                0x0D
            }));

            Assert.Equal((UInt32)150, decoded);
        }