diff --git a/generator/generator_tests/check_mwms.cpp b/generator/generator_tests/check_mwms.cpp index 9c421dcde0..8596407013 100644 --- a/generator/generator_tests/check_mwms.cpp +++ b/generator/generator_tests/check_mwms.cpp @@ -2,8 +2,12 @@ #include "../../map/feature_vec_model.hpp" +#include "../../indexer/interval_index.hpp" + #include "../../platform/platform.hpp" +#include "../../base/logging.hpp" + UNIT_TEST(CheckMWM_LoadAll) { @@ -27,3 +31,35 @@ UNIT_TEST(CheckMWM_LoadAll) } } } + +UNIT_TEST(CheckMWM_GeomIndex) +{ + // Open mwm file from data path. + FilesContainerR cont(GetPlatform().GetReader("minsk-pass.mwm")); + + // Initialize index reader section inside mwm. + typedef ModelReaderPtr ReaderT; + ReaderT reader = cont.GetReader(INDEX_FILE_TAG); + ReaderSource source(reader); + VarSerialVectorReader treesReader(source); + + // Make interval index objects for each scale bucket. + vector>> scale2Index; + for (size_t i = 0; i < treesReader.Size(); ++i) + scale2Index.emplace_back(new IntervalIndex(treesReader.SubReader(i))); + + // Pass full coverage as input for test. + uint64_t beg = 0; + uint64_t end = static_cast((1ULL << 63) - 1); + + // Count objects for each scale bucket. + map resCount; + for (size_t i = 0; i < scale2Index.size(); ++i) + scale2Index[i]->ForEach([i, &resCount](uint32_t) + { + ++resCount[i]; + }, beg, end); + + // Print results. + LOG(LINFO, (resCount)); +}