diff options
author | Lev Dragunov <l.dragunov@corp.mail.ru> | 2015-10-27 18:14:56 +0300 |
---|---|---|
committer | Lev Dragunov <l.dragunov@corp.mail.ru> | 2015-10-27 18:19:08 +0300 |
commit | d8de1921c3ffae9cf216a3407ab098a21cdba5a6 (patch) | |
tree | 15675d05c649b673ba616aedc7221bded71d5a67 /routing/routing_tests/cross_routing_tests.cpp | |
parent | af001ed07b3dc6c974c5ad2906d4a25eb63ff874 (diff) |
Cross routing NodeByPoint method test.
Diffstat (limited to 'routing/routing_tests/cross_routing_tests.cpp')
-rw-r--r-- | routing/routing_tests/cross_routing_tests.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/routing/routing_tests/cross_routing_tests.cpp b/routing/routing_tests/cross_routing_tests.cpp index 52d692ea1a..58e3108081 100644 --- a/routing/routing_tests/cross_routing_tests.cpp +++ b/routing/routing_tests/cross_routing_tests.cpp @@ -104,4 +104,31 @@ UNIT_TEST(TestAdjacencyMatrix) routing::kInvalidContextEdgeWeight, ("Default cost")); } +UNIT_TEST(TestFindingByPoint) +{ + routing::CrossRoutingContextWriter context; + routing::CrossRoutingContextReader newContext; + + ms::LatLon p1(1., 1.), p2(5., 5.), p3(10.,1.); + + context.AddIngoingNode(1, ms::LatLon::Zero()); + context.AddIngoingNode(2, p1); + context.AddIngoingNode(3, p2); + context.AddOutgoingNode(4, "foo", ms::LatLon::Zero()); + context.ReserveAdjacencyMatrix(); + + vector<char> buffer; + MemWriter<vector<char> > writer(buffer); + context.Save(writer); + TEST_GREATER(buffer.size(), 5, ("Context serializer make some data")); + + MemReader reader(buffer.data(), buffer.size()); + newContext.Load(reader); + IngoingCrossNode node; + TEST(newContext.FindIngoingNodeByPoint(p1, node), ()); + TEST_EQUAL(node.m_nodeId, 2, ()); + TEST(newContext.FindIngoingNodeByPoint(p2, node), ()); + TEST_EQUAL(node.m_nodeId, 3, ()); + TEST(!newContext.FindIngoingNodeByPoint(p3, node), ()); } +} // namespace |