예제 #1
0
        public void Delete_TheOnlyKeyInLeafWithFullParentAndMinOneFullSibling_ExpectsLeftRotateAndToReduceBy1Key()
        {
            var root = new BTreeNode <int, string>(3);

            root.InsertKeyValue(new KeyValuePair <int, string>(90, "A"));
            root.InsertKeyValue(new KeyValuePair <int, string>(200, "B"));

            var child1 = new BTreeNode <int, string>(3, new KeyValuePair <int, string>(30, "C"));

            child1.InsertKeyValue(new KeyValuePair <int, string>(50, "D"));

            var child2 = new BTreeNode <int, string>(3, new KeyValuePair <int, string>(150, "E"));
            var child3 = new BTreeNode <int, string>(3, new KeyValuePair <int, string>(400, "F"));

            child3.InsertKeyValue(new KeyValuePair <int, string>(500, "F"));

            root.InsertChild(child1);
            root.InsertChild(child2);
            root.InsertChild(child3);

            var tree = new BTree <int, string>(3)
            {
                Root = root
            };

            BTreeTestsUtils.HasBTreeProperties(tree, 7, 7, 4);

            Assert.IsTrue(tree.Delete(150));
            BTreeTestsUtils.HasBTreeProperties(tree, 6, 6, 4);
        }
