From f003662d8c18b75c80220df840398417aeda296a Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Tue, 17 Nov 2020 15:57:22 +0100 Subject: [PATCH] Assume not oneway by default --- AspectedRouting.Test/FunctionsTest.cs | 8 ++++++++ AspectedRouting/IO/itinero1/LuaPrinter1.MainFunction.cs | 9 +++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/AspectedRouting.Test/FunctionsTest.cs b/AspectedRouting.Test/FunctionsTest.cs index 35fb7d5..f01bf0e 100644 --- a/AspectedRouting.Test/FunctionsTest.cs +++ b/AspectedRouting.Test/FunctionsTest.cs @@ -20,6 +20,14 @@ namespace AspectedRouting.Test return JsonParser.AspectFromJson(new Context(), json, "test.json"); } + private IExpression MustMatchJsonWithOr() + { + var json = "{" + + "\"name\":\"test\"," + + "\"description\":\"test\"," + + "\"$mustMatch\":{\"a\":\"b\",\"x\":\"y\"}}"; + return JsonParser.AspectFromJson(new Context(), json, "test.json"); + } [Fact] public void TestAll_AllTags_Yes() diff --git a/AspectedRouting/IO/itinero1/LuaPrinter1.MainFunction.cs b/AspectedRouting/IO/itinero1/LuaPrinter1.MainFunction.cs index cbb337b..52853f9 100644 --- a/AspectedRouting/IO/itinero1/LuaPrinter1.MainFunction.cs +++ b/AspectedRouting/IO/itinero1/LuaPrinter1.MainFunction.cs @@ -87,14 +87,11 @@ namespace AspectedRouting.IO.itinero1 " result.speed = speed", " result.factor = 1 / priority", "", - " if (oneway == \"both\") then", - " result.direction = 0", - " elseif (oneway == \"with\") then", + " result.direction = 0", + " if (oneway == \"with\" or oneway == \"yes\") then", " result.direction = 1", - " elseif (oneway == \"against\") then", + " if (oneway == \"against\" or oneway == \"-1\") then", " result.direction = 2", - " else", - " error(\"Unexpected value for oneway: \"..oneway)", " end", "", "end"