ShallowHistory.sctunit 1.7 KB

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