add readme, move testing function to lib

This commit is contained in:
Joeri Exelmans 2024-11-29 09:53:49 +01:00
parent 2fb8318506
commit 8b3f543bda
5 changed files with 118 additions and 10 deletions

View file

@ -134,3 +134,14 @@ def run_scenario(input_trace, expected_output_trace, statechart_class, INITIAL,
elif verbose:
print_diff()
return True
def run_scenarios(scenarios, statechart_class, initial, idempotent, verbose=True):
ok = True
for scenario in scenarios:
print(f"Running scenario: {scenario["name"]}")
ok = run_scenario(scenario["input_events"], scenario["output_events"], statechart_class, initial, idempotent, verbose=verbose) and ok
print("--------")
if ok:
print("All scenarios passed.")
else:
print("Some scenarios failed.")