ShallowHistoryWithDeepEntry.sctunit 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. * A shallow history must also for child states that are only indirectly entered through one of the childs.
  3. */
  4. testclass ShallowHistoryWithDeepEntry for statechart ShallowHistoryWithDeepEntry{
  5. @Test
  6. operation noDeepEntryWithinHistory(){
  7. enter
  8. assert active(ShallowHistoryWithDeepEntry.main_region.Y)
  9. raise toZ
  10. proceed 1 cycle
  11. assert active(ShallowHistoryWithDeepEntry.main_region.Z._region0.A)
  12. raise toY
  13. proceed 1 cycle
  14. assert active(ShallowHistoryWithDeepEntry.main_region.Y)
  15. raise toZ
  16. proceed 1 cycle
  17. assert active(ShallowHistoryWithDeepEntry.main_region.Z._region0.A)
  18. }
  19. @Test
  20. operation deepEntryWithinHistory(){
  21. enter
  22. assert active(ShallowHistoryWithDeepEntry.main_region.Y)
  23. raise toZ
  24. proceed 1 cycle
  25. assert active(ShallowHistoryWithDeepEntry.main_region.Z._region0.A)
  26. raise toC
  27. proceed 1 cycle
  28. assert active(ShallowHistoryWithDeepEntry.main_region.Z._region0.B._region0.C)
  29. assert active(ShallowHistoryWithDeepEntry.main_region.Z._region0.B)
  30. raise toY
  31. proceed 1 cycle
  32. assert active(ShallowHistoryWithDeepEntry.main_region.Y)
  33. raise toZ
  34. proceed 1 cycle
  35. assert active(ShallowHistoryWithDeepEntry.main_region.Z._region0.B._region0.C)
  36. assert active(ShallowHistoryWithDeepEntry.main_region.Z._region0.B)
  37. }
  38. @Test
  39. operation directDeepEntryIntoHistory(){
  40. enter
  41. assert active(ShallowHistoryWithDeepEntry.main_region.Y)
  42. raise toC
  43. proceed 1 cycle
  44. assert active(ShallowHistoryWithDeepEntry.main_region.Z._region0.B._region0.C)
  45. assert active(ShallowHistoryWithDeepEntry.main_region.Z._region0.B)
  46. raise toY
  47. proceed 1 cycle
  48. assert active(ShallowHistoryWithDeepEntry.main_region.Y)
  49. raise toZ
  50. proceed 1 cycle
  51. assert active(ShallowHistoryWithDeepEntry.main_region.Z._region0.B._region0.C)
  52. assert active(ShallowHistoryWithDeepEntry.main_region.Z._region0.B)
  53. }
  54. }