예제 #2
0
        public void Split_NodeIsOverFlownAndHasChildren_ExpectsSuccessfulSplitForKeysAndChildren()
        {
            var node = new BTreeNode <int, string>(3);

            node.InsertKeyValue(new KeyValuePair <int, string>(20, "A"));
            node.InsertKeyValue(new KeyValuePair <int, string>(50, "B"));
            node.InsertKeyValue(new KeyValuePair <int, string>(200, "C"));

            var child1 = new BTreeNode <int, string>(3);

            child1.InsertKeyValue(new KeyValuePair <int, string>(10, "D"));
            node.InsertChild(child1);

            var child2 = new BTreeNode <int, string>(3);

            child2.InsertKeyValue(new KeyValuePair <int, string>(30, "E"));
            node.InsertChild(child2);

            var child3 = new BTreeNode <int, string>(3);

            child3.InsertKeyValue(new KeyValuePair <int, string>(100, "F"));
            node.InsertChild(child3);

            var child4 = new BTreeNode <int, string>(3);

            child4.InsertKeyValue(new KeyValuePair <int, string>(300, "G"));
            node.InsertChild(child4);

            BTreeNode <int, string> newNode = node.Split();

            /* At this point we do not expect 'node' to be valid (i.e., HasBTreeNodeProperties(node)==false ), because the key in the middle has not yet moved up, that step is part of split method in the tree itself and not in the node.*/
            Assert.IsTrue(BTreeTestsUtils.HasBTreeNodeProperties <BTreeNode <int, string>, int, string>(newNode));
        }
        public void Insert_SeveralKeys_ExpectsTreeToIncreaseInLevelsAfewTimes()
        {
            var tree = new BPlusTree <int, string>(3);

            BTreeTestsUtils.HasBPlusTreeProperties(tree, 0, 0, 0);

            tree.Insert(new KeyValuePair <int, string>(50, "A"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 2, 1, 2);

            tree.Insert(new KeyValuePair <int, string>(10, "B"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 3, 2, 2);

            tree.Insert(new KeyValuePair <int, string>(100, "C"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 4, 3, 3);

            tree.Insert(new KeyValuePair <int, string>(200, "D"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 5, 4, 3);

            tree.Insert(new KeyValuePair <int, string>(20, "E"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 7, 5, 4);

            tree.Insert(new KeyValuePair <int, string>(300, "F"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 9, 6, 7);

            tree.Insert(new KeyValuePair <int, string>(30, "G"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 10, 7, 7);

            tree.Insert(new KeyValuePair <int, string>(500, "H"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 11, 8, 7);

            tree.Insert(new KeyValuePair <int, string>(250, "I"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 13, 9, 8);

            tree.Insert(new KeyValuePair <int, string>(400, "J"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 14, 10, 8);

            tree.Insert(new KeyValuePair <int, string>(270, "K"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 16, 11, 10);

            tree.Insert(new KeyValuePair <int, string>(600, "L"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 18, 12, 11);

            tree.Insert(new KeyValuePair <int, string>(150, "M"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 20, 13, 12);

            tree.Insert(new KeyValuePair <int, string>(80, "N"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 22, 14, 16);

            tree.Insert(new KeyValuePair <int, string>(60, "O"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 24, 15, 17);

            tree.Insert(new KeyValuePair <int, string>(90, "P"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 25, 16, 17);

            Assert.AreEqual(1, tree.Root.KeyCount);
            Assert.AreEqual(150, tree.Root.GetKeyValue(0).Key);
            Assert.AreEqual(default(string), tree.Root.GetKeyValue(0).Value, ignoreCase: true);
        }
        public void Delete_TheOnlyKeyInTree_ExpectsNoNodeAndNoKeyAfter()
        {
            var tree = new BPlusTree <int, string>(3);

            tree.Insert(new KeyValuePair <int, string>(10, "A"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 2, 1, 2);

            /* Deleting the only key in the only leaf node of the tree. */
            Assert.IsTrue(tree.Delete(10));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 0, 0, 0);
        }
예제 #5
0
        public void Delete_TheOnlyKeyInLeaf_ExpectsToTriggerJoinAndLeftRotateOnANodeWithChildren()
        {
            var node1 = new BTreeNode <int, string>(3);

            node1.InsertKeyValue(new KeyValuePair <int, string>(60, "A"));

            var node2 = new BTreeNode <int, string>(3);

            node2.InsertKeyValue(new KeyValuePair <int, string>(30, "B"));

            var node3 = new BTreeNode <int, string>(3);

            node3.InsertKeyValue(new KeyValuePair <int, string>(200, "C"));
            node3.InsertKeyValue(new KeyValuePair <int, string>(300, "D"));

            var node4 = new BTreeNode <int, string>(3);

            node4.InsertKeyValue(new KeyValuePair <int, string>(10, "E"));

            var node5 = new BTreeNode <int, string>(3);

            node5.InsertKeyValue(new KeyValuePair <int, string>(50, "F"));

            var node6 = new BTreeNode <int, string>(3);

            node6.InsertKeyValue(new KeyValuePair <int, string>(150, "G"));

            var node7 = new BTreeNode <int, string>(3);

            node7.InsertKeyValue(new KeyValuePair <int, string>(250, "H"));

            var node8 = new BTreeNode <int, string>(3);

            node8.InsertKeyValue(new KeyValuePair <int, string>(500, "I"));

            node1.InsertChild(node2);
            node1.InsertChild(node3);

            node2.InsertChild(node4);
            node2.InsertChild(node5);

            node3.InsertChild(node6);
            node3.InsertChild(node7);
            node3.InsertChild(node8);

            var tree = new BTree <int, string>(3)
            {
                Root = node1
            };

            BTreeTestsUtils.HasBTreeProperties(tree, 9, 9, 8);
            Assert.IsTrue(tree.Delete(10));
            BTreeTestsUtils.HasBTreeProperties(tree, 8, 8, 7);
        }
        public void Delete_BiggestKeyInTheOnlyLeafNodeOfTree_ExpectsToReduceBy1Key()
        {
            var tree = new BPlusTree <int, string>(3);

            tree.Insert(new KeyValuePair <int, string>(10, "A"));
            tree.Insert(new KeyValuePair <int, string>(100, "B"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 3, 2, 3);

            /* Deleting 1 out of 2 keys in the only leaf node of the tree. */
            Assert.IsTrue(tree.Delete(100));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 2, 1, 2);
        }
        public void Delete_NonExistingKey_ExpectsFailure()
        {
            var tree = new BPlusTree <int, string>(3);

            tree.Insert(new KeyValuePair <int, string>(10, "A"));
            tree.Insert(new KeyValuePair <int, string>(100, "B"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 3, 2, 3);

            /* Deleting a non-existing key. */
            Assert.IsFalse(tree.Delete(50));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 3, 2, 3);
        }
        public void Delete_TheOnlyKeyInLeafNode_ExpectsToTriggerLeftRotateAndReduceBy1Key()
        {
            var tree = new BPlusTree <int, string>(3);

            tree.Insert(new KeyValuePair <int, string>(10, "A"));
            tree.Insert(new KeyValuePair <int, string>(20, "B"));
            tree.Insert(new KeyValuePair <int, string>(30, "C"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 4, 3, 3);

            Assert.IsTrue(tree.Delete(10));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 3, 2, 3);
        }
예제 #9
0
        public void Delete_TheOnlyKeyInLeafNode_ExpectsToTriggerJoinByLeftSiblingAndReduceBy2NodesAnd1Key()
        {
            var tree = new BTree <int, string>(3);

            tree.Insert(new KeyValuePair <int, string>(10, "A"));
            tree.Insert(new KeyValuePair <int, string>(20, "B"));
            tree.Insert(new KeyValuePair <int, string>(30, "C"));
            BTreeTestsUtils.HasBTreeProperties(tree, 3, 3, 3);

            Assert.IsTrue(tree.Delete(30));
            BTreeTestsUtils.HasBTreeProperties(tree, 2, 2, 1);
        }
        public void Delete_AllNodesInRandomOrder1_ExpectsProperBtreeAfterEachDelete()
        {
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 25, 16, 17);

            Assert.IsTrue(_tree.Delete(100));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 24, 15, 17);

            Assert.IsTrue(_tree.Delete(20));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 23, 14, 17);

            Assert.IsTrue(_tree.Delete(250));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 22, 13, 17);

            Assert.IsTrue(_tree.Delete(600));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 21, 12, 17);

            Assert.IsTrue(_tree.Delete(270));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 19, 11, 16);

            Assert.IsTrue(_tree.Delete(60));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 18, 10, 16);

            Assert.IsTrue(_tree.Delete(10));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 17, 9, 16);

            Assert.IsTrue(_tree.Delete(300));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 15, 8, 12);

            Assert.IsTrue(_tree.Delete(80));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 13, 7, 11);

            Assert.IsTrue(_tree.Delete(150));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 11, 6, 10);

            Assert.IsTrue(_tree.Delete(400));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 9, 5, 8);

            Assert.IsTrue(_tree.Delete(30));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 7, 4, 7);

            Assert.IsTrue(_tree.Delete(90));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 5, 3, 4);

            Assert.IsTrue(_tree.Delete(500));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 3, 2, 3);

            Assert.IsTrue(_tree.Delete(50));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 2, 1, 2);


            Assert.IsTrue(_tree.Delete(200));
            BTreeTestsUtils.HasBPlusTreeProperties(_tree, 0, 0, 0);
        }
        public void Delete_KeyInFullLeaf_ExpectsToReduceBy1Key()
        {
            var tree = new BPlusTree <int, string>(3);

            tree.Insert(new KeyValuePair <int, string>(10, "A"));
            tree.Insert(new KeyValuePair <int, string>(20, "B"));
            tree.Insert(new KeyValuePair <int, string>(30, "C"));
            tree.Insert(new KeyValuePair <int, string>(40, "D"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 6, 4, 4);

            Assert.IsTrue(tree.Delete(30));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 5, 3, 4);
        }
