public void ClampsToZero() { packer.Pack(writer, -4.5f); var outValue = packer.Unpack(GetReader()); Assert.That(outValue, Is.Zero); }
public int CreateUsingPrecsion(float precision) { var packer = new FloatPacker(100, precision); packer.Pack(this.writer, 1f); return(this.writer.BitPosition); }
public int BitCountIsLessForUnSigned(float precision) { var packer = new FloatPacker(100, precision, false); packer.Pack(writer, 1f); return(writer.BitPosition); }
public void PackFromBitCountPacksToCorrectCount([Range(1, 30)] int bitCount) { var packer = new FloatPacker(100, bitCount); packer.Pack(this.writer, 1f); Assert.That(this.writer.BitPosition, Is.EqualTo(bitCount)); }
public void PackFromBitCountPacksToCorrectCount([Range(1, 30)] int bitCount, [Values(true, false)] bool signed) { var packer = new FloatPacker(100, bitCount, signed); packer.Pack(writer, 1f); Assert.That(writer.BitPosition, Is.EqualTo(bitCount)); }
public void UnpackedValueIsWithinPrecision() { var start = GetRandomFloat(); var packed = packer.Pack(start); var unpacked = packer.Unpack(packed); Assert.That(unpacked, Is.EqualTo(start).Within(precsion)); }