public void UnpacksCorrectUshortValue() { ushort start = this.GetRandonUshortBias(); VariableBlockPacker.Pack(this.writer, start, this.blockSize); ulong unpacked = VariableBlockPacker.Unpack(this.GetReader(), this.blockSize); Assert.That(unpacked, Is.EqualTo(start)); }
public void WritesNplus1BitsPerBlock_bigger() { uint aboveBlockSize = (1u << this.blockSize) + 1u; VariableBlockPacker.Pack(this.writer, aboveBlockSize, this.blockSize); Assert.That(this.writer.BitPosition, Is.EqualTo(2 * (this.blockSize + 1))); ulong unpacked = VariableBlockPacker.Unpack(this.GetReader(), this.blockSize); Assert.That(unpacked, Is.EqualTo(aboveBlockSize)); }
public void WritesNplus1BitsPerBlock() { uint zero = 0u; VariableBlockPacker.Pack(this.writer, zero, this.blockSize); Assert.That(this.writer.BitPosition, Is.EqualTo(this.blockSize + 1)); ulong unpacked = VariableBlockPacker.Unpack(this.GetReader(), this.blockSize); Assert.That(unpacked, Is.EqualTo(zero)); }