Key is correct but payload is wrong
zhczhong opened this issue · 0 comments
zhczhong commented
I modify the unit test of alex as follow:
TEST(Alex, TestInsertFromEmpty) {
Alex<int, int> index;
Alex<int, int>::V values[200];
for (int i = 0; i < 200; i++) {
values[i].first = rand() % 500;
values[i].second = i;
}
for (int i = 0; i < 200; i++) {
auto ret = index.insert(values[i].first, values[i].second);
EXPECT_EQ(ret.first.key(), values[i].first);
}
// Check that getting the key is correct.
for (int i = 0; i < 200; i++) {
auto it = index.find(values[i].first);
EXPECT_TRUE(!it.is_end());
EXPECT_EQ(values[i].first, it.key());
EXPECT_EQ(values[i].second, it.payload());
}
}
I just add a line
EXPECT_EQ(values[i].second, it.payload());