Ejemplo n.º 1
0
        public void GapBuffer_RealAndVirtualTest()
        {
            GapBuffer <int> buf = CreateTestGapBuffer();

            Assert.AreEqual(26, buf.Count);
            Assert.AreEqual(17, buf.Gap);
            Assert.AreEqual(23, buf.AfterGap);
            Assert.AreEqual(6, buf.GapCount);
            Assert.AreEqual(32, buf.AllocatedCount);

            Assert.AreEqual(26, buf.Count);
            Assert.AreEqual(0, buf.ToReal(0));
            Assert.AreEqual(16, buf.ToReal(16));
            Assert.AreEqual(23, buf.ToReal(17));
            Assert.AreEqual(32, buf.ToReal(26));

            Assert.AreEqual(0, buf.ToVirtual(0));
            Assert.AreEqual(16, buf.ToVirtual(16));
            Assert.AreEqual(17, buf.ToVirtual(23));
            Assert.AreEqual(26, buf.ToVirtual(32));

            buf.Clear();
            Assert.AreEqual(0, buf.Count);
            Assert.AreEqual(0, buf.ToReal(0));
            Assert.AreEqual(0, buf.ToVirtual(0));
        }
Ejemplo n.º 2
0
        public void GapBuffer_ConstructTest()
        {
            GapBuffer <int> buf = new GapBuffer <int>();

            Assert.AreEqual(0, buf.Count);
            Assert.AreEqual(0, buf.ToReal(0));
            Assert.AreEqual(0, buf.ToVirtual(0));
            Assert.AreEqual(0, buf.Gap);
            Assert.AreEqual(0, buf.AfterGap);
            Assert.AreEqual(0, buf.GapCount);
            Assert.AreEqual(0, buf.AllocatedCount);
            Assert.IsFalse(buf.IsReadOnly);
        }