Skip to content

Commit

Permalink
f24-p2(test): Sync public tests for Project 2 (#771)
Browse files Browse the repository at this point in the history
* Sync public tests for Project 2

* Sync public tests for Project 2
  • Loading branch information
lanlou1554 authored Nov 17, 2024
1 parent 3d21a8e commit 23d6f2e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions test/storage/b_plus_tree_delete_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace bustub {

using bustub::DiskManagerUnlimitedMemory;

TEST(BPlusTreeTests, DISABLED_DeleteTest) {
TEST(BPlusTreeTests, DISABLED_DeleteTestNoIterator) {
// create KeyComparator and index schema
auto key_schema = ParseCreateStatement("a bigint");
GenericComparator<8> comparator(key_schema.get());
Expand All @@ -34,7 +34,7 @@ TEST(BPlusTreeTests, DISABLED_DeleteTest) {
// allocate header_page
page_id_t page_id = bpm->NewPage();
// create b+ tree
BPlusTree<GenericKey<8>, RID, GenericComparator<8>> tree("foo_pk", page_id, bpm, comparator);
BPlusTree<GenericKey<8>, RID, GenericComparator<8>> tree("foo_pk", page_id, bpm, comparator, 2, 3);
GenericKey<8> index_key;
RID rid;

Expand Down
20 changes: 10 additions & 10 deletions test/storage/b_plus_tree_insert_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace bustub {

using bustub::DiskManagerUnlimitedMemory;

TEST(BPlusTreeTests, DISABLED_InsertTest1) {
TEST(BPlusTreeTests, DISABLED_BasicInsertTest) {
// create KeyComparator and index schema
auto key_schema = ParseCreateStatement("a bigint");
GenericComparator<8> comparator(key_schema.get());
Expand Down Expand Up @@ -56,7 +56,7 @@ TEST(BPlusTreeTests, DISABLED_InsertTest1) {
delete bpm;
}

TEST(BPlusTreeTests, DISABLED_InsertTest2) {
TEST(BPlusTreeTests, DISABLED_InsertTest1NoIterator) {
// create KeyComparator and index schema
auto key_schema = ParseCreateStatement("a bigint");
GenericComparator<8> comparator(key_schema.get());
Expand Down Expand Up @@ -95,7 +95,7 @@ TEST(BPlusTreeTests, DISABLED_InsertTest2) {
delete bpm;
}

TEST(BPlusTreeTests, DISABLED_InsertTest3) {
TEST(BPlusTreeTests, DISABLED_InsertTest2) {
// create KeyComparator and index schema
auto key_schema = ParseCreateStatement("a bigint");
GenericComparator<8> comparator(key_schema.get());
Expand All @@ -105,7 +105,7 @@ TEST(BPlusTreeTests, DISABLED_InsertTest3) {
// allocate header_page
page_id_t page_id = bpm->NewPage();
// create b+ tree
BPlusTree<GenericKey<8>, RID, GenericComparator<8>> tree("foo_pk", page_id, bpm, comparator);
BPlusTree<GenericKey<8>, RID, GenericComparator<8>> tree("foo_pk", page_id, bpm, comparator, 2, 3);
GenericKey<8> index_key;
RID rid;

Expand All @@ -130,24 +130,24 @@ TEST(BPlusTreeTests, DISABLED_InsertTest3) {

int64_t start_key = 1;
int64_t current_key = start_key;
index_key.SetFromInteger(start_key);
for (auto iterator = tree.Begin(index_key); iterator != tree.End(); ++iterator) {
auto location = (*iterator).second;
for (auto iter = tree.Begin(); iter != tree.End(); ++iter) {
auto pair = *iter;
auto location = pair.second;
EXPECT_EQ(location.GetPageId(), 0);
EXPECT_EQ(location.GetSlotNum(), current_key);
++current_key;
current_key = current_key + 1;
}

EXPECT_EQ(current_key, keys.size() + 1);

start_key = 3;
current_key = start_key;
index_key.SetFromInteger(start_key);
for (auto iterator = tree.Begin(index_key); iterator != tree.End(); ++iterator) {
for (auto iterator = tree.Begin(index_key); !iterator.IsEnd(); ++iterator) {
auto location = (*iterator).second;
EXPECT_EQ(location.GetPageId(), 0);
EXPECT_EQ(location.GetSlotNum(), current_key);
++current_key;
current_key = current_key + 1;
}
delete bpm;
}
Expand Down
2 changes: 1 addition & 1 deletion test/storage/b_plus_tree_sequential_scale_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using bustub::DiskManagerUnlimitedMemory;
/**
* (Fall 2024) You should pass this test after finishing insertion and point search.
*/
TEST(BPlusTreeTests, DISABLED_ScaleTest) { // NOLINT
TEST(BPlusTreeTests, DISABLED_BasicScaleTest) { // NOLINT
// create KeyComparator and index schema
auto key_schema = ParseCreateStatement("a bigint");
GenericComparator<8> comparator(key_schema.get());
Expand Down

0 comments on commit 23d6f2e

Please sign in to comment.