Fix various bugs, improve docs, allow 'null' in JSON, specify behaviour of must_match better
This commit is contained in:
parent
8e3383baec
commit
e2cd6caa70
12 changed files with 172 additions and 102 deletions
26
AspectedRouting.Test/MappingTest.cs
Normal file
26
AspectedRouting.Test/MappingTest.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue