@@ -23,7 +23,7 @@ namespace bustub {
23
23
24
24
using bustub::DiskManagerUnlimitedMemory;
25
25
26
- TEST (BPlusTreeTests, DISABLED_InsertTest1 ) {
26
+ TEST (BPlusTreeTests, DISABLED_BasicInsertTest ) {
27
27
// create KeyComparator and index schema
28
28
auto key_schema = ParseCreateStatement (" a bigint" );
29
29
GenericComparator<8 > comparator (key_schema.get ());
@@ -56,7 +56,7 @@ TEST(BPlusTreeTests, DISABLED_InsertTest1) {
56
56
delete bpm;
57
57
}
58
58
59
- TEST (BPlusTreeTests, DISABLED_InsertTest2 ) {
59
+ TEST (BPlusTreeTests, DISABLED_InsertTest1NoIterator ) {
60
60
// create KeyComparator and index schema
61
61
auto key_schema = ParseCreateStatement (" a bigint" );
62
62
GenericComparator<8 > comparator (key_schema.get ());
@@ -95,7 +95,7 @@ TEST(BPlusTreeTests, DISABLED_InsertTest2) {
95
95
delete bpm;
96
96
}
97
97
98
- TEST (BPlusTreeTests, DISABLED_InsertTest3 ) {
98
+ TEST (BPlusTreeTests, DISABLED_InsertTest2 ) {
99
99
// create KeyComparator and index schema
100
100
auto key_schema = ParseCreateStatement (" a bigint" );
101
101
GenericComparator<8 > comparator (key_schema.get ());
@@ -105,7 +105,7 @@ TEST(BPlusTreeTests, DISABLED_InsertTest3) {
105
105
// allocate header_page
106
106
page_id_t page_id = bpm->NewPage ();
107
107
// 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 );
109
109
GenericKey<8 > index_key;
110
110
RID rid;
111
111
@@ -130,24 +130,24 @@ TEST(BPlusTreeTests, DISABLED_InsertTest3) {
130
130
131
131
int64_t start_key = 1 ;
132
132
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 ;
136
136
EXPECT_EQ (location.GetPageId (), 0 );
137
137
EXPECT_EQ (location.GetSlotNum (), current_key);
138
- ++ current_key;
138
+ current_key = current_key + 1 ;
139
139
}
140
140
141
141
EXPECT_EQ (current_key, keys.size () + 1 );
142
142
143
143
start_key = 3 ;
144
144
current_key = start_key;
145
145
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) {
147
147
auto location = (*iterator).second ;
148
148
EXPECT_EQ (location.GetPageId (), 0 );
149
149
EXPECT_EQ (location.GetSlotNum (), current_key);
150
- ++ current_key;
150
+ current_key = current_key + 1 ;
151
151
}
152
152
delete bpm;
153
153
}
0 commit comments