-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding test cases for 'raise' and 'goto' with payload
- Loading branch information
Christine Zhou
committed
Aug 29, 2024
1 parent
55a6c0e
commit 8f7b3a4
Showing
15 changed files
with
280 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/******************** | ||
* This example tests goto with payload on state machine | ||
* ******************/ | ||
|
||
machine Main { | ||
start state Init { | ||
entry { | ||
goto S, 1000; | ||
} | ||
} | ||
state S { | ||
entry (payload: int) { | ||
assert (payload == 1000), format ("Expected payload to be 1000, actual payload is {0}", payload); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/******************** | ||
* This example tests goto with payload on monitor | ||
* ******************/ | ||
|
||
event E1; | ||
|
||
machine Main { | ||
start state Init { | ||
entry { | ||
send this, E1; | ||
} | ||
on E1 do { | ||
} | ||
} | ||
} | ||
spec M observes E1 { | ||
start state Init { | ||
on E1 do { | ||
goto S, 1000; | ||
} | ||
} | ||
state S { | ||
entry (payload: int) { | ||
assert (payload == 1000), format ("Expected payload to be 1000, actual payload is {0}", payload); | ||
} | ||
} | ||
} | ||
|
||
test DefaultImpl [main=Main]: assert M in { Main }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/******************** | ||
* This example tests raise with payload on state machine | ||
* ******************/ | ||
|
||
event E1: int; | ||
|
||
machine Main { | ||
start state Init { | ||
entry { | ||
raise E1, 1000; | ||
} | ||
on E1 do (payload: int) { | ||
assert (payload == 1000), format ("Expected payload to be 1000, actual payload is {0}", payload); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/******************** | ||
* This example tests raise with payload on monitor | ||
* ******************/ | ||
|
||
event E1; | ||
event E2: int; | ||
|
||
machine Main { | ||
start state Init { | ||
entry { | ||
send this, E1; | ||
} | ||
on E1 do { | ||
} | ||
} | ||
} | ||
spec M observes E1, E2 { | ||
start state Init { | ||
on E1 do { | ||
raise E2, 1000; | ||
} | ||
on E2 do (payload: int) { | ||
assert (payload == 1000), format ("Expected payload to be 1000, actual payload is {0}", payload); | ||
} | ||
} | ||
} | ||
|
||
test DefaultImpl [main=Main]: assert M in { Main }; |
16 changes: 16 additions & 0 deletions
16
Tst/RegressionTests/Feature2Stmts/DynamicError/goto2/goto2.p
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/******************** | ||
* This example tests goto with payload on state machine | ||
* ******************/ | ||
|
||
machine Main { | ||
start state Init { | ||
entry { | ||
goto S, 1000; | ||
} | ||
} | ||
state S { | ||
entry (payload: int) { | ||
assert (payload != 1000), format ("Expected payload to be 1000, actual payload is {0}", payload); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Tst/RegressionTests/Feature2Stmts/DynamicError/goto3/goto3.p
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/******************** | ||
* This example tests goto with payload on monitor | ||
* ******************/ | ||
|
||
event E1; | ||
|
||
machine Main { | ||
start state Init { | ||
entry { | ||
send this, E1; | ||
} | ||
on E1 do { | ||
} | ||
} | ||
} | ||
spec M observes E1 { | ||
start state Init { | ||
on E1 do { | ||
goto S, 1000; | ||
} | ||
} | ||
state S { | ||
entry (payload: int) { | ||
assert (payload != 1000), format ("Expected payload to be 1000, actual payload is {0}", payload); | ||
} | ||
} | ||
} | ||
|
||
test DefaultImpl [main=Main]: assert M in { Main }; |
16 changes: 16 additions & 0 deletions
16
Tst/RegressionTests/Feature2Stmts/DynamicError/raise1/raise1.p
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/******************** | ||
* This example tests raise with payload on state machine | ||
* ******************/ | ||
|
||
event E1: int; | ||
|
||
machine Main { | ||
start state Init { | ||
entry { | ||
raise E1, 1000; | ||
} | ||
on E1 do (payload: int) { | ||
assert (payload != 1000), format ("Expected payload to be 1000, actual payload is {0}", payload); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
Tst/RegressionTests/Feature2Stmts/DynamicError/raise2/raise2.p
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/******************** | ||
* This example tests raise with payload on monitor | ||
* ******************/ | ||
|
||
event E1; | ||
event E2: int; | ||
|
||
machine Main { | ||
start state Init { | ||
entry { | ||
send this, E1; | ||
} | ||
on E1 do { | ||
} | ||
} | ||
} | ||
spec M observes E1, E2 { | ||
start state Init { | ||
on E1 do { | ||
raise E2, 1000; | ||
} | ||
on E2 do (payload: int) { | ||
assert (payload != 1000), format ("Expected payload to be 1000, actual payload is {0}", payload); | ||
} | ||
} | ||
} | ||
|
||
test DefaultImpl [main=Main]: assert M in { Main }; |
16 changes: 16 additions & 0 deletions
16
Tst/RegressionTests/Feature2Stmts/StaticError/goto2/goto2.p
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/******************** | ||
* This example tests goto with payload on state machine | ||
* ******************/ | ||
|
||
machine Main { | ||
start state Init { | ||
entry { | ||
goto S; | ||
} | ||
} | ||
state S { | ||
entry (payload: int) { | ||
assert (payload == 1000), format ("Expected payload to be 1000, actual payload is {0}", payload); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Tst/RegressionTests/Feature2Stmts/StaticError/goto3/goto3.p
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/******************** | ||
* This example tests goto with payload on monitor | ||
* ******************/ | ||
|
||
event E1; | ||
|
||
machine Main { | ||
start state Init { | ||
entry { | ||
send this, E1; | ||
} | ||
on E1 do { | ||
} | ||
} | ||
} | ||
spec M observes E1 { | ||
start state Init { | ||
on E1 do { | ||
goto S; | ||
} | ||
} | ||
state S { | ||
entry (payload: int) { | ||
assert (payload == 1000), format ("Expected payload to be 1000, actual payload is {0}", payload); | ||
} | ||
} | ||
} | ||
|
||
test DefaultImpl [main=Main]: assert M in { Main }; |
16 changes: 16 additions & 0 deletions
16
Tst/RegressionTests/Feature2Stmts/StaticError/raise1/raise1.p
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/******************** | ||
* This example tests raise with payload on state machine | ||
* ******************/ | ||
|
||
event E1: int; | ||
|
||
machine Main { | ||
start state Init { | ||
entry { | ||
raise E1; | ||
} | ||
on E1 do (payload: int) { | ||
assert (payload == 1000), format ("Expected payload to be 1000, actual payload is {0}", payload); | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
Tst/RegressionTests/Feature2Stmts/StaticError/raise2/raise2.p
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/******************** | ||
* This example tests raise with payload on monitor | ||
* ******************/ | ||
|
||
event E1; | ||
event E2: int; | ||
|
||
machine Main { | ||
start state Init { | ||
entry { | ||
send this, E1; | ||
} | ||
on E1 do { | ||
} | ||
} | ||
} | ||
spec M observes E1, E2 { | ||
start state Init { | ||
on E1 do { | ||
raise E2; | ||
} | ||
on E2 do (payload: int) { | ||
assert (payload == 1000), format ("Expected payload to be 1000, actual payload is {0}", payload); | ||
} | ||
} | ||
} | ||
|
||
test DefaultImpl [main=Main]: assert M in { Main }; |