public void BitStream() { BitStreamer stream = new BitStreamer(); stream.ResetWrite(m_ptrBuf, SIZE, false); for (int i = 0; i < AMOUNT / 2; i++) { stream.WriteBool(i % 2 == 0); stream.WriteInt32(i); } stream.ResetRead(); for (int i = 0; i < AMOUNT / 2; i++) { bool b = stream.ReadBool(); int num = stream.ReadInt32(); } }
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); }