예제 #12
0
        public void Delete_DeleteTheOnlyKeyInInternalNode_ExpectsToTriggerLeafDeleteAndLeftRotate()
        {
            var tree = new BTree <int, string>(3);

            tree.Insert(new KeyValuePair <int, string>(10, "A"));
            tree.Insert(new KeyValuePair <int, string>(20, "B"));
            tree.Insert(new KeyValuePair <int, string>(30, "C"));
            tree.Insert(new KeyValuePair <int, string>(40, "D"));
            BTreeTestsUtils.HasBTreeProperties(tree, 4, 4, 3);

            Assert.IsTrue(tree.Delete(20));
            BTreeTestsUtils.HasBTreeProperties(tree, 3, 3, 3);
        }
        public void Delete_TheOnlyKeyInLeafNodeWithMinOneFullSibling_ExpectsToTriggerLeftRotate()
        {
            var tree = new BPlusTree <int, string>(3);

            tree.Insert(new KeyValuePair <int, string>(10, "A"));
            tree.Insert(new KeyValuePair <int, string>(20, "B"));
            tree.Insert(new KeyValuePair <int, string>(30, "C"));
            tree.Insert(new KeyValuePair <int, string>(40, "D"));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 6, 4, 4);

            Assert.IsTrue(tree.Delete(10));
            BTreeTestsUtils.HasBPlusTreeProperties(tree, 5, 3, 4);
        }
