Example #1
0
 public void SignedDecodeUnsupported()
 {
     Assert.Throws <UnsupportedDataTypeException>(() => {
         var coder = new HeliumIntegerSigned(0, false, 10);
         coder.Prepare(typeof(Int32));
         var decoded = coder.Decode(new DecodeBuffer(new Byte[] { 0, 0, 0 }));
     });
 }
Example #2
0
        public void SignedDecodeNullableNull()
        {
            var coder = new HeliumIntegerSigned(0, true);

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

            Assert.Equal((Int32?)null, decoded);
        }
Example #3
0
        public void SignedDecodeNullableMin()
        {
            var coder = new HeliumIntegerSigned(0, true, 1);

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

            Assert.Equal(UnsignedVlq.MinValue + 1, decoded);
        }
Example #4
0
        public void SignedDecodeMax()
        {
            var coder = new HeliumIntegerSigned(0, false, 1);

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

            Assert.Equal(UnsignedVlq.MaxValue, decoded);
        }
Example #5
0
        public void SignedDecodeZero()
        {
            var coder = new HeliumIntegerSigned(0, false);

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

            Assert.Equal((Int32)0, decoded);
        }
Example #6
0
        public void SignedDecodeIncrement()
        {
            var coder = new HeliumIntegerSigned(0, false, 10);

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

            Assert.Equal((Int32)110, decoded);
        }