diff --git a/AspectedRouting/Program.cs b/AspectedRouting/Program.cs index c700cf9..003c371 100644 --- a/AspectedRouting/Program.cs +++ b/AspectedRouting/Program.cs @@ -93,7 +93,7 @@ namespace AspectedRouting private static void Repl(Context c, Dictionary profiles) { - var profile = profiles["bicycle"]; + var profile = profiles["emergency_vehicle"]; var behaviour = profile.Behaviours.Keys.First(); do { @@ -130,12 +130,13 @@ namespace AspectedRouting if (beh.Contains(".")) { var profileName = beh.Split(".")[0]; - if (!profiles.TryGetValue(profileName, out profile)) + if (!profiles.TryGetValue(profileName, out var newProfile)) { Console.Error.WriteLine("Profile " + profileName + " not found, ignoring"); continue; } + profile = newProfile; beh = beh.Substring(beh.IndexOf(".") + 1); } diff --git a/AspectedRouting/Tests/ProfileResult.cs b/AspectedRouting/Tests/ProfileResult.cs index 8439823..6db5499 100644 --- a/AspectedRouting/Tests/ProfileResult.cs +++ b/AspectedRouting/Tests/ProfileResult.cs @@ -18,15 +18,28 @@ namespace AspectedRouting.Tests PriorityExplanation = priorityExplanation; } + private static string str(string s) + { + if (s == null) { + return ""; + } + + if (s == "") { + return ""; + } + + return s; + } + public override string ToString() { return string.Join("\n ", - "access "+Access, - "oneway "+Oneway, + " access "+str(Access), + "oneway "+str(Oneway), "speed "+Speed, "priority "+Priority, - "because \n "+PriorityExplanation + "because \n "+str(PriorityExplanation) ); } }