test_instate_nested.xml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <test>
  2. <!-- Interestingly, compiling this test with Rust -O3 produces an equally sized binary as test_instate.xml. This means that the anonymous function in the guard of our first transition is being inlined by the compiler. We can conclude that Rust brings zero-cost abstractions to our action language :) -->
  3. <statechart>
  4. <inport>
  5. <event name="try"/>
  6. <event name="to_d"/>
  7. </inport>
  8. <outport>
  9. <event name="yes"/>
  10. <event name="no"/>
  11. </outport>
  12. <root>
  13. <parallel id="p">
  14. <state id="o0" initial="a">
  15. <state id="a">
  16. <transition port="in" event="try" target="../b" cond='func { return @in("/p/o1/d"); }()'>
  17. <raise port="out" event="yes"/>
  18. </transition>
  19. <transition port="in" event="try" target="." cond='not @in("/p/o1/d")'>
  20. <raise port="out" event="no"/>
  21. </transition>
  22. </state>
  23. <state id="b">
  24. </state>
  25. </state>
  26. <state id="o1" initial="c">
  27. <state id="c">
  28. <transition port="in" event="to_d" target="../d"/>
  29. </state>
  30. <state id="d">
  31. </state>
  32. </state>
  33. </parallel>
  34. </root>
  35. </statechart>
  36. <input>
  37. <event port="in" name="try" time="0 d"/>
  38. <event port="in" name="to_d" time="1 s"/>
  39. <event port="in" name="try" time="2 s"/>
  40. </input>
  41. <output>
  42. <big_step>
  43. <event port="out" name="no"/>
  44. </big_step>
  45. <big_step>
  46. <event port="out" name="yes"/>
  47. </big_step>
  48. </output>
  49. </test>