From 541cb5c668ac84a85e148365d165a5aad2b64b3d Mon Sep 17 00:00:00 2001 From: Atharva Patil Date: Sun, 31 Jul 2022 00:22:05 -0700 Subject: [PATCH 1/2] Added 'TagString' test to check for string representation of tag objects. --- test/Python/src/TagString.lf | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/Python/src/TagString.lf diff --git a/test/Python/src/TagString.lf b/test/Python/src/TagString.lf new file mode 100644 index 0000000000..a21acd766e --- /dev/null +++ b/test/Python/src/TagString.lf @@ -0,0 +1,35 @@ +// Tests the get_microstep() function in the python target. +target Python { + fast: false +}; +main reactor TagString { + preamble {= + import sys + =} + state s(1); + + // timer t(0, 1 msec); + logical action l; + reaction(startup) -> l {= + l.schedule(0); + =} + + reaction(l) -> l {= + tag_str = str(lf.tag()) + + if "Tag" in tag_str and \ + "time=" in tag_str and \ + "microstep=" in tag_str: + print("Successful tag string representation:", tag_str) + else: + self.sys.stderr.write( + f"expected tag string representation: " \ + "Tag(time=$time, microstep=$microstep), instead got: {tag_str}\n") + self.sys.exit(1) + + self.s += 1 + if self.s < 10: + l.schedule(0) + =} +} + From aed602b8f8fb7faed62491b1e1787c702d409fb8 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 8 Nov 2023 12:50:31 -0800 Subject: [PATCH 2/2] Apply formatter --- test/Python/src/TagString.lf | 58 ++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/test/Python/src/TagString.lf b/test/Python/src/TagString.lf index a21acd766e..90e7436613 100644 --- a/test/Python/src/TagString.lf +++ b/test/Python/src/TagString.lf @@ -1,35 +1,35 @@ -// Tests the get_microstep() function in the python target. +# Tests the get_microstep() function in the python target. target Python { - fast: false -}; + fast: false +} + main reactor TagString { - preamble {= - import sys - =} - state s(1); + preamble {= + import sys + =} + state s = 1 - // timer t(0, 1 msec); - logical action l; - reaction(startup) -> l {= - l.schedule(0); - =} + logical action l # timer t(0, 1 msec); - reaction(l) -> l {= - tag_str = str(lf.tag()) - - if "Tag" in tag_str and \ - "time=" in tag_str and \ - "microstep=" in tag_str: - print("Successful tag string representation:", tag_str) - else: - self.sys.stderr.write( - f"expected tag string representation: " \ - "Tag(time=$time, microstep=$microstep), instead got: {tag_str}\n") - self.sys.exit(1) + reaction(startup) -> l {= + l.schedule(0); + =} - self.s += 1 - if self.s < 10: - l.schedule(0) - =} -} + reaction(l) -> l {= + tag_str = str(lf.tag()) + if "Tag" in tag_str and \ + "time=" in tag_str and \ + "microstep=" in tag_str: + print("Successful tag string representation:", tag_str) + else: + self.sys.stderr.write( + f"expected tag string representation: " \ + "Tag(time=$time, microstep=$microstep), instead got: {}\n".format(tag_str)) + self.sys.exit(1) + + self.s += 1 + if self.s < 10: + l.schedule(0) + =} +}