Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "test-framework"]
path = test-framework
url = https://gitlab.com/scion-scxml/test-framework.git
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"editor.tabSize": 4
}
50 changes: 49 additions & 1 deletion ConsoleRunner/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using StateChartsDotNet.CoreEngine.ModelProvider.Xml;
using StateChartsDotNet.CoreEngine.Abstractions;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace ConsoleRunner
{
Expand All @@ -14,6 +16,30 @@ public class Foo
public dynamic data;
}

public class ScxmlTestEventObject
{
[JsonPropertyName("name")]
public string Name { get; set; }
}

public class ScxmlTestEvent
{
[JsonPropertyName("event")]
public ScxmlTestEventObject Event { get; set; }

[JsonPropertyName("nextConfiguration")]
public List<string> NextConfiguration { get; set; }
}

public class ScxmlTest
{
[JsonPropertyName("initialConfiguration")]
public List<string> InitialConfiguration { get; set; }

[JsonPropertyName("events")]
public List<ScxmlTestEvent> Events { get; set; }
}

class Program
{
static void Main(string[] args)
Expand All @@ -30,7 +56,9 @@ static void Main(string[] args)
{
//task = RunMicrowave(logger);

task = RunForeach(logger);
// task = RunForeach(logger);

task = RunScxmlTests(logger);
}

Task.WaitAll(Task.Delay(5000), task);
Expand Down Expand Up @@ -59,6 +87,26 @@ static Task RunMicrowave(ILogger logger)
});
}

static Task RunScxmlTests(ILogger logger)
{
var jsonPath = "../test-framework/test/basic/basic1.json";
var testJson = System.IO.File.ReadAllText(jsonPath);

var scxmlTest = JsonSerializer.Deserialize<ScxmlTest>(testJson);
return Run("../test-framework/test/basic/basic1.scxml", logger, async queue =>
{
foreach (var item in scxmlTest.Events)
{
Console.WriteLine(item.Event.Name);
queue.Enqueue(new Message(item.Event.Name));


// TODO: verify that the interpreter's state configuration
// contains item.nextConfiguration (sets are equal)
}
});
}

static Task Run(string xmldoc, ILogger logger, Func<Queue<Message>, Task> action = null)
{
var metadata = new XmlModelMetadata(XDocument.Load(xmldoc));
Expand Down
1 change: 1 addition & 0 deletions test-framework
Submodule test-framework added at b46a10