public void TestSignedMinMax() { var stream = new MsgPackStream(); stream.WriteInt8(sbyte.MinValue); stream.WriteInt8(sbyte.MaxValue); stream.WriteInt16(short.MinValue); stream.WriteInt16(short.MaxValue); stream.WriteInt32(int.MinValue); stream.WriteInt32(int.MaxValue); stream.WriteInt64(long.MinValue); stream.WriteInt64(long.MaxValue); stream.Position = 0; Assert.AreEqual(sbyte.MinValue, stream.ReadInt8()); Assert.AreEqual(sbyte.MaxValue, stream.ReadInt8()); Assert.AreEqual(short.MinValue, stream.ReadInt16()); Assert.AreEqual(short.MaxValue, stream.ReadInt16()); Assert.AreEqual(int.MinValue, stream.ReadInt32()); Assert.AreEqual(int.MaxValue, stream.ReadInt32()); Assert.AreEqual(long.MinValue, stream.ReadInt64()); Assert.AreEqual(long.MaxValue, stream.ReadInt64()); }
public void TestSigned() { var stream = new MsgPackStream(); stream.WriteInt8(-11); Assert.AreEqual(stream.Position, 1); stream.WriteInt16(192); Assert.AreEqual(stream.Position, 3); stream.WriteInt32(-213); Assert.AreEqual(stream.Position, 7); stream.WriteInt64(64); Assert.AreEqual(stream.Position, 15); stream.Position = 0; Assert.AreEqual(-11, stream.ReadInt8()); Assert.AreEqual(192, stream.ReadInt16()); Assert.AreEqual(-213, stream.ReadInt32()); Assert.AreEqual(64, stream.ReadInt64()); }