Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Gorshenin <y@maps.me>2017-10-23 17:31:36 +0300
committerIlya Zverev <ilya@zverev.info>2017-10-24 17:01:06 +0300
commit32808283c7abab91684d14c7f7c6a7ab874ab446 (patch)
tree2f8a32d73f0a2c2b8e7841ef3bdedf5905c2771a /indexer/indexer_tests
parent1453a18f1bbea5450c4b270fcb3075a7db1cb979 (diff)
Review fixes.
Diffstat (limited to 'indexer/indexer_tests')
-rw-r--r--indexer/indexer_tests/cities_boundaries_serdes_tests.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/indexer/indexer_tests/cities_boundaries_serdes_tests.cpp b/indexer/indexer_tests/cities_boundaries_serdes_tests.cpp
index 0d3821941a..5347573735 100644
--- a/indexer/indexer_tests/cities_boundaries_serdes_tests.cpp
+++ b/indexer/indexer_tests/cities_boundaries_serdes_tests.cpp
@@ -1,7 +1,7 @@
#include "testing/testing.hpp"
-#include "indexer/city_boundary.hpp"
#include "indexer/cities_boundaries_serdes.hpp"
+#include "indexer/city_boundary.hpp"
#include "indexer/coding_params.hpp"
#include "coding/reader.hpp"
@@ -127,4 +127,36 @@ UNIT_TEST(CitiesBoundariesSerDes_Smoke)
TestEncodeDecode(expected);
}
}
+
+UNIT_TEST(CitiesBoundaries_Moscow)
+{
+ vector<m2::PointD> const points = {{37.04001, 67.55964},
+ {37.55650, 66.96428},
+ {38.02513, 67.37082},
+ {37.50865, 67.96618}};
+
+ m2::PointD const target(37.44765, 67.65243);
+
+ vector<uint8_t> buffer;
+ {
+ CityBoundary boundary(points);
+ TEST(boundary.HasPoint(target), ());
+
+ MemWriter<decltype(buffer)> sink(buffer);
+ CitiesBoundariesSerDes::Serialize(sink, {{boundary}});
+ }
+
+ {
+ Boundaries boundaries;
+ double precision;
+
+ MemReader reader(buffer.data(), buffer.size());
+ NonOwningReaderSource source(reader);
+ CitiesBoundariesSerDes::Deserialize(source, boundaries, precision);
+
+ TEST_EQUAL(boundaries.size(), 1, ());
+ TEST_EQUAL(boundaries[0].size(), 1, ());
+ TEST(boundaries[0][0].HasPoint(target, precision), ());
+ }
+}
} // namespace