Fix various bugs, improve docs, allow 'null' in JSON, specify behaviour of must_match better

This commit is contained in:
Pieter Vander Vennet 2021-04-03 19:11:41 +02:00
parent 8e3383baec
commit e2cd6caa70
12 changed files with 172 additions and 102 deletions

View file

@ -0,0 +1,26 @@
using AspectedRouting.Language;
using AspectedRouting.Language.Functions;
using Xunit;
namespace AspectedRouting.Test
{
public class MappingTest
{
[Fact]
public static void SimpleMapping_SimpleHighway_GivesResult()
{
var maxspeed = new Mapping(new[] {"residential", "living_street"},
new[] {
new Constant(30),
new Constant(20)
}
);
var resMaxspeed= maxspeed.Evaluate(new Context(), new Constant("residential"));
Assert.Equal(30, resMaxspeed);
var livingStreetMaxspeed= maxspeed.Evaluate(new Context(), new Constant("living_street"));
Assert.Equal(20, livingStreetMaxspeed);
var undefinedSpeed = maxspeed.Evaluate(new Context(), new Constant("some_unknown_highway_type"));
Assert.Null(undefinedSpeed);
}
}
}