public void CheckAdd10BillionElements()
        {
            const int billion = 1000000000;
            CompressingTreeList <string> list = new CompressingTreeList <string>(string.Equals);

            list.InsertRange(0, billion, "A");
            list.InsertRange(1, billion, "B");
            Assert.AreEqual(2 * billion, list.Count);
            Assert.Throws <OverflowException>(delegate { list.InsertRange(2, billion, "C"); });
        }
        public void CheckAdd10BillionElements()
        {
            const int billion = 1000000000;
            CompressingTreeList <string> list = new CompressingTreeList <string>(string.Equals);

            list.InsertRange(0, billion, "A");
            list.InsertRange(1, billion, "B");
            Assert.AreEqual(2 * billion, list.Count);
            try {
                list.InsertRange(2, billion, "C");
                Assert.Fail("Expected OverflowException");
            } catch (OverflowException) {
                // expected
            }
        }
        public void RemoveRange()
        {
            CompressingTreeList <int> list = new CompressingTreeList <int>((a, b) => a == b);

            for (int i = 1; i <= 3; i++)
            {
                list.InsertRange(list.Count, 2, i);
            }
            Assert.AreEqual(new[] { 1, 1, 2, 2, 3, 3 }, list.ToArray());
            list.RemoveRange(1, 4);
            Assert.AreEqual(new[] { 1, 3 }, list.ToArray());
            list.Insert(1, 1);
            list.InsertRange(2, 2, 2);
            list.Insert(4, 1);
            Assert.AreEqual(new[] { 1, 1, 2, 2, 1, 3 }, list.ToArray());
            list.RemoveRange(2, 2);
            Assert.AreEqual(new[] { 1, 1, 1, 3 }, list.ToArray());
        }