Exemple #1
0
        public void TestRemoveAt()
        {
            ImmutableSortedTreeList <int> .Builder list = ImmutableSortedTreeList.CreateBuilder <int>();
            var reference = new List <int>();

            for (int i = 0; i < 4 * 8 * 8; i++)
            {
                int item = Generator.GetInt32();
                list.Add(item);
                reference.Add(item);
            }

            reference.Sort();

            while (list.Count > 0)
            {
                int index = Generator.GetInt32(list.Count);
                Assert.Equal(reference[index], list[index]);
                reference.RemoveAt(index);
                list.RemoveAt(index);
                list.Validate(ValidationRules.None);

                Assert.Equal(reference, list);
            }

            Assert.Empty(list);
            Assert.Empty(reference);
        }