コード例 #1
0
        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);
        }