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:
authorLev Dragunov <l.dragunov@corp.mail.ru>2015-07-21 13:47:40 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:56:55 +0300
commit104140a94d9b825f2d067912857e3d59d47138a4 (patch)
tree13dfc52e8e6fbead5c8a92c06883bad7c727da42 /routing/routing_tests/astar_progress_test.cpp
parent84c0f7088a9011385d8eaf8c62a28745b9f64649 (diff)
Make progress increase monotonically.
Diffstat (limited to 'routing/routing_tests/astar_progress_test.cpp')
-rw-r--r--routing/routing_tests/astar_progress_test.cpp41
1 files changed, 36 insertions, 5 deletions
diff --git a/routing/routing_tests/astar_progress_test.cpp b/routing/routing_tests/astar_progress_test.cpp
index 926fd96606..84daaf70fb 100644
--- a/routing/routing_tests/astar_progress_test.cpp
+++ b/routing/routing_tests/astar_progress_test.cpp
@@ -13,13 +13,44 @@ UNIT_TEST(DirectedAStarProgressCheck)
m2::PointD middle = m2::PointD(0, 2);
AStarProgress progress(0, 100);
- progress.Initialise(start, finish);
+ progress.Initialize(start, finish);
TEST_LESS(progress.GetProgressForDirectedAlgo(start), 0.1f, ());
TEST_LESS(progress.GetProgressForDirectedAlgo(middle), 50.5f, ());
TEST_GREATER(progress.GetProgressForDirectedAlgo(middle), 49.5f, ());
TEST_GREATER(progress.GetProgressForDirectedAlgo(finish), 99.9f, ());
}
+UNIT_TEST(DirectedAStarDegradationCheck)
+{
+ m2::PointD start = m2::PointD(0, 1);
+ m2::PointD finish = m2::PointD(0, 3);
+ m2::PointD middle = m2::PointD(0, 2);
+
+ AStarProgress progress(0, 100);
+ progress.Initialize(start, finish);
+ auto value1 = progress.GetProgressForDirectedAlgo(middle);
+ auto value2 = progress.GetProgressForDirectedAlgo(start);
+ TEST_LESS_OR_EQUAL(value1, value2, ());
+
+ progress.Initialize(start, finish);
+ auto value3 = progress.GetProgressForDirectedAlgo(start);
+ TEST_GREATER_OR_EQUAL(value1, value3, ());
+}
+
+UNIT_TEST(RangeCheckTest)
+{
+ m2::PointD start = m2::PointD(0, 1);
+ m2::PointD finish = m2::PointD(0, 3);
+ m2::PointD preStart = m2::PointD(0, 0);
+ m2::PointD postFinish = m2::PointD(0, 6);
+
+ AStarProgress progress(0, 100);
+ progress.Initialize(start, finish);
+ TEST_EQUAL(progress.GetProgressForDirectedAlgo(preStart), 0.0, ());
+ TEST_EQUAL(progress.GetProgressForDirectedAlgo(postFinish), 0.0, ());
+ TEST_EQUAL(progress.GetProgressForDirectedAlgo(finish), 100.0, ());
+}
+
UNIT_TEST(DirectedAStarProgressCheckAtShiftedInterval)
{
m2::PointD start = m2::PointD(0, 1);
@@ -27,7 +58,7 @@ UNIT_TEST(DirectedAStarProgressCheckAtShiftedInterval)
m2::PointD middle = m2::PointD(0, 2);
AStarProgress progress(50, 250);
- progress.Initialise(start, finish);
+ progress.Initialize(start, finish);
TEST_LESS(progress.GetProgressForDirectedAlgo(start), 50.1f, ());
TEST_LESS(progress.GetProgressForDirectedAlgo(middle), 150.5f, ());
TEST_GREATER(progress.GetProgressForDirectedAlgo(middle), 145.5f, ());
@@ -42,10 +73,10 @@ UNIT_TEST(BidirectedAStarProgressCheck)
m2::PointD bWave = m2::PointD(0, 3);
AStarProgress progress(0.0f, 100.0f);
- progress.Initialise(start, finish);
+ progress.Initialize(start, finish);
progress.GetProgressForBidirectedAlgo(fWave, finish);
float result = progress.GetProgressForBidirectedAlgo(bWave, start);
- ASSERT_GREATER(result, 49.5, ());
- ASSERT_LESS(result, 50.5, ());
+ TEST_GREATER(result, 49.5, ());
+ TEST_LESS(result, 50.5, ());
}
} // namespace routing_test