Review fixes.

This commit is contained in:
Vladimir Byko-Ianko 2018-09-11 18:03:19 +03:00 committed by mpimenov
parent dc465299ef
commit 5d4b9079e6
3 changed files with 15 additions and 2 deletions

View file

@ -94,7 +94,8 @@ void TestCityRoadsBuilding(vector<uint64_t> && cityRoadFeatureIds)
sort(originalCityRoadFeatureIds.begin(), originalCityRoadFeatureIds.end());
size_t const kMaxRoadFeatureId = originalCityRoadFeatureIds.back();
CHECK_LESS(kMaxRoadFeatureId, numeric_limits<uint32_t>::max(), ());
for (uint32_t fid = 0; fid < kMaxRoadFeatureId; ++fid)
// Note. 2 is added below to test all the if-branches of CityRoadsLoader::IsCityRoad() method.
for (uint32_t fid = 0; fid < kMaxRoadFeatureId + 2; ++fid)
{
bool const isCityRoad =
binary_search(originalCityRoadFeatureIds.cbegin(), originalCityRoadFeatureIds.cend(), fid);

View file

@ -5,6 +5,8 @@
#include "coding/reader.hpp"
#include "coding/succinct_mapper.hpp"
#include "base/logging.hpp"
#include <utility>
namespace routing
@ -39,4 +41,14 @@ CityRoadsLoader::CityRoadsLoader(DataSource const & dataSource, MwmSet::MwmId co
"section.", e.Msg()));
}
}
bool CityRoadsLoader::IsCityRoad(uint32_t fid) const
{
if (fid < m_cityRoads.size())
return m_cityRoads[fid];
else if (fid == m_cityRoads.size())
return true;
else
return false;
}
} // namespace routing

View file

@ -47,7 +47,7 @@ public:
CityRoadsLoader(DataSource const & dataSource, MwmSet::MwmId const & mwmId);
bool HasCityRoads() const { return m_cityRoads.size() > 0; }
bool IsCityRoad(uint32_t fid) const { return m_cityRoads[fid]; }
bool IsCityRoad(uint32_t fid) const;
private:
std::unique_ptr<CopiedMemoryRegion> m_cityRoadsRegion;