Fix tests: some relation tags wouldn't be included in the lua testing, causing the tests to fail
This commit is contained in:
parent
f343637f21
commit
00fa1a8b67
3 changed files with 14 additions and 4 deletions
|
@ -23,14 +23,16 @@ namespace AspectedRouting.IO.itinero1
|
||||||
|
|
||||||
|
|
||||||
var aspectTestSuite =
|
var aspectTestSuite =
|
||||||
string.Join("\n\n", aspectTests
|
string.Join("\n\n",
|
||||||
|
aspectTests
|
||||||
.Where(x => x != null)
|
.Where(x => x != null)
|
||||||
.Select(
|
.Select(
|
||||||
GenerateAspectTestSuite
|
GenerateAspectTestSuite
|
||||||
));
|
));
|
||||||
|
|
||||||
var profileTestSuite =
|
var profileTestSuite =
|
||||||
string.Join("\n\n", profileTests
|
string.Join("\n\n",
|
||||||
|
profileTests
|
||||||
.Where(x => x != null)
|
.Where(x => x != null)
|
||||||
.Select(
|
.Select(
|
||||||
t => GenerateProfileTestSuite(t, invertPriority)
|
t => GenerateProfileTestSuite(t, invertPriority)
|
||||||
|
@ -79,6 +81,9 @@ namespace AspectedRouting.IO.itinero1
|
||||||
foreach (var key in keysToCheck)
|
foreach (var key in keysToCheck)
|
||||||
{
|
{
|
||||||
var newKey = key.Replace(".", "_");
|
var newKey = key.Replace(".", "_");
|
||||||
|
if (newKey == key) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
tags[newKey] = tags[key];
|
tags[newKey] = tags[key];
|
||||||
tags.Remove(key);
|
tags.Remove(key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ namespace AspectedRouting.IO.itinero2
|
||||||
_skeleton.AddDependenciesFor(_profile.Speed);
|
_skeleton.AddDependenciesFor(_profile.Speed);
|
||||||
|
|
||||||
_skeleton.AddDep("eq");
|
_skeleton.AddDep("eq");
|
||||||
|
_skeleton.AddDep("remove_relation_prefix");
|
||||||
var code = new List<string>
|
var code = new List<string>
|
||||||
{
|
{
|
||||||
"--[[",
|
"--[[",
|
||||||
|
@ -91,6 +92,9 @@ namespace AspectedRouting.IO.itinero2
|
||||||
"]]",
|
"]]",
|
||||||
"function factor(tags, result)",
|
"function factor(tags, result)",
|
||||||
" ",
|
" ",
|
||||||
|
" -- Cleanup the relation tags to make them usable with this profile",
|
||||||
|
$" tags = remove_relation_prefix(tags, \"{_behaviourName}\")",
|
||||||
|
" ",
|
||||||
" -- initialize the result table on the default values",
|
" -- initialize the result table on the default values",
|
||||||
" result.forward_speed = 0",
|
" result.forward_speed = 0",
|
||||||
" result.backward_speed = 0",
|
" result.backward_speed = 0",
|
||||||
|
|
|
@ -64,8 +64,9 @@ namespace AspectedRouting.IO.itinero2
|
||||||
$"description = \"{profileDescr} ({_profile.Description})\""
|
$"description = \"{profileDescr} ({_profile.Description})\""
|
||||||
};
|
};
|
||||||
|
|
||||||
var tests = new LuaTestPrinter(_skeleton,
|
var testPrinter = new LuaTestPrinter(_skeleton,
|
||||||
new List<string>() {"unitTestProfile2"}).GenerateFullTestSuite(
|
new List<string>() {"unitTestProfile2"});
|
||||||
|
var tests = testPrinter.GenerateFullTestSuite(
|
||||||
_behaviourTestSuite.ToList(),
|
_behaviourTestSuite.ToList(),
|
||||||
new List<AspectTestSuite>(),
|
new List<AspectTestSuite>(),
|
||||||
true);
|
true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue