GuardedExit.sctunit 469 B

123456789101112131415161718192021222324252627282930
  1. testclass GuardedExit for statechart GuardedExit {
  2. @Test
  3. operation ExitTaken(){
  4. enter
  5. assert active(GuardedExit.main_region.A)
  6. assert ! guard
  7. checkDone(false)
  8. }
  9. @Test
  10. operation ExitNotTaken(){
  11. enter
  12. assert active(GuardedExit.main_region.A)
  13. guard = true
  14. checkDone(true)
  15. }
  16. operation checkDone(shouldBeDone : boolean){
  17. raise e
  18. proceed 1 cycle
  19. assert active(GuardedExit.main_region.B)
  20. assert shouldBeDone ? done : !done
  21. }
  22. }