aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGalin Simeonov <gts@volconst.com>2021-06-01 18:21:02 +0300
committerGalin Simeonov <gts@volconst.com>2021-07-15 18:03:43 +0300
commit85b23fbee717f047af5a89eac6f4dba8e7812524 (patch)
treedc88ef3f4cb826f4f3a3c9e12c67562878460aa5 /tests
parent255a49ba5a41b3854dbdfebdec75fb6229450507 (diff)
downloadMEGATRON-85b23fbee717f047af5a89eac6f4dba8e7812524.tar.gz
restructuring
Diffstat (limited to 'tests')
-rw-r--r--tests/output.c49
-rw-r--r--tests/test3
2 files changed, 51 insertions, 1 deletions
diff --git a/tests/output.c b/tests/output.c
new file mode 100644
index 0000000..713c329
--- /dev/null
+++ b/tests/output.c
@@ -0,0 +1,49 @@
+enum
+{
+ EVENT_ONE_SECOND,
+}MACHINE_FLICKER_EVENT;
+
+enum
+{
+ MACHINE_FLICKER,
+}MACHINES;
+
+extern void machine_flicker_light_off(enum MACHINE_FLICKER_EVENT event);
+extern void machine_flicker_light_on(enum MACHINE_FLICKER_EVENT event);
+
+extern machine_buffer_t* turn_on_light(machine_buffer_t *arguments,machine_buffer_t *input);
+extern machine_buffer_t* turn_off_light(machine_buffer_t *arguments,machine_buffer_t *input);
+
+void machine_flicker_push_event(enum MACHINE_FLICKER_EVENT event);
+
+
+
+void (*machine_states[])()={machine_flicker_light_on};
+
+
+
+void machine_flicker_push_event(enum MACHINE_FLICKER_EVENT event)
+{
+ machine_states[MACHINE_FLICKER](event);
+}
+
+void machine_flicker_light_off(enum MACHINE_FLICKER_EVENT event)
+{
+ switch(event)
+ {
+ case EVENT_ONE_SECOND:
+ turn_on_light(get_machine_buffer(""));
+ machine_states[MACHINE_FLICKER]=machine_flicker_light_on;
+ break;
+ }
+}
+void machine_flicker_light_on(enum MACHINE_FLICKER_EVENT event)
+{
+ switch(event)
+ {
+ case EVENT_ONE_SECOND:
+ turn_off_light(get_machine_buffer(""));
+ machine_states[MACHINE_FLICKER]=machine_flicker_light_off;
+ break;
+ }
+}
diff --git a/tests/test b/tests/test
index c976a6d..90d5353 100644
--- a/tests/test
+++ b/tests/test
@@ -1,10 +1,11 @@
+
machine flicker
[
states [ light_off , light_on ];
+ events [ one_second ];
starting on light_on;
- events [ one_second ];
transitions
[
from light_on to light_off on event one_second