Fixes bearing range of zero exhaustive graph traversal

This commit is contained in:
Daniel J. Hofmann 2016-09-08 17:19:48 +02:00 committed by Moritz Kobitzsch
parent c306a59854
commit a289e1cd96
3 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,7 @@
- Fixed an issue that could emit `invalid` as instruction when ending on a sliproad after a traffic-light
- Fixed an issue that would detect turning circles as sliproads
- Fixed a bug where post-processing instructions (e.g. left + left -> uturn) could result in false pronunciations
- Fixes a bug where a bearing range of zero would cause exhaustive graph traversals
# 5.3.0
Changes from 5.3.0-rc.3

View File

@ -67,7 +67,7 @@ inline bool CheckInBounds(const int A, const int B, const int range)
if (range >= 180)
return true;
if (range <= 0)
if (range < 0)
return false;
// Map both bearings into positive modulo 360 space

View File

@ -42,6 +42,9 @@ BOOST_AUTO_TEST_CASE(bearing_range_test)
BOOST_CHECK_EQUAL(true, bearing::CheckInBounds(-721, 5, 10));
BOOST_CHECK_EQUAL(true, bearing::CheckInBounds(719, 5, 10));
BOOST_CHECK_EQUAL(false, bearing::CheckInBounds(1, 1, -1));
BOOST_CHECK_EQUAL(true, bearing::CheckInBounds(1, 1, 0));
}
BOOST_AUTO_TEST_SUITE_END()