Browse Source

Some patches for the SCCD test

Yentl Van Tendeloo 8 years ago
parent
commit
122a6aa41e
2 changed files with 42 additions and 7 deletions
  1. 15 4
      integration/code/SCCD_all.mvc
  2. 27 3
      unit/test_all.py

+ 15 - 4
integration/code/SCCD_all.mvc

@@ -171,7 +171,7 @@ transition (manager_main_parallel_input_5, manager_main_parallel_input_6) {
     name = ""
     after = $
                 Element function after(attributes : Element):
-                    return 10.0!
+                    return 9.4!
             $
 
     {transition_raises} Raise {
@@ -356,7 +356,8 @@ Class trafficlight {
             isInitial = False
 
             {onExitRaise} Raise {
-                event = "displayNone"
+                event = "displayNone2"
+                scope = "output"
             }
 
             {parallel_children} CompositeState trafficlight_main_main_trafficlight {
@@ -386,9 +387,11 @@ Class trafficlight {
 
                         {onEntryRaise} Raise {
                             event = "displayRed"
+                            scope = "output"
                         }
                         {onEntryRaise} Raise {
                             event = "resetTimer"
+                            scope = "output"
                         }
                     }
 
@@ -405,9 +408,11 @@ Class trafficlight {
 
                         {onEntryRaise} Raise {
                             event = "displayGreen"
+                            scope = "output"
                         }
                         {onEntryRaise} Raise {
                             event = "resetTimer"
+                            scope = "output"
                         }
                     }
 
@@ -423,9 +428,11 @@ Class trafficlight {
 
                         {onEntryRaise} Raise {
                             event = "displayYellow"
+                            scope = "output"
                         }
                         {onEntryRaise} Raise {
                             event = "disableTimer"
+                            scope = "output"
                         }
                     }
 
@@ -441,6 +448,7 @@ Class trafficlight {
 
                         {onEntryRaise} Raise {
                             event = "displayYellow"
+                            scope = "output"
                         }
                     }
 
@@ -450,6 +458,7 @@ Class trafficlight {
 
                         {onEntryRaise} Raise {
                             event = "displayNone"
+                            scope = "output"
                         }
                     }
                 }
@@ -470,6 +479,7 @@ Class trafficlight {
 
                     {onExitRaise} Raise {
                         event = "updateTimerValue"
+                        scope = "output"
                         parameter = $
                                 Element function parameter(attributes : Element):
                                     return -1!
@@ -487,6 +497,7 @@ Class trafficlight {
 
                         {onEntryRaise} Raise {
                             event = "updateTimerValue"
+                            scope = "output"
                             parameter = $
                                     Element function raise(attributes : Element):
                                         return attributes["counter"]!
@@ -646,7 +657,7 @@ transition (trafficlight_main_main_timer_running_red, trafficlight_main_main_tim
         $
 
     {transition_raises} Raise {
-        event = "updateTimer"
+        event = "updateTimerValue"
         scope = "output"
         parameter = $
                 Element function param(attributes : Element, parameters : Element):
@@ -667,7 +678,7 @@ transition (trafficlight_main_main_timer_running_green, trafficlight_main_main_t
                 return!
         $
     {transition_raises} Raise {
-        event = "updateTimer"
+        event = "updateTimerValue"
         scope = "output"
         parameter = $
                 Element function param(attributes : Element, parameters : Element):

+ 27 - 3
unit/test_all.py

@@ -299,11 +299,35 @@ class TestModelverse(unittest.TestCase):
         lst = element_list_nice("test/my_SCCD_trace")
 
         # TODO check if the structure of this list is OK
-        result = [(i["timestamp"], i["name"], i["parameter"]) for i in lst.sort(key=lambda i: i["timestamp"])]
+        lst.sort(key=lambda i: i["timestamp"])
+        result = [(i["timestamp"], i["name"]) for i in lst if i["name"] not in ["updateTimerValue", "updateTimerColour", "resetTimer"]]
         print(result)
 
-        assert result == [(5.0, "updateTimerColour", "red"),
-                          (6.0, "updateTimer", 59),
+        # TODO: displayNone2 should never be raised (unless on toggle?)
+        assert result == [(5.0, "displayRed"),
+                          (20.0, "displayYellow"),
+                          (20.5, "displayNone"),
+                          (21.0, "displayYellow"),
+                          (21.5, "displayNone"),
+                          (22.0, "displayYellow"),
+                          (22.5, "displayNone"),
+                          (23.0, "displayYellow"),
+                          (23.5, "displayNone"),
+                          (24.0, "displayYellow"),
+                          (24.5, "displayNone"),
+                          (25.0, "displayYellow"),
+                          (25.5, "displayNone"),
+                          (26.0, "displayYellow"),
+                          (26.5, "displayNone"),
+                          (27.0, "displayYellow"),
+                          (27.5, "displayNone"),
+                          (28.0, "displayYellow"),
+                          (28.5, "displayNone"),
+                          (29.0, "displayYellow"),
+                          (29.4, "displayRed"),
+                          (89.4, "displayGreen"),
+                          (129.4, "displayRed"),
+                          (139.4, "displayYellow")
                          ]
 
     def test_switch_MM(self):