-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1293 from lf-lang/ts-tan
Added advance-message-interval option and more federated tests for TypeScript
- Loading branch information
Showing
10 changed files
with
119 additions
and
17 deletions.
There are no files selected for viewing
Submodule reactor-ts
updated
6 files
+25 −2 | __tests__/Logger.test.ts | |
+0 −1 | __tests__/bank.ts | |
+1 −1 | lingua-franca-ref.txt | |
+2 −1 | src/core/cli.ts | |
+5 −5 | src/core/federation.ts | |
+11 −3 | src/core/reactor.ts |
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
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,56 @@ | ||
/** | ||
* Test the case for when two upstream federates | ||
* send messages to a downstream federte on two | ||
* different ports. One message should carry a | ||
* microstep delay relative to the other | ||
* message. | ||
* | ||
* @author Soroush Bateni | ||
* @author Hokeun Kim | ||
*/ | ||
target TypeScript { | ||
timeout: 900 msec, | ||
coordination-options: {advance-message-interval: 100 msec}, | ||
logging: DEBUG | ||
}; | ||
|
||
import Count from "../lib/Count.lf"; | ||
|
||
reactor CountMicrostep { | ||
state count:number(1); | ||
output out:number; | ||
logical action act:number; | ||
timer t(0, 1 sec); | ||
reaction(t) -> act {= | ||
actions.act.schedule(0, count++); | ||
=} | ||
|
||
reaction(act) -> out {= | ||
out = act; | ||
=} | ||
} | ||
|
||
reactor Print { | ||
input inp:number; | ||
input inp2:number; | ||
reaction(inp, inp2) {= | ||
const elapsedTime = util.getElapsedLogicalTime(); | ||
console.log("At tag " + elapsedTime + ", microstep:" + util.getCurrentTag().microstep + | ||
", received inp = " + inp + " and inp2 = " + inp2 + "."); | ||
if (inp !== undefined && inp2 !== undefined) { | ||
util.requestErrorStop("ERROR: invalid logical simultaneity."); | ||
} | ||
=} | ||
|
||
reaction(shutdown) {= | ||
console.log("SUCCESS: messages were at least one microstep apart."); | ||
=} | ||
} | ||
|
||
federated reactor DistributedDoublePort { | ||
c = new Count(); | ||
cm = new CountMicrostep(); | ||
p = new Print(); | ||
c.out -> p.inp; // Indicating a 'logical' connection. | ||
cm.out -> p.inp2; | ||
} |
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,14 @@ | ||
target TypeScript { | ||
timeout: 2 secs | ||
}; | ||
reactor Fed { | ||
input inp:number; | ||
output out:number; | ||
} | ||
federated reactor { | ||
fed1 = new Fed(); | ||
fed2 = new Fed(); | ||
|
||
fed1.out -> fed2.inp; | ||
fed2.out -> fed1.inp; | ||
} |