private static void TestUInt64(UInt64 value) { var output = new MemoryStream(); Packer.Create(output).Pack(value); Assert.AreEqual(value, Unpacking.UnpackUInt64(new MemoryStream(output.ToArray()))); Assert.AreEqual(value, Unpacking.UnpackUInt64(output.ToArray()).Value); }
public void TestUnpackUInt16MaxValue_UnpackUInt64_ByteArray() { var buffer = new byte[] { 0xCD, 0xFF, 0xFF }; var result = Unpacking.UnpackUInt64(buffer); Assert.That(result.ReadCount, Is.EqualTo(buffer.Length)); Assert.That(result.Value, Is.EqualTo(65535)); }
public void TestUnpackUInt64MaxValue_UnpackUInt64_ByteArray() { var buffer = new byte[] { 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; var result = Unpacking.UnpackUInt64(buffer); Assert.That(result.ReadCount, Is.EqualTo(buffer.Length)); Assert.That(result.Value, Is.EqualTo(18446744073709551615)); }
public void TestUnpackUInt32MaxValuePlusOne_UnpackUInt64_ByteArray() { var buffer = new byte[] { 0xCF, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0 }; var result = Unpacking.UnpackUInt64(buffer); Assert.That(result.ReadCount, Is.EqualTo(buffer.Length)); Assert.That(result.Value, Is.EqualTo(4294967296)); }
public void TestUnpackPositiveFixNumMaxValuePlusOne_UnpackUInt64_ByteArray() { var buffer = new byte[] { 0xCC, 0x80 }; var result = Unpacking.UnpackUInt64(buffer); Assert.That(result.ReadCount, Is.EqualTo(buffer.Length)); Assert.That(result.Value, Is.EqualTo(128)); }
public void TestUnpackPlusOne_UnpackUInt64_ByteArray() { var buffer = new byte[] { 0x1 }; var result = Unpacking.UnpackUInt64(buffer); Assert.That(result.ReadCount, Is.EqualTo(buffer.Length)); Assert.That(result.Value, Is.EqualTo(1)); }
public void TestUnpackUInt64MaxValue_UnpackUInt64_Stream() { using (var buffer = new MemoryStream(new byte[] { 0xCF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF })) { var result = Unpacking.UnpackUInt64(buffer); Assert.That(buffer.Position, Is.EqualTo(buffer.Length)); Assert.That(result, Is.EqualTo(18446744073709551615)); } }
public void TestUnpackUInt32MaxValuePlusOne_UnpackUInt64_Stream() { using (var buffer = new MemoryStream(new byte[] { 0xCF, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0 })) { var result = Unpacking.UnpackUInt64(buffer); Assert.That(buffer.Position, Is.EqualTo(buffer.Length)); Assert.That(result, Is.EqualTo(4294967296)); } }
public void TestUnpackPositiveFixNumMaxValuePlusOne_UnpackUInt64_Stream() { using (var buffer = new MemoryStream(new byte[] { 0xCC, 0x80 })) { var result = Unpacking.UnpackUInt64(buffer); Assert.That(buffer.Position, Is.EqualTo(buffer.Length)); Assert.That(result, Is.EqualTo(128)); } }
public void TestUnpackZero_UnpackUInt64_Stream() { using (var buffer = new MemoryStream(new byte[] { 0x0 })) { var result = Unpacking.UnpackUInt64(buffer); Assert.That(buffer.Position, Is.EqualTo(buffer.Length)); Assert.That(result, Is.EqualTo(0)); } }