Skip to content

Commit

Permalink
Add failing test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
petervdonovan committed Sep 28, 2023
1 parent bee1d9f commit 1aca6c1
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions test/C/src/federated/SmallDelayDecentralized.lf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
target C {
timeout: 1 sec,
coordination: decentralized
}

reactor Count {
state count: int = 1
output out: int
logical action loop

reaction(startup) -> loop {=
lf_schedule(loop, 0);
=}

reaction(loop) -> out {=
lf_set(out, self->count++);
lf_schedule(loop, 0);
=}
}

reactor Print {
input in: int
state c: int = 1
state checks: int = 0

logical action loop

reaction(startup) -> loop {=
lf_schedule(loop, 0);
=}

reaction(in) {=
interval_t elapsed_time = lf_time_logical_elapsed();
lf_print("At time %lld, received %d", elapsed_time, in->value);
if (in->value != self->c) {
lf_print_error_and_exit("Expected to receive %d.", self->c);
}
self->c++;
=} STP(100 msec) {=
lf_print_error_and_exit("STP violation. This should not happen because the STP offset is large.");
=}

reaction(loop) {=
lf_print("checking self.checks, which is now %d...", self->checks);
if (self->checks++ > 10) {
lf_request_stop();
} else {
lf_schedule(loop, 0);
}
=}

reaction(shutdown) {= =}
}

federated reactor {
c = new Count()
p = new Print()
c.out -> p.in after 0
}

0 comments on commit 1aca6c1

Please sign in to comment.