-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EventBag, EventChannel, EventQueue added more test cases + minor fixes
- Loading branch information
Christine Zhou
committed
Jan 20, 2025
1 parent
632ba13
commit 08003e3
Showing
12 changed files
with
249 additions
and
90 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
50 changes: 50 additions & 0 deletions
50
Tst/RegressionTests/Feature1SMLevelDecls/Correct/EventQueue/EventQueue.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,50 @@ | ||
event A: int; | ||
event B: M1; | ||
event C: int; | ||
event unblock; | ||
|
||
machine Main { | ||
var m1: M1; | ||
var m2: M2; | ||
start state Init { | ||
entry { | ||
m1 = new M1(); | ||
m2 = new M2(); | ||
send m1, A, 1; | ||
send m2, B, m1; | ||
} | ||
} | ||
} | ||
|
||
eventqueue machine M1 { | ||
start state Init { | ||
on unblock do { | ||
goto dequeueEvents; | ||
} | ||
defer A; | ||
defer C; | ||
} | ||
state dequeueEvents { | ||
on A do { | ||
goto receivedA; | ||
} | ||
on C do { | ||
assert false, "Event C was received before A"; | ||
} | ||
} | ||
state receivedA { | ||
on C do { | ||
assert true; | ||
} | ||
} | ||
} | ||
|
||
machine M2 { | ||
start state Init { | ||
on B do (payload: M1) { | ||
send payload, C, 1; | ||
send payload, unblock; | ||
} | ||
} | ||
} | ||
|
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
60 changes: 60 additions & 0 deletions
60
Tst/RegressionTests/Feature1SMLevelDecls/DynamicError/EventBag2/EventBag2.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,60 @@ | ||
event A: Main; | ||
event B: M1; | ||
event C: int; | ||
event unblock; | ||
event iter; | ||
|
||
machine Main { | ||
var m1: M1; | ||
var m2: M2; | ||
var i: int; | ||
start state Init { | ||
entry { | ||
m1 = new M1(); | ||
m2 = new M2(); | ||
send m1, A, this; | ||
send m2, B, m1; | ||
i = 0; | ||
} | ||
// Repeat until M1 receives event C before A | ||
on iter do { | ||
send m1, A, this; | ||
send m2, B, m1; | ||
} | ||
} | ||
} | ||
|
||
eventbag machine M1 { | ||
var m: Main; | ||
start state Init { | ||
on unblock do { | ||
goto dequeueEvents; | ||
} | ||
defer A; | ||
defer C; | ||
} | ||
state dequeueEvents { | ||
on A do (payload: Main){ | ||
m = payload; | ||
goto receivedA; | ||
} | ||
on C do { | ||
assert false, "Event C was received before A"; | ||
} | ||
} | ||
state receivedA { | ||
on C do { | ||
send m, iter; | ||
goto Init; | ||
} | ||
} | ||
} | ||
|
||
machine M2 { | ||
start state Init { | ||
on B do (payload: M1) { | ||
send payload, C, 1; | ||
send payload, unblock; | ||
} | ||
} | ||
} |
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
60 changes: 60 additions & 0 deletions
60
Tst/RegressionTests/Feature1SMLevelDecls/DynamicError/EventChannel2/EventChannel2.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,60 @@ | ||
event A: Main; | ||
event B: M1; | ||
event C: int; | ||
event unblock; | ||
event iter; | ||
|
||
machine Main { | ||
var m1: M1; | ||
var m2: M2; | ||
var i: int; | ||
start state Init { | ||
entry { | ||
m1 = new M1(); | ||
m2 = new M2(); | ||
send m1, A, this; | ||
send m2, B, m1; | ||
i = 0; | ||
} | ||
// Repeat until M1 receives event C before A | ||
on iter do { | ||
send m1, A, this; | ||
send m2, B, m1; | ||
} | ||
} | ||
} | ||
|
||
eventchannel machine M1 { | ||
var m: Main; | ||
start state Init { | ||
on unblock do { | ||
goto dequeueEvents; | ||
} | ||
defer A; | ||
defer C; | ||
} | ||
state dequeueEvents { | ||
on A do (payload: Main){ | ||
m = payload; | ||
goto receivedA; | ||
} | ||
on C do { | ||
assert false, "Event C was received before A"; | ||
} | ||
} | ||
state receivedA { | ||
on C do { | ||
send m, iter; | ||
goto Init; | ||
} | ||
} | ||
} | ||
|
||
machine M2 { | ||
start state Init { | ||
on B do (payload: M1) { | ||
send payload, C, 1; | ||
send payload, unblock; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.