ready to fix iteration bug
This commit is contained in:
@ -785,12 +785,12 @@ TEST(RemoveTest, RM_2) {
|
|||||||
const std::string db_file_name = "/tmp/bpt16.db";
|
const std::string db_file_name = "/tmp/bpt16.db";
|
||||||
remove(db_file_name.c_str());
|
remove(db_file_name.c_str());
|
||||||
std::vector<std::pair<KeyType, int>> entries;
|
std::vector<std::pair<KeyType, int>> entries;
|
||||||
const int max_keys = 50;
|
const int max_keys = 1000;
|
||||||
const int keys_num_to_remove = 25;
|
const int keys_num_to_remove = 999;
|
||||||
for (int i = 1; i <= max_keys; i++) {
|
for (int i = 1; i <= max_keys; i++) {
|
||||||
KeyType key;
|
KeyType key;
|
||||||
for (size_t j = 0; j < str_len; j++) key.data[j] = 'a' + rnd() % 26;
|
for (size_t j = 0; j < str_len; j++) key.data[j] = 'a' + rnd() % 26;
|
||||||
key.data[8] = '\0';
|
key.data[str_len - 1] = '\0';
|
||||||
entries.push_back(std::make_pair(key, i));
|
entries.push_back(std::make_pair(key, i));
|
||||||
}
|
}
|
||||||
// std::sort(entries.begin(), entries.end());
|
// std::sort(entries.begin(), entries.end());
|
||||||
@ -827,6 +827,9 @@ TEST(RemoveTest, RM_2) {
|
|||||||
bpt.Remove(entries[id].first);
|
bpt.Remove(entries[id].first);
|
||||||
entries.erase(entries.begin() + id);
|
entries.erase(entries.begin() + id);
|
||||||
ASSERT_EQ(bpt.Size(), entries.size());
|
ASSERT_EQ(bpt.Size(), entries.size());
|
||||||
|
for (int j = 0; j < entries.size(); j++) {
|
||||||
|
ASSERT_EQ(bpt.Get(entries[j].first), entries[j].second);
|
||||||
|
}
|
||||||
// {
|
// {
|
||||||
// // checking iteration
|
// // checking iteration
|
||||||
// auto it_std = entries.begin();
|
// auto it_std = entries.begin();
|
||||||
|
Reference in New Issue
Block a user