예제 #14
0
        public void Delete_AllNodesInRandomOrder2_ExpectsProperBtreeAfterEachDelete()
        {
            Assert.IsTrue(_tree.Delete(90));
            BTreeTestsUtils.HasBTreeProperties(_tree, 15, 15, 11);

            Assert.IsTrue(_tree.Delete(400));
            BTreeTestsUtils.HasBTreeProperties(_tree, 14, 14, 9);

            Assert.IsTrue(_tree.Delete(80));
            BTreeTestsUtils.HasBTreeProperties(_tree, 13, 13, 9);

            Assert.IsTrue(_tree.Delete(600));
            BTreeTestsUtils.HasBTreeProperties(_tree, 12, 12, 9);

            Assert.IsTrue(_tree.Delete(100));
            BTreeTestsUtils.HasBTreeProperties(_tree, 11, 11, 8);

            Assert.IsTrue(_tree.Delete(20));
            BTreeTestsUtils.HasBTreeProperties(_tree, 10, 10, 8);

            Assert.IsTrue(_tree.Delete(270));
            BTreeTestsUtils.HasBTreeProperties(_tree, 9, 9, 8);

            Assert.IsTrue(_tree.Delete(10));
            BTreeTestsUtils.HasBTreeProperties(_tree, 8, 8, 7);

            Assert.IsTrue(_tree.Delete(250));
            BTreeTestsUtils.HasBTreeProperties(_tree, 7, 7, 4);

            Assert.IsTrue(_tree.Delete(50));
            BTreeTestsUtils.HasBTreeProperties(_tree, 6, 6, 4);

            Assert.IsTrue(_tree.Delete(200));
            BTreeTestsUtils.HasBTreeProperties(_tree, 5, 5, 4);

            Assert.IsTrue(_tree.Delete(30));
            BTreeTestsUtils.HasBTreeProperties(_tree, 4, 4, 3);

            Assert.IsTrue(_tree.Delete(150));
            BTreeTestsUtils.HasBTreeProperties(_tree, 3, 3, 3);

            Assert.IsTrue(_tree.Delete(300));
            BTreeTestsUtils.HasBTreeProperties(_tree, 2, 2, 1);

            Assert.IsTrue(_tree.Delete(60));
            BTreeTestsUtils.HasBTreeProperties(_tree, 1, 1, 1);

            Assert.IsTrue(_tree.Delete(500));
            BTreeTestsUtils.HasBTreeProperties(_tree, 0, 0, 0);
        }
예제 #15
0
        public void RotateRight_EmptyNodeWithMinOneFullLeftSibling_ExpectsChildrenToBeRotated()
        {
            var node1 = new BTreeNode <int, string>(3);

            node1.InsertKeyValue(new KeyValuePair <int, string>(100, "A"));

            var node2 = new BTreeNode <int, string>(3);

            node2.InsertKeyValue(new KeyValuePair <int, string>(50, "B"));
            node2.InsertKeyValue(new KeyValuePair <int, string>(80, "C"));

            var node3 = new BTreeNode <int, string>(3);

            node3.InsertKeyValue(new KeyValuePair <int, string>(100, "D"));

            var node4 = new BTreeNode <int, string>(3);

            node4.InsertKeyValue(new KeyValuePair <int, string>(40, "D"));

            var node5 = new BTreeNode <int, string>(3);

            node5.InsertKeyValue(new KeyValuePair <int, string>(70, "E"));

            var node6 = new BTreeNode <int, string>(3);

            node6.InsertKeyValue(new KeyValuePair <int, string>(90, "F"));

            var node7 = new BTreeNode <int, string>(3);

            node7.InsertKeyValue(new KeyValuePair <int, string>(150, "G"));

            node1.InsertChild(node2);
            node1.InsertChild(node3);

            node2.InsertChild(node4);
            node2.InsertChild(node5);
            node2.InsertChild(node6);

            node3.InsertChild(node7);
            /* This is to be able to test RotateLeft without re-ordering children. */
            node3.RemoveKey(100);

            var tree = new BTree <int, string>(3)
            {
                Root = node1
            };

            tree.RotateRight(node3, node2, 0);
            BTreeTestsUtils.HasBTreeProperties(tree, 7, 7, 7);
        }
예제 #16
0
        public void RotateLeft_EmptyNodeWithMinOneFullSibling_ExpectsChildrenToBeRotated()
        {
            var node1 = new BTreeNode <int, string>(3);

            node1.InsertKeyValue(new KeyValuePair <int, string>(10, "A"));

            var node2 = new BTreeNode <int, string>(3);

            var node3 = new BTreeNode <int, string>(3);

            node3.InsertKeyValue(new KeyValuePair <int, string>(20, "B"));
            node3.InsertKeyValue(new KeyValuePair <int, string>(30, "C"));

            var node4 = new BTreeNode <int, string>(3);

            node4.InsertKeyValue(new KeyValuePair <int, string>(15, "D"));

            var node5 = new BTreeNode <int, string>(3);

            node5.InsertKeyValue(new KeyValuePair <int, string>(25, "E"));

            var node6 = new BTreeNode <int, string>(3);

            node6.InsertKeyValue(new KeyValuePair <int, string>(35, "F"));

            var node7 = new BTreeNode <int, string>(3);

            node7.InsertKeyValue(new KeyValuePair <int, string>(1, "G"));

            node1.InsertChild(node2);
            node1.InsertChild(node3);

            node2.InsertChild(node7);

            node3.InsertChild(node4);
            node3.InsertChild(node5);
            node3.InsertChild(node6);

            var tree = new BTree <int, string>(3)
            {
                Root = node1
            };

            tree.RotateLeft(node2, node3, 0);
            BTreeTestsUtils.HasBTreeProperties(tree, 7, 7, 7);
        }
