From 7862d0a4d6dd7108aa424511a19f6c1ccb9b7ec1 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Mon, 1 Jul 2024 02:28:38 -0700 Subject: [PATCH] Added test case for inheriting auth property --- test/C/src/target/InheritedAuth.lf | 26 ++++++++++++++++++++++++++ test/C/src/target/lib/R1.lf | 11 +++++++++++ 2 files changed, 37 insertions(+) create mode 100644 test/C/src/target/InheritedAuth.lf create mode 100644 test/C/src/target/lib/R1.lf diff --git a/test/C/src/target/InheritedAuth.lf b/test/C/src/target/InheritedAuth.lf new file mode 100644 index 0000000000..d4ac76121a --- /dev/null +++ b/test/C/src/target/InheritedAuth.lf @@ -0,0 +1,26 @@ +// Test passes if it runs successfully. +// Demonstrates inheritance of "auth" target property from import. +// Also see: https://github.com/lf-lang/lingua-franca/issues/2326 +target C { + timeout: 1 s +} + +import R1 from "lib/R1.lf" + +reactor R0 { + output out: int + state s: int = 0 + timer t(0, 100 ms) + + reaction(t) -> out {= + self->s ++ ; + lf_set(out, self->s); + lf_print("R0 is sending %d.", self->s); + =} +} + +federated reactor { + r1 = new R1() + r0 = new R0() + r0.out -> r1.in +} diff --git a/test/C/src/target/lib/R1.lf b/test/C/src/target/lib/R1.lf new file mode 100644 index 0000000000..ed35e1634b --- /dev/null +++ b/test/C/src/target/lib/R1.lf @@ -0,0 +1,11 @@ +target C { + auth: true +} + +reactor R1 { + input in: int + + reaction(in) {= + lf_print("R1 reacted to input %d", in->value); + =} +}