[indexer] Fix for review

This commit is contained in:
Anatoly Serdtcev 2019-01-28 16:19:11 +03:00 committed by Sergey Yershov
parent e8cc2081d1
commit 3482321180
3 changed files with 26 additions and 26 deletions

View file

@ -29,7 +29,7 @@ struct CellIdFeaturePairForTest
uint32_t m_value;
};
auto indexValueInserter = [](auto & values)
auto IndexValueInserter(auto & values)
{
return [inserter = base::MakeBackInsertFunctor(values)] (uint64_t, auto value) { inserter(value); };
};
@ -139,7 +139,7 @@ UNIT_TEST(IntervalIndex_Serialized)
uint32_t expected [] = {0, 1, 2};
vector<uint32_t> values;
TEST_EQUAL(index.KeyEnd(), 0x10000, ());
index.ForEach(indexValueInserter(values), 0, 0x10000);
index.ForEach(IndexValueInserter(values), 0, 0x10000);
TEST_EQUAL(values, vector<uint32_t>(expected, expected + ARRAY_SIZE(expected)), ());
}
@ -158,41 +158,41 @@ UNIT_TEST(IntervalIndex_Simple)
{
uint32_t expected [] = {0, 1, 2};
vector<uint32_t> values;
index.ForEach(indexValueInserter(values), 0ULL, index.KeyEnd());
index.ForEach(IndexValueInserter(values), 0ULL, index.KeyEnd());
TEST_EQUAL(values, vector<uint32_t>(expected, expected + ARRAY_SIZE(expected)), ());
}
{
uint32_t expected [] = {0, 1};
vector<uint32_t> values;
index.ForEach(indexValueInserter(values), 0xA0B1C2D100ULL, 0xA0B1C2D201ULL);
index.ForEach(IndexValueInserter(values), 0xA0B1C2D100ULL, 0xA0B1C2D201ULL);
TEST_EQUAL(values, vector<uint32_t>(expected, expected + ARRAY_SIZE(expected)), ());
}
{
uint32_t expected [] = {0, 1};
vector<uint32_t> values;
index.ForEach(indexValueInserter(values), 0x0ULL, 0xA0B1C30000ULL);
index.ForEach(IndexValueInserter(values), 0x0ULL, 0xA0B1C30000ULL);
TEST_EQUAL(values, vector<uint32_t>(expected, expected + ARRAY_SIZE(expected)), ());
}
{
uint32_t expected [] = {0};
vector<uint32_t> values;
index.ForEach(indexValueInserter(values), 0xA0B1C2D100ULL, 0xA0B1C2D101ULL);
index.ForEach(IndexValueInserter(values), 0xA0B1C2D100ULL, 0xA0B1C2D101ULL);
TEST_EQUAL(values, vector<uint32_t>(expected, expected + ARRAY_SIZE(expected)), ());
}
{
uint32_t expected [] = {0};
vector<uint32_t> values;
index.ForEach(indexValueInserter(values), 0xA0B1C2D100ULL, 0xA0B1C2D200ULL);
index.ForEach(IndexValueInserter(values), 0xA0B1C2D100ULL, 0xA0B1C2D200ULL);
TEST_EQUAL(values, vector<uint32_t>(expected, expected + ARRAY_SIZE(expected)), ());
}
{
vector<uint32_t> values;
index.ForEach(indexValueInserter(values), 0xA0B1C2D100ULL, 0xA0B1C2D100ULL);
index.ForEach(IndexValueInserter(values), 0xA0B1C2D100ULL, 0xA0B1C2D100ULL);
TEST_EQUAL(values, vector<uint32_t>(), ());
}
{
vector<uint32_t> values;
index.ForEach(indexValueInserter(values), 0xA0B1000000ULL, 0xA0B1B20000ULL);
index.ForEach(IndexValueInserter(values), 0xA0B1000000ULL, 0xA0B1B20000ULL);
TEST_EQUAL(values, vector<uint32_t>(), ());
}
}
@ -207,7 +207,7 @@ UNIT_TEST(IntervalIndex_Empty)
IntervalIndex<MemReader, uint32_t> index(reader);
{
vector<uint32_t> values;
index.ForEach(indexValueInserter(values), 0ULL, 0xFFFFFFFFFFULL);
index.ForEach(IndexValueInserter(values), 0ULL, 0xFFFFFFFFFFULL);
TEST_EQUAL(values, vector<uint32_t>(), ());
}
}
@ -227,7 +227,7 @@ UNIT_TEST(IntervalIndex_Simple2)
{
uint32_t expected [] = {0, 1, 2, 3};
vector<uint32_t> values;
index.ForEach(indexValueInserter(values), 0, 0xFFFFFFFFFFULL);
index.ForEach(IndexValueInserter(values), 0, 0xFFFFFFFFFFULL);
sort(values.begin(), values.end());
TEST_EQUAL(values, vector<uint32_t>(expected, expected + ARRAY_SIZE(expected)), ());
}
@ -246,7 +246,7 @@ UNIT_TEST(IntervalIndex_Simple3)
{
uint32_t expected [] = {0, 1};
vector<uint32_t> values;
index.ForEach(indexValueInserter(values), 0, 0xFFFFULL);
index.ForEach(IndexValueInserter(values), 0, 0xFFFFULL);
sort(values.begin(), values.end());
TEST_EQUAL(values, vector<uint32_t>(expected, expected + ARRAY_SIZE(expected)), ());
}
@ -265,7 +265,7 @@ UNIT_TEST(IntervalIndex_Simple4)
{
uint32_t expected [] = {0, 1};
vector<uint32_t> values;
index.ForEach(indexValueInserter(values), 0, 0xFFFFFFFFULL);
index.ForEach(IndexValueInserter(values), 0, 0xFFFFFFFFULL);
sort(values.begin(), values.end());
TEST_EQUAL(values, vector<uint32_t>(expected, expected + ARRAY_SIZE(expected)), ());
}
@ -286,7 +286,7 @@ UNIT_TEST(IntervalIndex_Simple5)
{
uint32_t expected [] = {0, 1, 2, 3};
vector<uint32_t> values;
index.ForEach(indexValueInserter(values), 0, 0xFFFFFFFFFFULL);
index.ForEach(IndexValueInserter(values), 0, 0xFFFFFFFFFFULL);
sort(values.begin(), values.end());
TEST_EQUAL(values, vector<uint32_t>(expected, expected + ARRAY_SIZE(expected)), ());
}

