InternalEventLifeCycle.sctunit 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * @author axel terfloth
  3. */
  4. testclass InternalEventLifeCycle for statechart InternalEventLifeCycle {
  5. @Test
  6. operation InternalEventLifeCycleTest(){
  7. enter
  8. assert active(InternalEventLifeCycle.r1.A)
  9. assert active(InternalEventLifeCycle.r2.C)
  10. // the internal event i1 must be raised and consumed in the low priority
  11. // region within the same cycle
  12. raise e
  13. proceed 1 cycle
  14. assert active(InternalEventLifeCycle.r1.A)
  15. assert active(InternalEventLifeCycle.r2.D)
  16. // the internal event must not be visible after the cycle
  17. // but we can't access internal elements yet : assert ! i1
  18. // make sure nothing happens during an empty cycle
  19. proceed 1 cycle
  20. assert active(InternalEventLifeCycle.r1.A)
  21. assert active(InternalEventLifeCycle.r2.D)
  22. // the internal event i2 should have no impact since it is raised
  23. // in a low priority region and will be cleared after the cycle
  24. raise f
  25. proceed 1 cycle
  26. assert active(InternalEventLifeCycle.r1.A)
  27. assert active(InternalEventLifeCycle.r2.C)
  28. // make sure nothing happens during an empty cycle
  29. proceed 1 cycle
  30. assert active(InternalEventLifeCycle.r1.A)
  31. assert active(InternalEventLifeCycle.r2.C)
  32. }
  33. }