Beispiel #1
0
        private void TestRemove(AllocTest tree)
        {
            int count = (int)tree.Count;

            for (int j = 0; j < count; j++)
            {
                IncrementIteration();
                TestNoThrow("remove", delegate() { tree.Remove(); });
                TestNoThrow("validate", delegate() { tree.Validate(); });
            }
            TestNoThrow("validate", delegate() { tree.Validate(); });
            TestTrue("count", delegate() { return(tree.Count == 0); });
        }
Beispiel #2
0
        private void TestAdd(AllocTest tree, int count, int capacity)
        {
            int c = 0;

            for (int j = 0; j < count; j++)
            {
                IncrementIteration();
                if (j < capacity)
                {
                    TestNoThrow("add", delegate() { tree.Add(); });
                    c++;
                }
                else
                {
                    TestThrow("add-fail", typeof(OutOfMemoryException), delegate() { tree.Add(); });
                }
                TestNoThrow("validate", delegate() { tree.Validate(); });
            }
            TestNoThrow("validate", delegate() { tree.Validate(); });
            TestTrue("count", delegate() { return(tree.Count == c); });
        }