Choice.sctunit 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. testgroup Choice for statechart Choice {
  2. test elseChoiceUsingNonDefaultTransition {
  3. enter
  4. assert active (Choice.main_region.A)
  5. c = true
  6. raise e
  7. cycle
  8. assert active (Choice.main_region.C)
  9. }
  10. test elseChoiceUsingDefaultTransition {
  11. enter
  12. assert active (Choice.main_region.A)
  13. c = false
  14. raise e
  15. cycle
  16. assert active (Choice.main_region.B)
  17. }
  18. test defaultChoiceUsingNonDefaultTransition {
  19. enter
  20. assert active (Choice.main_region.A)
  21. c = true
  22. raise g
  23. cycle
  24. assert active (Choice.main_region.C)
  25. }
  26. test defaultChoiceUsingDefaultTransition {
  27. enter
  28. assert active (Choice.main_region.A)
  29. c = false
  30. raise g
  31. cycle
  32. assert active (Choice.main_region.B)
  33. }
  34. test uncheckedChoiceUsingNonDefaultTransition {
  35. enter
  36. assert active (Choice.main_region.A)
  37. c = true
  38. raise f
  39. cycle
  40. assert active (Choice.main_region.C)
  41. }
  42. /*
  43. * An outgiong transition with an empty trigger
  44. * will be handled like a default transition.
  45. */
  46. test uncheckedChoiceUsingDefaultTransition {
  47. enter
  48. assert active (Choice.main_region.A)
  49. c = false
  50. raise f
  51. cycle
  52. assert active (Choice.main_region.B)
  53. }
  54. /* A transition with a 'true' guard is always true and must
  55. * be used according to its predefined priority.
  56. *
  57. * This test case makes sure that default transition reordering
  58. * does not impact these transitions.
  59. */
  60. test alwaysTrueTransitionInChoice {
  61. enter
  62. assert active (Choice.main_region.A)
  63. c = true
  64. raise h
  65. cycle
  66. assert active (Choice.main_region.C)
  67. }
  68. }