From 486377c395426dd9eac6496c227ed5335afe75dc Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Mon, 18 Sep 2023 14:41:32 +0200 Subject: [PATCH 1/2] Added test for unconnected outputs --- core/src/main/resources/lib/c/reactor-c | 2 +- test/C/src/UnconnectedOutput.lf | 34 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 test/C/src/UnconnectedOutput.lf diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 7e031ec140..f0bd1bc653 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 7e031ec1400fbebc1f90a7ce41fa10ffa40549d2 +Subproject commit f0bd1bc6533e4b47f2af9d4e9d8613fa5e670be0 diff --git a/test/C/src/UnconnectedOutput.lf b/test/C/src/UnconnectedOutput.lf new file mode 100644 index 0000000000..96a8fb3e7a --- /dev/null +++ b/test/C/src/UnconnectedOutput.lf @@ -0,0 +1,34 @@ +// Success here is not segfaulting. +target C { + timeout: 10 ms +} +reactor B(bank_index: int = 0) { + input in:int + output out_problem:int + reaction(in) -> out_problem {= + lf_set(out_problem, self->bank_index); + =} +} +reactor A { + input in:int + output out1:int + output out2:int + output out3:int + + b = new[3] B() + (in)+ -> b.in + b.out_problem -> out1, out2, out3 +} +main reactor { + m = new A() + timer t(0, 10 ms) + reaction(t) -> m.in {= + lf_set(m.in, 42); + =} + reaction(m.out3) {= + lf_print("out3 = %d", m.out3->value); + if (m.out3->value != 2) { + lf_print_error_and_exit("Expected 2."); + } + =} +} From f40157950be906b99771ca77251daaa727fe1e5c Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Mon, 18 Sep 2023 15:01:05 +0200 Subject: [PATCH 2/2] Formatted --- test/C/src/UnconnectedOutput.lf | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/test/C/src/UnconnectedOutput.lf b/test/C/src/UnconnectedOutput.lf index 96a8fb3e7a..571e6f1a04 100644 --- a/test/C/src/UnconnectedOutput.lf +++ b/test/C/src/UnconnectedOutput.lf @@ -1,30 +1,36 @@ // Success here is not segfaulting. target C { - timeout: 10 ms + timeout: 10 ms } + reactor B(bank_index: int = 0) { - input in:int - output out_problem:int + input in: int + output out_problem: int + reaction(in) -> out_problem {= lf_set(out_problem, self->bank_index); =} } + reactor A { - input in:int - output out1:int - output out2:int - output out3:int - + input in: int + output out1: int + output out2: int + output out3: int + b = new[3] B() (in)+ -> b.in b.out_problem -> out1, out2, out3 } + main reactor { m = new A() timer t(0, 10 ms) + reaction(t) -> m.in {= lf_set(m.in, 42); =} + reaction(m.out3) {= lf_print("out3 = %d", m.out3->value); if (m.out3->value != 2) {