Пример #1
0
        public void TestMethod3()
        {
            Node root = new Node(node_type.inner, new List<int>() { 16 });
            Node child1 = new Node(node_type.inner, new List<int>() { 7, 13 });
            Node child2 = new Node(node_type.inner, new List<int>() { 20, 24 });
            Node child3 = new Node(node_type.leaf, new List<int>() { 1, 2, 3, 4, 5 });
            Node child4 = new Node(node_type.leaf, new List<int>() { 10, 11, 12 });
            Node child5 = new Node(node_type.leaf, new List<int>() { 14, 15 });
            Node child6 = new Node(node_type.leaf, new List<int>() { 17, 18, 19 });
            Node child7 = new Node(node_type.leaf, new List<int>() { 21, 22 });
            Node child8 = new Node(node_type.leaf, new List<int>() { 25, 26 });

            root.AddChild(child1);
            root.AddChild(child2);
            child1.AddChild(child3);
            child1.AddChild(child4);
            child1.AddChild(child5);
            child2.AddChild(child6);
            child2.AddChild(child7);
            child2.AddChild(child8);

            BTree tree = new BTree(root, 3);

            bool flag = BTree.Check(tree);
            Assert.AreEqual(true, flag);
        }
Пример #2
0
        public void TestMethod2()
        {
            Node root = new Node(node_type.inner, new List<int>() { 7, 13, 20, 30 });
            Node child1 = new Node(node_type.leaf, new List<int>() { 1, 3, 4, 5 });
            Node child2 = new Node(node_type.leaf, new List<int>() { 10, 11 });
            Node child3 = new Node(node_type.leaf, new List<int>() { 14, 15 });
            Node child4 = new Node(node_type.leaf, new List<int>() { 19, 20, 21 });
            Node child5 = new Node(node_type.leaf, new List<int>() { 31, 32 });

            root.AddChild(child1);
            root.AddChild(child2);
            root.AddChild(child3);
            root.AddChild(child4);
            root.AddChild(child5);

            BTree tree = new BTree(root, 3);

            bool flag = BTree.Check(tree);
            Assert.AreEqual(false, flag);
        }
Пример #3
0
        public void TestMethod4()
        {
            Node root = new Node(node_type.inner, new List<int>() { 20, 22, 35 });
            Node child1 = new Node(node_type.leaf, new List<int>() { 5, 7, 10, 15 });
            Node child2 = new Node(node_type.leaf, new List<int>() { 23, 24 });
            Node child3 = new Node(node_type.leaf, new List<int>() { 27, 29, 30 });
            Node child4 = new Node(node_type.leaf, new List<int>() { 36, 38 });

            root.AddChild(child1);
            root.AddChild(child2);
            root.AddChild(child3);
            root.AddChild(child4);

            BTree tree = new BTree(root, 3);

            bool flag = BTree.Check(tree);
            Assert.AreEqual(false, flag);
        }
Пример #4
0
        public void TestMethod9()
        {
            Node root = new Node(node_type.inner, new List<int>() { 22 });
            Node child1 = new Node(node_type.leaf, new List<int>() { 10 });

            root.AddChild(child1);

            BTree tree = new BTree(root, 2);

            bool flag = BTree.Check(tree);
            Assert.AreEqual(false, flag);
        }
Пример #5
0
        public void TestMethod6()
        {
            Node root = new Node(node_type.inner, new List<int>() { 25 });
            Node child1 = new Node(node_type.inner, new List<int>() { 10, 16 });
            Node child2 = new Node(node_type.inner, new List<int>() { 26 });
            Node child3 = new Node(node_type.leaf, new List<int>() { 4, 6, 8 });
            Node child4 = new Node(node_type.leaf, new List<int>() { 12, 14 });
            Node child5 = new Node(node_type.leaf, new List<int>() { 18, 20 });
            Node child6 = new Node(node_type.leaf, new List<int>() { 24 });
            Node child7 = new Node(node_type.leaf, new List<int>() { 28, 30 });

            root.AddChild(child1);
            root.AddChild(child2);
            child1.AddChild(child3);
            child1.AddChild(child4);
            child1.AddChild(child5);
            child2.AddChild(child6);
            child2.AddChild(child7);

            BTree tree = new BTree(root, 2);

            bool flag = BTree.Check(tree);
            Assert.AreEqual(false, flag);
        }