Skip to content

Commit

Permalink
Prep 5.3.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
David Mesquita-Morris committed May 31, 2016
1 parent 66c7d61 commit 710355a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
6 changes: 6 additions & 0 deletions 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.

Expand Down
2 changes: 1 addition & 1 deletion src/Tools/Validator.cs
Expand Up @@ -34,7 +34,7 @@ internal class Validator<TInstance> : Visitor<TInstance> 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<TInstance>.TrueGuard) {
Expand Down
30 changes: 19 additions & 11 deletions examples/Florent.cs → 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 {
/// <summary>
/// Example machine showing history modelling.
/// </summary>
namespace Steelbreeze.StateMachines.Tests {
public static class Florent {
/// <summary>
/// Entry point
/// </summary>
public static void Main() {
public static void Run () {
var model = new StateMachine<StateMachineInstance>("Model");
var initial = model.CreatePseudoState("Initial", PseudoStateKind.Initial);
var on = model.CreateState("On");
Expand All @@ -36,6 +37,8 @@ public static class Florent {
showItemMovePattern.To(hideItemMovePattern).When<string>(s => s == "ReleaseInput");
hideItemMovePattern.To(idle);

model.Validate();

var instance = new StateMachineInstance("instance");

model.Initialise(instance);
Expand All @@ -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);
}
}
}
1 change: 1 addition & 0 deletions tests/Program.cs
Expand Up @@ -22,6 +22,7 @@ public class Program {
Static.Run();
Terminate.Run();
Transitions.Run();
Florent.Run();

return 0;
}
Expand Down

0 comments on commit 710355a

Please sign in to comment.