예제 #17
0
        public void Split_NodeIsOverFlownAndHasNoChildren_ExpectsSuccessfulSplitForKeys()
        {
            var node = new BTreeNode <int, string>(3);

            Assert.AreEqual(2, node.MaxKeys); /* Thus to be overFlown (which is the condition for split) node should have 3 keys. */

            node.InsertKeyValue(new KeyValuePair <int, string>(100, "C"));
            node.InsertKeyValue(new KeyValuePair <int, string>(50, "B"));
            node.InsertKeyValue(new KeyValuePair <int, string>(10, "A"));

            var newNode = node.Split();

            Assert.IsTrue(BTreeTestsUtils.HasBTreeNodeProperties <BTreeNode <int, string>, int, string>(node));
            Assert.IsTrue(BTreeTestsUtils.HasBTreeNodeProperties <BTreeNode <int, string>, int, string>(newNode));
            Assert.AreEqual(2, node.KeyCount);
            Assert.AreEqual(1, newNode.KeyCount);
        }
예제 #18
0
 public void Delete_BiggestKeyInAFullLeaf_ExpectsToReduceBy1Key()
 {
     Assert.IsTrue(_tree.Delete(270));
     BTreeTestsUtils.HasBTreeProperties(_tree, 15, 15, 15);
 }
예제 #19
0
 public void Delete_SmallestKeyInRightSubtreeLeafNode_ExpectsToReduceBy1Key()
 {
     Assert.IsTrue(_tree.Delete(150));
     BTreeTestsUtils.HasBTreeProperties(_tree, 15, 15, 15);
 }
 public void Delete_TheBiggestKeyInLeftSubTree_ExpectsRightRotateAndToReduceBy1Key()
 {
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 25, 16, 17);
     Assert.IsTrue(_tree.Delete(150));
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 24, 15, 17);
 }
예제 #21
0
 public void Build_ExpectsACorrectBTree()
 {
     BTreeTestsUtils.HasBTreeProperties(_tree, 16, 16, 15);
 }
 public void Delete_AKeyFromFullLeaf_ExpectsSimpleDeleteAndToReduceBy1Key()
 {
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 25, 16, 17);
     Assert.IsTrue(_tree.Delete(270));
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 24, 15, 17);
 }
 public void Build_ExpectsACorrectBPlusTree()
 {
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 25, 16, 17);
 }
 public void Delete_TheBiggestKeyInFullLeafNode_ExpectsSimpleDeleteAndToReduceBy1Key()
 {
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 25, 16, 17);
     Assert.IsTrue(_tree.Delete(100));
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 24, 15, 17);
 }
 public void Delete_TheOnlyKeyInLeafNode_ExpectsRightRotationAndToReduceBy1Key()
 {
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 25, 16, 17);
     Assert.IsTrue(_tree.Delete(600));
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 24, 15, 17);
 }
 public void Delete_TheSmallestKeyInAFullLeafNodeOfRightSubtree_ExpectsSimpleDeleteAndToReduceBy1Key()
 {
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 25, 16, 17);
     Assert.IsTrue(_tree.Delete(400));
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 24, 15, 17);
 }
 public void Delete_TheBiggestKeyInLeftMostLeafOnLeftSubtree_ExpectsSimpleDeleteAndToReduceBy1Key()
 {
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 25, 16, 17);
     Assert.IsTrue(_tree.Delete(20));
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 24, 15, 17);
 }
예제 #28
0
 public void Delete_BiggestKeyInTreeLeafNode_ExpectsToReduceBy4NodesAnd1Key()
 {
     Assert.IsTrue(_tree.Delete(600));
     BTreeTestsUtils.HasBTreeProperties(_tree, 15, 15, 11);
 }
 public void Delete_TheSmallestKeyInFullLeafWith2Siblings_ExpectsSimpleDeleteAndToReduceBy1Key()
 {
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 25, 16, 17);
     Assert.IsTrue(_tree.Delete(90));
     BTreeTestsUtils.HasBPlusTreeProperties(_tree, 24, 15, 17);
 }
예제 #30
0
 public void Delete_TheOnlyKeyInParentNodeOfRightMostLeavesOnRightSubtree_ExpectsToReduceBy4NodesAnd1Key()
 {
     Assert.IsTrue(_tree.Delete(500));
     BTreeTestsUtils.HasBTreeProperties(_tree, 15, 15, 11);
 }