Example #1
0
        public void ListToTree(int[] values)
        {
            ImmutableAVL tree = new ImmutableAVL(values);

            Assert.AreEqual(values.Length, tree.Count());
            Assert.IsTrue(isAVLTreeValid(tree));
        }
Example #2
0
        public void Peek(int[] values)
        {
            ImmutableAVL tree = new ImmutableAVL(values);
            int          peek = tree.Peek();

            Assert.AreEqual(peek, values.Min());
            Assert.AreEqual(values.Length, tree.Count());
        }
Example #3
0
        public void Insert(int[] values)
        {
            ImmutableAVL tree = new ImmutableAVL(values);

            tree.Add(5);
            Assert.AreEqual(values.Length + 1, tree.Count());
            Assert.IsTrue(isAVLTreeValid(tree));
        }
Example #4
0
        public void Pop(int[] values)
        {
            ImmutableAVL tree = new ImmutableAVL(values);
            int          pop  = tree.Pop();

            Assert.AreEqual(pop, values.Min());
            Assert.AreEqual(values.Length - 1, tree.Count());
            Assert.IsTrue(isAVLTreeValid(tree));
        }