ShallowHistory.sctunit 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. testgroup ShallowHistory for statechart ShallowHistory {
  2. test shallowHistoryTest {
  3. enter
  4. // Change active states to State9;
  5. raise event1
  6. cycle
  7. raise event3
  8. cycle
  9. raise event5
  10. cycle
  11. raise event7
  12. cycle
  13. assert !active ( ShallowHistory.mainRegion.State1)
  14. assert active (ShallowHistory.mainRegion.State2._region0.State4._region0.State7._region0.State9)
  15. // Leave State7. State9 should be saved as history.
  16. raise event6
  17. cycle
  18. assert !active (ShallowHistory.mainRegion.State2._region0.State4._region0.State7._region0.State9)
  19. assert active ( ShallowHistory.mainRegion.State2._region0.State4._region0.State6)
  20. // Reenter State7. State9 should be activated because of saved history.
  21. raise event5
  22. cycle
  23. assert !active ( ShallowHistory.mainRegion.State2._region0.State4._region0.State7._region0.State8)
  24. assert active (ShallowHistory.mainRegion.State2._region0.State4._region0.State7._region0.State9)
  25. // Leave State2. State4 and State9 should be saved as history.
  26. raise event2
  27. cycle
  28. assert !active (ShallowHistory.mainRegion.State2._region0.State4._region0.State7._region0.State9)
  29. assert active (ShallowHistory.mainRegion.State1)
  30. // Reenter State2. State6 should be activated (History of State2).
  31. raise event1
  32. cycle
  33. assert active (ShallowHistory.mainRegion.State2._region0.State4._region0.State6)
  34. assert!active (ShallowHistory.mainRegion.State1)
  35. // Reenter State7. State9 should be activated (History of State7).
  36. raise event5
  37. cycle
  38. assert !active(ShallowHistory.mainRegion.State2._region0.State4._region0.State6)
  39. assert active (ShallowHistory.mainRegion.State2._region0.State4._region0.State7._region0.State9)
  40. }
  41. }