View file

@ -78,8 +78,8 @@ UNIT_TEST(BuildLocalityIndexTest)
objects.m_objects[2].SetForTesting(3, m2::PointD{1, 1});
objects.m_objects[3].SetForTesting(4, m2::PointD{0, 1});
vector<char> localityIndex;
MemWriter<vector<char>> writer(localityIndex);
vector<uint8_t> localityIndex;
MemWriter<vector<uint8_t>> writer(localityIndex);
BuildGeoObjectsIndex(objects, writer, "tmp");
MemReader reader(localityIndex.data(), localityIndex.size());
@ -99,8 +99,8 @@ UNIT_TEST(LocalityIndexRankTest)
objects.m_objects[2].SetForTesting(3, m2::PointD{3, 0});
objects.m_objects[3].SetForTesting(4, m2::PointD{4, 0});
vector<char> localityIndex;
MemWriter<vector<char>> writer(localityIndex);
vector<uint8_t> localityIndex;
MemWriter<vector<uint8_t>> writer(localityIndex);
BuildGeoObjectsIndex(objects, writer, "tmp");
MemReader reader(localityIndex.data(), localityIndex.size());
@ -139,8 +139,8 @@ UNIT_TEST(LocalityIndexTopSizeTest)
// The big object contains all points and must be returned on any query.
objects.m_objects[7].SetForTesting(8, m2::RectD{0.0, 0.0, 10.0, 10.0});
vector<char> localityIndex;
MemWriter<vector<char>> writer(localityIndex);
vector<uint8_t> localityIndex;
MemWriter<vector<uint8_t>> writer(localityIndex);
BuildGeoObjectsIndex(objects, writer, "tmp");
MemReader reader(localityIndex.data(), localityIndex.size());
@ -202,8 +202,8 @@ UNIT_TEST(LocalityIndexWeightRankTest)
objects.m_objects[5].SetForTesting(6, m2::PointD{1, 1});
objects.m_objects[6].SetForTesting(7, m2::RectD{1, 0, 1.1, 0.1});
vector<char> localityIndex;
MemWriter<vector<char>> writer(localityIndex);
vector<uint8_t> localityIndex;
MemWriter<vector<uint8_t>> writer(localityIndex);
BuildGeoObjectsIndex(objects, writer, "tmp");
MemReader reader(localityIndex.data(), localityIndex.size());

View file

@ -74,8 +74,8 @@ public:
private:
template <typename F>
void ForEachLeaf(F const & f, uint64_t const beg, uint64_t const end,
uint32_t const offset, uint32_t const size,
uint64_t keyBase /* discarded part of object key value in the parent nodes*/) const
uint32_t const offset, uint32_t const size,
uint64_t keyBase /* discarded part of object key value in the parent nodes*/) const
{
buffer_vector<uint8_t, 1024> data;
data.resize_no_init(size);
@ -100,8 +100,8 @@ private:
template <typename F>
void ForEachNode(F const & f, uint64_t beg, uint64_t end, int level,
uint32_t offset, uint32_t size,
uint64_t keyBase /* discarded part of object key value in the parent nodes */) const
uint32_t offset, uint32_t size,
uint64_t keyBase /* discarded part of object key value in the parent nodes */) const
{
offset += m_LevelOffsets[level];