Skip to content

Commit

Permalink
Added a new failing test for TAN messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Soroosh129 committed Apr 4, 2022
1 parent 4b10635 commit 3c10dcd
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
44 changes: 44 additions & 0 deletions test/C/src/federated/DistributedPhysicalActionUpstream.lf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
target C { timeout: 2 secs };

import PassThrough from "../lib/PassThrough.lf"
import TestCount from "../lib/TestCount.lf"

preamble {=
int counter = 1;
void callback(void *a) {
schedule(a, counter++);
}
// Simulate time passing before a callback occurs.
void* take_time(void* a) {
while (counter < 40) {
instant_t sleep_time = MSEC(30);
lf_nanosleep(sleep_time);
callback(a);
}
return NULL;
}
=}

reactor WithPhysicalAction {
output out:int;
state thread_id:lf_thread_t(0);
physical action act(0):int;
reaction(startup) -> act {=
// start new thread, provide callback
lf_thread_create(&self->thread_id, &take_time, act);
=}

reaction(act) -> out {=
SET(out, act->value);
=}
}

federated reactor {
a = new WithPhysicalAction();
m1 = new PassThrough();
m2 = new PassThrough();
test = new TestCount(num_inputs=39);
a.out -> m1.in;
m1.out -> m2.in;
m2.out -> test.in;
}
9 changes: 9 additions & 0 deletions test/C/src/lib/PassThrough.lf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
target C;

reactor PassThrough {
input in:int;
output out:int;
reaction(in) -> out {=
SET(out, in->value);
=}
}

0 comments on commit 3c10dcd

Please sign in to comment.