예제 #1
0
        public void GapBuffer_RemoveRangeTest()
        {
            GapBuffer <int> buf = CreateTestGapBuffer();

            buf.RemoveRange(8, 16);
            Assert.AreEqual(10, buf.Count);
            Assert.AreEqual(8, buf.Gap);
            Assert.AreEqual(22, buf.GapCount);

            buf.RemoveRange(0, 5);
            Assert.AreEqual(5, buf.Count);
            Assert.AreEqual(0, buf.Gap);
            Assert.AreEqual(27, buf.GapCount);

            Assert.AreEqual(105, buf[0]);
            Assert.AreEqual(106, buf[1]);
            Assert.AreEqual(124, buf[4]);

            buf.RemoveRange(0, 5);
            Assert.AreEqual(0, buf.Count);
            Assert.AreEqual(0, buf.Gap);
            Assert.AreEqual(32, buf.GapCount);
        }
예제 #2
0
        public void RemoveTest()
        {
            var gb = new GapBuffer <int>(4);

            gb.InsertRange(0, new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, 0, 9);

            gb.RemoveRange(3, 4);

            Assert.Equal(5, gb.Count);
            Assert.Equal(1, gb[0]);
            Assert.Equal(2, gb[1]);
            Assert.Equal(3, gb[2]);
            Assert.Equal(8, gb[3]);
            Assert.Equal(9, gb[4]);
        }