Esempio n. 1
0
        public void WriteBitOff(bool overflow)
        {
            Initialize();

            var target = new BitTarget(Serializer);

            target.WriteBitOff();

            if (overflow)
            {
                for (int i = 0; i < 8; i++)
                {
                    target.WriteBitOff();
                }
            }

            target.Apply();

            if (overflow)
            {
                AssertAndGoToStart(0, 0);
            }
            else
            {
                AssertAndGoToStart(0);
            }
        }
Esempio n. 2
0
        public void WriteInteger_Overflow(bool lazy)
        {
            Initialize(ABSaveSettings.ForSpeed);
            var target = new BitTarget(Serializer);

            target.WriteInteger(0, 4);
            target.WriteInteger(42, 6);
            target.Apply();

            AssertAndGoToStart(10, 128);
        }
Esempio n. 3
0
        public void WriteInteger_NoOverflow()
        {
            Initialize();
            var target = new BitTarget(Serializer);

            target.WriteInteger(48, 6);
            target.WriteInteger(2, 2);
            target.Apply();

            AssertAndGoToStart(194);
        }
Esempio n. 4
0
        public void FreeBits()
        {
            Initialize(ABSaveSettings.ForSize);
            var target = new BitTarget(Serializer);

            target.WriteInteger(0, 4);
            Assert.AreEqual(target.FreeBits, 4);
            target.WriteBitOff();
            target.WriteBitOn();
            Assert.AreEqual(target.FreeBits, 2);
            target.WriteInteger(42, 6);
            Assert.AreEqual(target.FreeBits, 4);
            target.Apply();
        }