public void FloatTest(float value) { float replica = 0; m_stream.WriteFloat(value); Assert.AreEqual(32, m_stream.BitOffset); m_stream.ResetRead(); replica = m_stream.ReadFloat(); Assert.AreEqual(value, replica); }
public void PeekFloat(float value) { const float min = -5, max = 5, prec = 0.2f; m_stream.WriteFloat(value, min, max, prec); m_stream.ResetRead(); Assert.AreEqual(value, m_stream.PeekFloat(min, max, prec), 0.000005f); Assert.AreEqual(0, m_stream.BitOffset); }
public void ReadWriteMultipleTest() { const bool bVal = true; const double dVal = double.MaxValue / 3 * 2; const float fVal = float.MinValue / 5; const short sVal = -12345; const int offset = 113; m_stream = new BitStreamer(); m_stream.ResetWrite(64); m_stream.WriteBool(bVal); m_stream.WriteDouble(dVal); m_stream.WriteFloat(fVal); m_stream.WriteShort(sVal); Assert.AreEqual(offset, m_stream.BitOffset); m_stream.ResetRead(); Assert.AreEqual(bVal, m_stream.ReadBool()); Assert.AreEqual(dVal, m_stream.ReadDouble()); Assert.AreEqual(fVal, m_stream.ReadFloat()); Assert.AreEqual(sVal, m_stream.ReadShort()); Assert.AreEqual(offset, m_stream.BitOffset); }