Skip to content

Commit 25cb2b8

Browse files
committed
Sync public tests for Project 2
1 parent 2dd141e commit 25cb2b8

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

test/storage/b_plus_tree_delete_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace bustub {
2424

2525
using bustub::DiskManagerUnlimitedMemory;
2626

27-
TEST(BPlusTreeTests, DISABLED_DeleteTest) {
27+
TEST(BPlusTreeTests, DISABLED_DeleteTestNoIterator) {
2828
// create KeyComparator and index schema
2929
auto key_schema = ParseCreateStatement("a bigint");
3030
GenericComparator<8> comparator(key_schema.get());

test/storage/b_plus_tree_insert_test.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace bustub {
2323

2424
using bustub::DiskManagerUnlimitedMemory;
2525

26-
TEST(BPlusTreeTests, DISABLED_InsertTest1) {
26+
TEST(BPlusTreeTests, DISABLED_BasicInsertTest) {
2727
// create KeyComparator and index schema
2828
auto key_schema = ParseCreateStatement("a bigint");
2929
GenericComparator<8> comparator(key_schema.get());
@@ -56,7 +56,7 @@ TEST(BPlusTreeTests, DISABLED_InsertTest1) {
5656
delete bpm;
5757
}
5858

59-
TEST(BPlusTreeTests, DISABLED_InsertTest2) {
59+
TEST(BPlusTreeTests, DISABLED_InsertTest1NoIterator) {
6060
// create KeyComparator and index schema
6161
auto key_schema = ParseCreateStatement("a bigint");
6262
GenericComparator<8> comparator(key_schema.get());
@@ -95,7 +95,7 @@ TEST(BPlusTreeTests, DISABLED_InsertTest2) {
9595
delete bpm;
9696
}
9797

98-
TEST(BPlusTreeTests, DISABLED_InsertTest3) {
98+
TEST(BPlusTreeTests, DISABLED_InsertTest2) {
9999
// create KeyComparator and index schema
100100
auto key_schema = ParseCreateStatement("a bigint");
101101
GenericComparator<8> comparator(key_schema.get());
@@ -105,7 +105,7 @@ TEST(BPlusTreeTests, DISABLED_InsertTest3) {
105105
// allocate header_page
106106
page_id_t page_id = bpm->NewPage();
107107
// create b+ tree
108-
BPlusTree<GenericKey<8>, RID, GenericComparator<8>> tree("foo_pk", page_id, bpm, comparator);
108+
BPlusTree<GenericKey<8>, RID, GenericComparator<8>> tree("foo_pk", page_id, bpm, comparator, 2, 3);
109109
GenericKey<8> index_key;
110110
RID rid;
111111

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

131131
int64_t start_key = 1;
132132
int64_t current_key = start_key;
133-
index_key.SetFromInteger(start_key);
134-
for (auto iterator = tree.Begin(index_key); iterator != tree.End(); ++iterator) {
135-
auto location = (*iterator).second;
133+
for (auto iter = tree.Begin(); iter != tree.End(); ++iter) {
134+
auto pair = *iter;
135+
auto location = pair.second;
136136
EXPECT_EQ(location.GetPageId(), 0);
137137
EXPECT_EQ(location.GetSlotNum(), current_key);
138-
++current_key;
138+
current_key = current_key + 1;
139139
}
140140

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

143143
start_key = 3;
144144
current_key = start_key;
145145
index_key.SetFromInteger(start_key);
146-
for (auto iterator = tree.Begin(index_key); iterator != tree.End(); ++iterator) {
146+
for (auto iterator = tree.Begin(index_key); !iterator.IsEnd(); ++iterator) {
147147
auto location = (*iterator).second;
148148
EXPECT_EQ(location.GetPageId(), 0);
149149
EXPECT_EQ(location.GetSlotNum(), current_key);
150-
++current_key;
150+
current_key = current_key + 1;
151151
}
152152
delete bpm;
153153
}

test/storage/b_plus_tree_sequential_scale_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ using bustub::DiskManagerUnlimitedMemory;
2727
/**
2828
* (Fall 2024) You should pass this test after finishing insertion and point search.
2929
*/
30-
TEST(BPlusTreeTests, DISABLED_ScaleTest) { // NOLINT
30+
TEST(BPlusTreeTests, DISABLED_BasicScaleTest) { // NOLINT
3131
// create KeyComparator and index schema
3232
auto key_schema = ParseCreateStatement("a bigint");
3333
GenericComparator<8> comparator(key_schema.get());

0 commit comments

Comments
 (0)