public void SignedPrepareUnsupported() { Assert.Throws <UnsupportedDataTypeException>(() => { var coder = new HeliumIntegerSigned(0, false, 10); coder.Prepare(typeof(String)); }); }
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 })); }); }
public void SignedEncodeUnsupported() { Assert.Throws <UnsupportedDataTypeException>(() => { var coder = new HeliumIntegerSigned(0, false, 10); coder.Prepare(typeof(Int32)); var encoded = coder.Encode("asdf"); }); }
public void SignedEncodeIncrement() { var coder = new HeliumIntegerSigned(0, false, 10); coder.Prepare(typeof(Int32)); var encoded = coder.Encode((Int32)111); Assert.Equal("0B", encoded.ToHexString()); }
public void SignedEncodeNullableNull() { var coder = new HeliumIntegerSigned(0, true, 1); coder.Prepare(typeof(Int32?)); var encoded = coder.Encode(null); Assert.Equal(SignedVlq.Encode(0).ToHexString(), encoded.ToHexString()); }
public void SignedEncodeNullableMin() { var coder = new HeliumIntegerSigned(0, true, 1); coder.Prepare(typeof(Int32)); var encoded = coder.Encode(SignedVlq.MinValue + 1); Assert.Equal(SignedVlq.Encode(SignedVlq.MaxValue).ToHexString(), encoded.ToHexString()); }
public void SignedEncodeMax() { var coder = new HeliumIntegerSigned(0, false, 1); coder.Prepare(typeof(Int32)); var encoded = coder.Encode(SignedVlq.MaxValue); Assert.Equal(SignedVlq.Encode(SignedVlq.MaxValue).ToHexString(), encoded.ToHexString()); }
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); }
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); }
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); }
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); }
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); }