1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- testclass Choice for statechart Choice {
- @Test
- operation elseChoiceUsingNonDefaultTransition(){
- initForEventE(true)
- assert active (Choice.main_region.C)
- }
- @Test
- operation elseChoiceUsingDefaultTransition(){
- initForEventE(false)
- assert active (Choice.main_region.B)
- }
- @Test
- operation defaultChoiceUsingNonDefaultTransition(){
- initForEventG(true)
- assert active (Choice.main_region.C)
- }
- @Test
- operation defaultChoiceUsingDefaultTransition(){
- initForEventG(false)
- assert active (Choice.main_region.B)
- }
- @Test
- operation uncheckedChoiceUsingNonDefaultTransition(){
- initForEventF(true)
- assert active (Choice.main_region.C)
- }
-
- /*
- * An outgiong transition with an empty trigger
- * will be handled like a default transition.
- */
- @Test
- operation uncheckedChoiceUsingDefaultTransition(){
- initForEventF(false)
- assert active (Choice.main_region.B)
- }
-
- /* A transition with a 'true' guard is always true and must
- * be used according to its predefined priority.
- *
- * This test case makes sure that default transition reordering
- * does not impact these transitions.
- */
- @Test
- operation alwaysTrueTransitionInChoice(){
- initForEventH(true)
- assert active (Choice.main_region.C)
- }
-
- operation initForEventE(valueForC : boolean){
- enter
-
- assert active (Choice.main_region.A)
- c = valueForC
- raise e
-
- proceed 1 cycle
- }
-
- operation initForEventF(valueForC : boolean){
- enter
-
- assert active (Choice.main_region.A)
- c = valueForC
- raise f
-
- proceed 1 cycle
- }
-
- operation initForEventG(valueForC : boolean){
- enter
-
- assert active (Choice.main_region.A)
- c = valueForC
- raise g
-
- proceed 1 cycle
- }
-
- operation initForEventH(valueForC : boolean){
- enter
-
- assert active (Choice.main_region.A)
- c = valueForC
- raise h
-
- proceed 1 cycle
- }
- }
|