public void UnpacksCorrectUshortValue()
        {
            ushort start = GetRandonUshortBias();

            VarIntBlocksPacker.Pack(writer, start, blockSize);
            ulong unpacked = VarIntBlocksPacker.Unpack(GetReader(), blockSize);

            Assert.That(unpacked, Is.EqualTo(start));
        }
Exemple #2
0
        public void UnpacksCorrectUlongValue()
        {
            var start = GetRandonUlongBias();

            VarIntBlocksPacker.Pack(writer, start, blockSize);
            var unpacked = VarIntBlocksPacker.Unpack(GetReader(), blockSize);

            Assert.That(unpacked, Is.EqualTo(start));
        }
        public void WritesNplus1BitsPerBlock_bigger()
        {
            uint aboveBlockSize = (1u << blockSize) + 1u;

            VarIntBlocksPacker.Pack(writer, aboveBlockSize, blockSize);
            Assert.That(writer.BitPosition, Is.EqualTo(2 * (blockSize + 1)));

            ulong unpacked = VarIntBlocksPacker.Unpack(GetReader(), blockSize);

            Assert.That(unpacked, Is.EqualTo(aboveBlockSize));
        }
        public void WritesNplus1BitsPerBlock()
        {
            uint zero = 0u;

            VarIntBlocksPacker.Pack(writer, zero, blockSize);
            Assert.That(writer.BitPosition, Is.EqualTo(blockSize + 1));

            ulong unpacked = VarIntBlocksPacker.Unpack(GetReader(), blockSize);

            Assert.That(unpacked, Is.EqualTo(zero));
        }