From 710355ae61c8511c869c4a14161052d114ce69e1 Mon Sep 17 00:00:00 2001 From: David Mesquita-Morris Date: Tue, 31 May 2016 18:11:08 +0100 Subject: [PATCH] Prep 5.3.3 release --- RELEASES.md | 6 ++++++ src/Tools/Validator.cs | 2 +- {examples => tests}/Florent.cs | 30 +++++++++++++++++++----------- tests/Program.cs | 1 + 4 files changed, 27 insertions(+), 12 deletions(-) rename {examples => tests}/Florent.cs (65%) diff --git a/RELEASES.md b/RELEASES.md index 66bd5ec..da05add 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,9 @@ +# Version 5.3.3 +Fix an omission in the history semantics (allow a history pseudo state to have no outbound transitions). + +# Version 5.3.2 +Fix a bug in dynamic models and enable the removal of model elements. + # Version 5.3.1 Fix a bug in the bootstrap process for Regions. diff --git a/src/Tools/Validator.cs b/src/Tools/Validator.cs index d8e3cff..c15be90 100644 --- a/src/Tools/Validator.cs +++ b/src/Tools/Validator.cs @@ -34,7 +34,7 @@ internal class Validator : Visitor where TInstance : IInst if (pseudoState.Outgoing.Count > 1) { // [1] An initial vertex can have at most one outgoing transition. // [2] History vertices can have at most one outgoing transition. - Console.Error.WriteLine(pseudoState + ": initial pseudo states must have one outgoing transition."); + Console.Error.WriteLine(pseudoState + ": initial/history pseudo states can have at most one outgoing transition."); } else if(pseudoState.Outgoing.Count == 1) { // [9] The outgoing transition from an initial vertex may have a behavior, but not a trigger or guard. if (pseudoState.Outgoing.Single().guard != Transition.TrueGuard) { diff --git a/examples/Florent.cs b/tests/Florent.cs similarity index 65% rename from examples/Florent.cs rename to tests/Florent.cs index ba1834b..f8c04d9 100644 --- a/examples/Florent.cs +++ b/tests/Florent.cs @@ -1,16 +1,17 @@ -using System; +/* + * Finite state machine library + * Copyright (c) 2014-5 Steelbreeze Limited + * Licensed under the MIT and GPL v3 licences + * http://www.steelbreeze.net/state.cs + */ +using System.Diagnostics; using Steelbreeze.StateMachines.Model; +using Steelbreeze.StateMachines.Tools; using Steelbreeze.StateMachines.Runtime; -namespace Steelbreeze.Behavior.StateMachines.Examples { - /// - /// Example machine showing history modelling. - /// +namespace Steelbreeze.StateMachines.Tests { public static class Florent { - /// - /// Entry point - /// - public static void Main() { + public static void Run () { var model = new StateMachine("Model"); var initial = model.CreatePseudoState("Initial", PseudoStateKind.Initial); var on = model.CreateState("On"); @@ -36,6 +37,8 @@ public static class Florent { showItemMovePattern.To(hideItemMovePattern).When(s => s == "ReleaseInput"); hideItemMovePattern.To(idle); + model.Validate(); + var instance = new StateMachineInstance("instance"); model.Initialise(instance); @@ -44,8 +47,13 @@ public static class Florent { model.Evaluate(instance, "Disable"); model.Evaluate(instance, "Enable"); - Console.WriteLine("Press any key..."); - Console.ReadKey(); + Trace.Assert(instance.GetCurrent(on.DefaultRegion) == showItemMovePattern, "History semantics should set current state to " + showItemMovePattern.Name); + + model.Evaluate(instance, "ReleaseInput"); + model.Evaluate(instance, "Disable"); + model.Evaluate(instance, "Enable"); + + Trace.Assert(instance.GetCurrent(on.DefaultRegion) == idle, "History semantics should set current state to " + idle.Name); } } } diff --git a/tests/Program.cs b/tests/Program.cs index c2032ae..e98118a 100644 --- a/tests/Program.cs +++ b/tests/Program.cs @@ -22,6 +22,7 @@ public class Program { Static.Run(); Terminate.Run(); Transitions.Run(); + Florent.Run(); return 0; }