Add check that priority is always between -100 and +100, see https://github.com/itinero/routing2/issues/30
This commit is contained in:
parent
ff98d2fcf3
commit
4689760416
2 changed files with 14 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using AspectedRouting.Language;
|
||||
using AspectedRouting.Language.Expression;
|
||||
|
@ -106,9 +107,11 @@ namespace AspectedRouting.Tests
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!actual.ToString().Equals(test.expected) &&
|
||||
!(actual is double actualD && Math.Abs(double.Parse(test.expected) - actualD) < 0.0001)
|
||||
) {
|
||||
|
||||
var doesMatch = (actual is double d && Math.Abs(double.Parse(test.expected) - d) < 0.0001)
|
||||
|| actual.ToString().Equals(test.expected);
|
||||
|
||||
if (!doesMatch) {
|
||||
failed = true;
|
||||
Console.WriteLine(
|
||||
$"[{FunctionToApply.Name}] Line {testCase + 1} failed:\n Expected: {test.expected}\n actual: {actual}\n tags: {test.tags.Pretty()}\n");
|
||||
|
|
|
@ -183,6 +183,14 @@ namespace AspectedRouting.Tests
|
|||
success = false;
|
||||
}
|
||||
|
||||
if (actual.Priority >= 100 || actual.Priority <= -100)
|
||||
{
|
||||
Err($"priority is not within range of -100 and +100. This is needed due to a bug in Itinero2.0, see https://github.com/itinero/routing2/issues/30",
|
||||
actual.Priority + " < 100 && -100 < "+actual.Priority,
|
||||
actual.Priority);
|
||||
success = false;
|
||||
}
|
||||
|
||||
|
||||
if (!success)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue