From 76fc38b3cdfded2911b464baa7b182b5102318d1 Mon Sep 17 00:00:00 2001 From: Galin Simeonov Date: Thu, 3 Jun 2021 12:38:37 +0300 Subject: work on generated C code --- tests/test2 | 23 +++++++++++++++++++++-- tests/test3 | 26 ++++++++++---------------- tests/test4 | 24 ++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 18 deletions(-) create mode 100644 tests/test4 (limited to 'tests') diff --git a/tests/test2 b/tests/test2 index a5342f0..f630109 100644 --- a/tests/test2 +++ b/tests/test2 @@ -1,2 +1,21 @@ -"1" -"12" +machine light_bulb +[ + states [ light_on , light_off ]; + events [ turn_on , turn_off , switch ]; + starting on light_off; + transitions + [ + from light_on to light_off on event turn_off execute kek2 | kek; + from light_on to light_off on event switch; + from light_off to light_on on event turn_on; + from light_off to light_on on event switch execute kek; + + ]; +]; +machine temp_switch +[ + states [A,B]; + events [A]; + starting on A; + transitions [from A to B on event A execute kek;]; +]; diff --git a/tests/test3 b/tests/test3 index 43e47d1..426fd2a 100644 --- a/tests/test3 +++ b/tests/test3 @@ -1,21 +1,15 @@ -machine light_bulb +machine SIREN [ - states [ light_on , light_off ]; - events [ switch_state , turn_on , turn_off ]; - - starting on light_off; - + states [ ON , OFF ]; + events [ ECHO , TURN_OFF , TURN_ON ]; + starting on ON ; transitions [ - from light_on to light_off on event switch_state execute light_switch(); - from light_off to light_on on event switch_state execute light_switch(); + from ON to OFF on event TURN_OFF; + from OFF to ON on event TURN_ON; - from light_on to light_off on event turn_on execute light_switch(); - from light_off to light_on on event turn_off execute light_switch(); - ]; -]; + from ON to ON on event ECHO + execute echo ; + ]; -transition light_switch() -{ - -} +]; diff --git a/tests/test4 b/tests/test4 new file mode 100644 index 0000000..5130059 --- /dev/null +++ b/tests/test4 @@ -0,0 +1,24 @@ +machine light_bulb +[ + states [ light_on , light_off ]; + events [ turn_on , turn_off , switch ]; + starting on light_off; + transitions + [ + from light_on to light_off on event turn_off execute kek2 | kek; + from light_on to light_off on event switch; + from light_off to light_on on event turn_on; + from light_off to light_on on event switch execute kek; + + ]; +]; +machine temp_switch +[ + states [A,B]; + events [A]; + starting on A; + transitions + [ + from ( A && !light_on ) to B on event A execute kek; + ]; +]; -- cgit v1.2.3