UnpackUInt64() private method

private UnpackUInt64 ( Stream source ) : System.UInt64
source Stream
return System.UInt64
コード例 #1
0
        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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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));
        }
コード例 #7
0
 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));
     }
 }
コード例 #8
0
 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));
     }
 }
コード例 #9
0
 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));
     }
 }
コード例 #10
0
 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));
     }
 }