TEST(BTreeNodeTest, test) { BTreeNodeBuilder<ValueT> builder; builder.set_is_leaf(false); const char *key = "key"; ValueT expected = 3; builder.addEntry(key, expected); stringstream ss; builder.save(ss); BTreeNode<ValueT> node; node.load(ss); ValueT value; node.find(key, value); EXPECT_EQ(expected, value); key = "test"; expected = 0; node.find(key, value); EXPECT_EQ(expected, value); key = "kay"; expected = 3; node.lowerBound(key, value); EXPECT_EQ(expected, value); }
void BTree::remove(string name) { //DELETE AT LEAF BTreeNode* leaf = findNode(root, name); if(leaf->find(name,EXACT)==NOTFOUND){ cout << "TARGET NOT FOUND" << endl; return; } cout << "Found TARGET. Now deleting it. "<< endl; leaf=leaf->remove(name); cout << "DELETE SUCESSFULLY. Now ADJUSTING ROOT" <<endl; AdjustingRoot(leaf); }