Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TEST_F(BTreeTest, Insert2)
- {
- std::string& fn = getFn("Insert2.xibt");
- ByteComparator comparator;
- FileBaseBTree bt(2, 1, &comparator, fn);
- Byte k = 0x03;
- bt.insert(&k);
- k = 0x02;
- bt.insert(&k);
- k = 0x01;
- bt.insert(&k);
- k = 0x04;
- bt.insert(&k);
- FileBaseBTree::PageWrapper wp1(&bt);
- wp1.readPage(1);
- ASSERT_EQ(wp1.getKeysNum(), 1);
- ASSERT_EQ(*(wp1.getKey(0)),0x01);
- ASSERT_TRUE(wp1.isLeaf());
- wp1.readPage(2);
- ASSERT_EQ(wp1.getKeysNum(), 1);
- ASSERT_EQ(*(wp1.getKey(0)),0x02);
- ASSERT_EQ(wp1.getCursor(0), 1);
- ASSERT_EQ(wp1.getCursor(1), 3);
- ASSERT_TRUE(wp1.isRoot());
- wp1.readPage(3);
- ASSERT_EQ(wp1.getKeysNum(), 2);
- ASSERT_EQ(*(wp1.getKey(0)),0x03);
- ASSERT_EQ(*(wp1.getKey(1)),0x04);
- ASSERT_TRUE(wp1.isLeaf());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement