00_no_statechart_py.xml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?xml version="1.0" ?>
  2. <diagram
  3. xmlns="msdl.uantwerpen.be/sccd"
  4. author="Joeri Exelmans"
  5. name="no_statechart" language="python">
  6. <description>
  7. Test to see what happens when a class with no statechart is defined.
  8. </description>
  9. <inport name="in"/>
  10. <outport name="out"/>
  11. <!-- POD -->
  12. <class name="my_struct">
  13. <attribute name="x"/>
  14. <attribute name="y"/>
  15. <constructor>
  16. <parameter name="x"/>
  17. <parameter name="y"/>
  18. <body>
  19. self.x = x
  20. self.y = y
  21. </body>
  22. </constructor>
  23. </class>
  24. <class name="my_class" default="true">
  25. <constructor>
  26. <body>
  27. self.data = SCCDClass_my_struct(0, 0)
  28. </body>
  29. </constructor>
  30. <scxml initial="a">
  31. <state id="a">
  32. <transition after="0.1" cond="self.data.x &lt; 2" target="../b">
  33. <raise event="to_b" port="out">
  34. <parameter expr="self.data.x"/>
  35. </raise>
  36. <script>
  37. self.data.x += 1
  38. </script>
  39. </transition>
  40. </state>
  41. <state id="b">
  42. <transition after="0.1" cond="self.data.y &lt; 2" target="../a">
  43. <script>
  44. self.data.y += 1
  45. </script>
  46. <raise event="to_a" port="out">
  47. <parameter expr="self.data.y"/>
  48. </raise>
  49. </transition>
  50. </state>
  51. </scxml>
  52. </class>
  53. <test>
  54. <expected>
  55. <slot>
  56. <!-- big step -->
  57. <event name="to_b" port="out">
  58. <parameter value="0"/>
  59. </event>
  60. </slot>
  61. <slot>
  62. <!-- big step -->
  63. <event name="to_a" port="out">
  64. <parameter value="1"/>
  65. </event>
  66. </slot>
  67. <slot>
  68. <!-- big step -->
  69. <event name="to_b" port="out">
  70. <parameter value="1"/>
  71. </event>
  72. </slot>
  73. <slot>
  74. <!-- big step -->
  75. <event name="to_a" port="out">
  76. <parameter value="2"/>
  77. </event>
  78. </slot>
  79. </expected>
  80. </test>
  81. </diagram>