diff --git a/cli/lff/src/test/java/org/lflang/cli/LffCliTest.java b/cli/lff/src/test/java/org/lflang/cli/LffCliTest.java index 27c43c80cc..4941a81046 100644 --- a/cli/lff/src/test/java/org/lflang/cli/LffCliTest.java +++ b/cli/lff/src/test/java/org/lflang/cli/LffCliTest.java @@ -119,7 +119,7 @@ reactor Filter(period: int = 0, b: double[] = {0, 0}) { } main reactor { - az_f = new Filter(period = 100, b = {0.229019233988375, 0.421510777305010}) + az_f = new Filter(period=100, b = {0.229019233988375, 0.421510777305010}) } """), List.of( @@ -165,10 +165,9 @@ reactor Filter(period: int = 0, b: double[] = {0, 0}) { reactor MACService { mul_cm = new ContextManager< - loooooooooooooooooooooooooooooong, - looooooooooooooong, - loooooooooooooong - >() + loooooooooooooooooooooooooooooong, + looooooooooooooong, + loooooooooooooong>() } """)); diff --git a/core/src/main/java/org/lflang/ast/FormattingUtil.java b/core/src/main/java/org/lflang/ast/FormattingUtil.java index 7eb7069ef2..27b19dabb2 100644 --- a/core/src/main/java/org/lflang/ast/FormattingUtil.java +++ b/core/src/main/java/org/lflang/ast/FormattingUtil.java @@ -127,27 +127,47 @@ static String lineWrapComments(List comments, int width, String singleLi } /** Wrap lines. Do not merge lines that start with weird characters. */ private static String lineWrapComment(String comment, int width, String singleLineCommentPrefix) { + var multiline = MULTILINE_COMMENT.matcher(comment).matches(); + comment = comment.strip().replaceAll("(^|(?<=\n))\\h*(/\\*+|//|#)", ""); + if (!multiline) + return comment.isBlank() + ? "" + : comment + .replaceAll("(^|(?<=\n))\s*(?=\\w)", " ") + .replaceAll("^|(?<=\n)", singleLineCommentPrefix); width = Math.max(width, MINIMUM_COMMENT_WIDTH_IN_COLUMNS); - List> paragraphs = - Arrays.stream( - comment - .strip() - .replaceAll("^/?((\\*|//|#)\\s*)+", "") - .replaceAll("\\s*\\*/$", "") - .replaceAll("(?<=(\\r\\n|\\r|\\n))\\h*(\\*|//|#)\\h*", "") - .split("(\n\\s*){2,}")) - .map(s -> Arrays.stream(s.split("(\\r\\n|\\r|\\n)\\h*(?=[@#$%^&*\\-+=:;<>/])"))) - .map(stream -> stream.map(s -> s.replaceAll("\\s+", " "))) - .map(Stream::toList) - .toList(); - if (MULTILINE_COMMENT.matcher(comment).matches()) { - if (paragraphs.size() == 1 && paragraphs.get(0).size() == 1) { - String singleLineRepresentation = String.format("/** %s */", paragraphs.get(0).get(0)); - if (singleLineRepresentation.length() <= width) return singleLineRepresentation; - } - return String.format("/**\n%s\n */", lineWrapComment(paragraphs, width, " * ")); + var stripped = + comment + .replaceAll("\\s*\\*/$", "") + .replaceAll("(?<=(\\r\\n|\\r|\\n))\\h*(\\*|//|#)\\h?(\\h*)", "$3") + .strip(); + var preformatted = false; + StringBuilder result = new StringBuilder(stripped.length() * 2); + for (var part : stripped.split("```")) { + result.append( + preformatted + ? part.lines() + .skip(1) + .map(it -> " * " + it) + .collect(Collectors.joining("\n", "\n * ```\n", "\n * ```\n")) + : lineWrapComment( + Arrays.stream(part.split("(\n\\s*){2,}")) + .map( + s -> + Arrays.stream(s.split("(\\r\\n|\\r|\\n)\\h*(?=[@#$%^&*\\-+=:;<>/])"))) + .map(stream -> stream.map(s -> s.replaceAll("\\s+", " "))) + .map(Stream::toList) + .toList(), + width, + " * ")); + preformatted = !preformatted; + } + if (result.indexOf("\n") == -1) { + String singleLineRepresentation = + String.format("/** %s */", result.substring(result.indexOf(" * ") + 3)); + if (singleLineRepresentation.length() <= width) return singleLineRepresentation; } - return lineWrapComment(paragraphs, width, singleLineCommentPrefix + " "); + return String.format("/**\n%s\n */", result); } /** diff --git a/core/src/main/java/org/lflang/ast/MalleableString.java b/core/src/main/java/org/lflang/ast/MalleableString.java index ac4014748d..968d9e1fcb 100644 --- a/core/src/main/java/org/lflang/ast/MalleableString.java +++ b/core/src/main/java/org/lflang/ast/MalleableString.java @@ -10,6 +10,7 @@ import java.util.function.BinaryOperator; import java.util.function.Consumer; import java.util.function.Function; +import java.util.function.Predicate; import java.util.function.Supplier; import java.util.function.ToLongFunction; import java.util.stream.Collector; @@ -91,6 +92,14 @@ public static MalleableString anyOf(Object... possibilities) { return new Leaf(objectArrayToString(possibilities)); } + /** + * Apply the given constraint to leaf strings of this. + * + *

This is done on a best-effort basis in the sense that if no options satisfy the constraint, + * the constraint is not applied. + */ + public abstract MalleableString constrain(Predicate constraint); + private static String[] objectArrayToString(Object[] objects) { String[] ret = new String[objects.length]; for (int i = 0; i < objects.length; i++) { @@ -407,6 +416,14 @@ private boolean optimizeChildren( providedRender, badness, width, indentation, singleLineCommentPrefix)); } + @Override + public MalleableString constrain(Predicate constraint) { + for (var component : components) { + component.constrain(constraint); + } + return this; + } + @Override public boolean isEmpty() { return components.stream().allMatch(MalleableString::isEmpty); @@ -468,6 +485,12 @@ public RenderResult render( .replaceAll("(?<=\n|^)(?=\\h*\\S)", " ".repeat(indentation)), result.levelsOfCommentDisplacement()); } + + @Override + public MalleableString constrain(Predicate constraint) { + nested.constrain(constraint); + return this; + } } /** Represent a {@code MalleableString} that admits multiple possible representations. */ @@ -549,23 +572,31 @@ public RenderResult render( sourceEObject != null ? sourceEObject : enclosingEObject) .with(comments.stream()); } + + @Override + public MalleableString constrain(Predicate constraint) { + for (var possibility : possibilities) { + possibility.constrain(constraint); + } + return this; + } } /** A {@code Leaf} can be represented by multiple possible {@code String}s. */ private static final class Leaf extends MalleableStringWithAlternatives { - private final ImmutableList possibilities; + private List possibilities; private Leaf(String[] possibilities) { - this.possibilities = ImmutableList.copyOf(possibilities); + this.possibilities = List.of(possibilities); } private Leaf(String possibility) { - this.possibilities = ImmutableList.of(possibility); + this.possibilities = List.of(possibility); } @Override protected List getPossibilities() { - return this.possibilities; + return possibilities; } @Override @@ -586,5 +617,12 @@ public RenderResult render( : getChosenPossibility(), 0); } + + @Override + public MalleableString constrain(Predicate constraint) { + var newPossibilities = possibilities.stream().filter(constraint).toList(); + if (!newPossibilities.isEmpty()) possibilities = newPossibilities; + return this; + } } } diff --git a/core/src/main/java/org/lflang/ast/ToLf.java b/core/src/main/java/org/lflang/ast/ToLf.java index 410d0575f2..bb73b8e4f4 100644 --- a/core/src/main/java/org/lflang/ast/ToLf.java +++ b/core/src/main/java/org/lflang/ast/ToLf.java @@ -100,7 +100,7 @@ private ToLf() { @Override public MalleableString caseArraySpec(ArraySpec spec) { if (spec.isOfVariableLength()) return MalleableString.anyOf("[]"); - return list("", "[", "]", false, false, spec.getLength()); + return list("", "[", "]", false, false, true, spec.getLength()); } @Override @@ -308,7 +308,7 @@ public MalleableString caseType(Type type) { } else if (type.getId() != null) { msb.append(type.getId()); // TODO: Multiline dottedName? if (type.getTypeArgs() != null) { - msb.append(list(", ", "<", ">", true, false, type.getTypeArgs())); + msb.append(list(", ", "<", ">", true, false, true, type.getTypeArgs())); } msb.append("*".repeat(type.getStars().size())); } @@ -362,7 +362,7 @@ public MalleableString caseImport(Import object) { return new Builder() .append("import ") // TODO: This is a place where we can use conditional parentheses. - .append(list(", ", "", "", false, true, object.getReactorClasses())) + .append(list(", ", "", "", false, true, true, object.getReactorClasses())) .append(" from \"") .append(object.getImportURI()) .append("\"") @@ -444,7 +444,7 @@ private MalleableString reactorHeader(Reactor object) { if (object.isRealtime()) msb.append("realtime "); msb.append("reactor"); if (object.getName() != null) msb.append(" ").append(object.getName()); - msb.append(list(", ", "<", ">", true, false, object.getTypeParms())); + msb.append(list(", ", "<", ">", true, false, true, object.getTypeParms())); msb.append(list(true, object.getParameters())); if (object.getHost() != null) msb.append(" at ").append(doSwitch(object.getHost())); if (object.getSuperClasses() != null && !object.getSuperClasses().isEmpty()) { @@ -489,7 +489,8 @@ public MalleableString caseStateVar(StateVar object) { } msb.append("state ").append(object.getName()); msb.append(typeAnnotationFor(object.getType())); - if (object.getInit() != null) msb.append(doSwitch(object.getInit())); + if (object.getInit() != null) + msb.append(doSwitch(object.getInit()).constrain(it -> it.contains(" = "))); return msb.get(); } @@ -620,7 +621,7 @@ public MalleableString caseReaction(Reaction object) { } if (object.getName() != null) msb.append(" ").append(object.getName()); msb.append(list(true, object.getTriggers())); - msb.append(list(", ", " ", "", true, false, object.getSources())); + msb.append(list(", ", " ", "", true, false, true, object.getSources())); if (!object.getEffects().isEmpty()) { List allModes = ASTUtils.allModes(ASTUtils.getEnclosingReactor(object)); msb.append(" -> ", " ->\n") @@ -737,7 +738,7 @@ public MalleableString caseInstantiation(Instantiation object) { msb.append(object.getName()).append(" = new"); if (object.getWidthSpec() != null) msb.append(doSwitch(object.getWidthSpec())); msb.append(" ").append(object.getReactorClass().getName()); - msb.append(list(", ", "<", ">", true, false, object.getTypeArgs())); + msb.append(list(", ", "<", ">", true, false, true, object.getTypeArgs())); msb.append(list(false, object.getParameters())); // TODO: Delete the following case when the corresponding feature is removed if (object.getHost() != null) msb.append(" at ").append(doSwitch(object.getHost())).append(";"); @@ -788,10 +789,10 @@ public MalleableString caseConnection(Connection object) { private MalleableString minimallyDelimitedList(List items) { return MalleableString.anyOf( - list(", ", " ", "", true, true, items), + list(", ", " ", "", true, true, true, items), new Builder() .append(String.format("%n")) - .append(list(String.format(",%n"), "", "", true, true, items).indent()) + .append(list(String.format(",%n"), "", "", true, true, true, items).indent()) .get()); } @@ -809,7 +810,7 @@ public MalleableString caseKeyValuePairs(KeyValuePairs object) { } return new Builder() .append("{\n") - .append(list(",\n", "", "\n", true, true, object.getPairs()).indent()) + .append(list(",\n", "", "\n", true, true, false, object.getPairs()).indent()) .append("}") .get(); } @@ -829,7 +830,7 @@ public MalleableString caseBracedListExpression(BracedListExpression object) { private MalleableString bracedListExpression(List items) { // Note that this strips the trailing comma. There is no way // to implement trailing commas with the current set of list() methods AFAIU. - return list(", ", "{", "}", false, false, items); + return list(", ", "{", "}", false, false, true, items); } @Override @@ -845,7 +846,7 @@ public MalleableString caseKeyValuePair(KeyValuePair object) { @Override public MalleableString caseArray(Array object) { // '[' elements+=Element (',' (elements+=Element))* ','? ']' - return list(", ", "[", "]", false, false, object.getElements()); + return list(", ", "[", "]", false, false, true, object.getElements()); } @Override @@ -886,7 +887,8 @@ public MalleableString caseAssignment(Assignment object) { // )); Builder msb = new Builder(); msb.append(object.getLhs().getName()); - msb.append(doSwitch(object.getRhs())); + var rhs = doSwitch(object.getRhs()); + msb.append(rhs.constrain(conditionalWhitespaceInitializer(MalleableString.anyOf(""), rhs))); return msb.get(); } @@ -904,15 +906,16 @@ public MalleableString caseInitializer(Initializer init) { if (init == null) { return MalleableString.anyOf(""); } + var builder = new Builder().append("=", " = "); if (shouldOutputAsAssignment(init)) { Expression expr = ASTUtils.asSingleExpr(init); Objects.requireNonNull(expr); - return new Builder().append(" = ").append(doSwitch(expr)).get(); + return builder.append(doSwitch(expr)).get(); } if (ASTUtils.getTarget(init) == Target.C) { // This turns C array initializers into a braced expression. // C++ variants are not converted. - return new Builder().append(" = ").append(bracedListExpression(init.getExprs())).get(); + return builder.append(bracedListExpression(init.getExprs())).get(); } String prefix; String suffix; @@ -924,7 +927,7 @@ public MalleableString caseInitializer(Initializer init) { prefix = "("; suffix = ")"; } - return list(", ", prefix, suffix, false, false, init.getExprs()); + return list(", ", prefix, suffix, false, false, true, init.getExprs()); } @Override @@ -935,13 +938,26 @@ public MalleableString caseParameter(Parameter object) { // )? var builder = new Builder(); addAttributes(builder, object::getAttributes); + var annotation = typeAnnotationFor(object.getType()); + var init = doSwitch(object.getInit()); return builder .append(object.getName()) - .append(typeAnnotationFor(object.getType())) - .append(doSwitch(object.getInit())) + .append(annotation) + .append(init.constrain(conditionalWhitespaceInitializer(annotation, init))) .get(); } + /** + * Ensure that equals signs are surrounded by spaces if neither the text before nor the text after + * has spaces and is not a string. + */ + private static Predicate conditionalWhitespaceInitializer( + MalleableString before, MalleableString after) { + return it -> + (before.isEmpty() && !(after.toString().contains(" ") || after.toString().startsWith("\""))) + != it.contains(" = "); + } + @Override public MalleableString caseExpression(Expression object) { // {Literal} literal = Literal @@ -961,7 +977,7 @@ public MalleableString casePort(Port object) { public MalleableString caseWidthSpec(WidthSpec object) { // ofVariableLength?='[]' | '[' (terms+=WidthTerm) ('+' terms+=WidthTerm)* ']'; if (object.isOfVariableLength()) return MalleableString.anyOf("[]"); - return list(" + ", "[", "]", false, false, object.getTerms()); + return list(" + ", "[", "]", false, false, true, object.getTerms()); } @Override @@ -1025,6 +1041,7 @@ private MalleableString list( String suffix, boolean nothingIfEmpty, boolean whitespaceRigid, + boolean suffixSameLine, List items) { return list( separator, @@ -1032,6 +1049,7 @@ private MalleableString list( suffix, nothingIfEmpty, whitespaceRigid, + suffixSameLine, (Object[]) items.toArray(EObject[]::new)); } @@ -1041,9 +1059,10 @@ private MalleableString list( String suffix, boolean nothingIfEmpty, boolean whitespaceRigid, + boolean suffixSameLine, Object... items) { - if (nothingIfEmpty && Arrays.stream(items).allMatch(Objects::isNull)) { - return MalleableString.anyOf(""); + if (Arrays.stream(items).allMatch(Objects::isNull)) { + return MalleableString.anyOf(nothingIfEmpty ? "" : prefix + suffix); } MalleableString rigid = Arrays.stream(items) @@ -1057,21 +1076,30 @@ private MalleableString list( }) .collect(new Joiner(separator, prefix, suffix)); if (whitespaceRigid) return rigid; + var rigidList = + list( + separator.strip() + "\n", + "", + suffixSameLine ? "" : "\n", + nothingIfEmpty, + true, + suffixSameLine, + items); return MalleableString.anyOf( rigid, new Builder() .append(prefix.stripTrailing() + "\n") - .append(list(separator.strip() + "\n", "", "\n", nothingIfEmpty, true, items).indent()) + .append(suffixSameLine ? rigidList.indent().indent() : rigidList.indent()) .append(suffix.stripLeading()) .get()); } private MalleableString list(boolean nothingIfEmpty, EList items) { - return list(", ", "(", ")", nothingIfEmpty, false, items); + return list(", ", "(", ")", nothingIfEmpty, false, true, items); } private MalleableString list(boolean nothingIfEmpty, Object... items) { - return list(", ", "(", ")", nothingIfEmpty, false, items); + return list(", ", "(", ")", nothingIfEmpty, false, true, items); } private MalleableString typeAnnotationFor(Type type) { diff --git a/core/src/test/java/org/lflang/tests/compiler/RoundTripTests.java b/core/src/test/java/org/lflang/tests/compiler/RoundTripTests.java index 7df80e7e3c..9dc4957f2c 100644 --- a/core/src/test/java/org/lflang/tests/compiler/RoundTripTests.java +++ b/core/src/test/java/org/lflang/tests/compiler/RoundTripTests.java @@ -64,7 +64,7 @@ private static void run(LfParsingHelper parser, Path file) { final String squishedTestCase = FormattingUtil.render(originalModel, smallLineLength); final Model resultingModel = parser.parseSourceAsIfInDirectory(file.getParent(), squishedTestCase); - LfParsingTestHelper.checkValid("file in " + file.getParent(), resultingModel); + LfParsingTestHelper.checkValid(file.toString(), resultingModel); assertThat(resultingModel.eResource().getErrors(), equalTo(emptyList())); Assertions.assertTrue( diff --git a/test/C/src/ActionDelay.lf b/test/C/src/ActionDelay.lf index 4951f806c2..90847eb9d5 100644 --- a/test/C/src/ActionDelay.lf +++ b/test/C/src/ActionDelay.lf @@ -30,10 +30,10 @@ reactor Sink { interval_t physical = lf_time_physical(); printf("Logical, physical, and elapsed logical: %lld %lld %lld.\n", logical, physical, elapsed_logical); if (elapsed_logical != MSEC(100)) { - printf("FAILURE: Expected %lld but got %lld.\n", MSEC(100), elapsed_logical); - exit(1); + printf("FAILURE: Expected %lld but got %lld.\n", MSEC(100), elapsed_logical); + exit(1); } else { - printf("SUCCESS. Elapsed logical time is 100 msec.\n"); + printf("SUCCESS. Elapsed logical time is 100 msec.\n"); } =} } diff --git a/test/C/src/ActionIsPresent.lf b/test/C/src/ActionIsPresent.lf index 2c0bff1293..573025a323 100644 --- a/test/C/src/ActionIsPresent.lf +++ b/test/C/src/ActionIsPresent.lf @@ -7,22 +7,22 @@ main reactor ActionIsPresent(offset: time = 1 nsec, period: time = 500 msec) { reaction(startup, a) -> a {= if (!a->is_present) { - if (self->offset == 0) { - printf("Hello World!\n"); - self->success = true; - } else { - lf_schedule(a, self->offset); - } - } else { - printf("Hello World 2!\n"); + if (self->offset == 0) { + printf("Hello World!\n"); self->success = true; + } else { + lf_schedule(a, self->offset); + } + } else { + printf("Hello World 2!\n"); + self->success = true; } =} reaction(shutdown) {= if (!self->success) { - fprintf(stderr, "Failed to print 'Hello World'\n"); - exit(1); + fprintf(stderr, "Failed to print 'Hello World'\n"); + exit(1); } =} } diff --git a/test/C/src/After.lf b/test/C/src/After.lf index e7aeba5b8d..f21c6b7f76 100644 --- a/test/C/src/After.lf +++ b/test/C/src/After.lf @@ -21,22 +21,22 @@ reactor print { interval_t elapsed_time = lf_time_logical_elapsed(); printf("Result is %d\n", x->value); if (x->value != 84) { - printf("ERROR: Expected result to be 84.\n"); - exit(1); + printf("ERROR: Expected result to be 84.\n"); + exit(1); } printf("Current logical time is: %lld\n", elapsed_time); printf("Current physical time is: %lld\n", lf_time_physical_elapsed()); if (elapsed_time != self->expected_time) { - printf("ERROR: Expected logical time to be %lld.\n", self->expected_time); - exit(2); + printf("ERROR: Expected logical time to be %lld.\n", self->expected_time); + exit(2); } self->expected_time += SEC(1); =} reaction(shutdown) {= if (self->received == 0) { - printf("ERROR: Final reactor received no data.\n"); - exit(3); + printf("ERROR: Final reactor received no data.\n"); + exit(3); } =} } diff --git a/test/C/src/AfterCycles.lf b/test/C/src/AfterCycles.lf index 3a7301a7a2..cc2eab638e 100644 --- a/test/C/src/AfterCycles.lf +++ b/test/C/src/AfterCycles.lf @@ -29,12 +29,12 @@ main reactor AfterCycles { interval_t elapsed_time = lf_time_logical_elapsed(); printf("Received %d from worker 0 at time %lld.\n", w0.out->value, elapsed_time); if (elapsed_time != MSEC(10)) { - fprintf(stderr, "Time should have been 10000000.\n"); - exit(1); + fprintf(stderr, "Time should have been 10000000.\n"); + exit(1); } if (w0.out->value != 1) { - fprintf(stderr, "Value should have been 1.\n"); - exit(4); + fprintf(stderr, "Value should have been 1.\n"); + exit(4); } =} @@ -43,19 +43,19 @@ main reactor AfterCycles { interval_t elapsed_time = lf_time_logical_elapsed(); printf("Received %d from worker 1 at time %lld.\n", w1.out->value, elapsed_time); if (elapsed_time != MSEC(20)) { - fprintf(stderr, "Time should have been 20000000.\n"); - exit(3); + fprintf(stderr, "Time should have been 20000000.\n"); + exit(3); } if (w1.out->value != 1) { - fprintf(stderr, "Value should have been 1.\n"); - exit(4); + fprintf(stderr, "Value should have been 1.\n"); + exit(4); } =} reaction(shutdown) {= if (self->count != 2) { - fprintf(stderr, "Top-level reactions should have been triggered but were not.\n"); - exit(5); + fprintf(stderr, "Top-level reactions should have been triggered but were not.\n"); + exit(5); } =} } diff --git a/test/C/src/AfterOverlapped.lf b/test/C/src/AfterOverlapped.lf index b1124c4274..51e161f98a 100644 --- a/test/C/src/AfterOverlapped.lf +++ b/test/C/src/AfterOverlapped.lf @@ -16,25 +16,25 @@ reactor Test { printf("Received %d.\n", c->value); (self->i)++; if (c->value != self->i) { - printf("ERROR: Expected %d but got %d\n.", self->i, c->value); - exit(1); + printf("ERROR: Expected %d but got %d\n.", self->i, c->value); + exit(1); } interval_t elapsed_time = lf_time_logical_elapsed(); printf("Current logical time is: %lld\n", elapsed_time); interval_t expected_logical_time = SEC(2) + SEC(1)*(c->value - 1); if (elapsed_time != expected_logical_time) { - printf("ERROR: Expected logical time to be %lld but got %lld\n.", - expected_logical_time, elapsed_time - ); - exit(1); + printf("ERROR: Expected logical time to be %lld but got %lld\n.", + expected_logical_time, elapsed_time + ); + exit(1); } =} reaction(shutdown) {= if (self->received == 0) { - printf("ERROR: Final reactor received no data.\n"); - exit(3); + printf("ERROR: Final reactor received no data.\n"); + exit(3); } =} } diff --git a/test/C/src/AfterZero.lf b/test/C/src/AfterZero.lf index 547222246c..10fc9d7a8b 100644 --- a/test/C/src/AfterZero.lf +++ b/test/C/src/AfterZero.lf @@ -21,27 +21,27 @@ reactor print { interval_t elapsed_time = lf_time_logical_elapsed(); printf("Result is %d\n", x->value); if (x->value != 84) { - printf("ERROR: Expected result to be 84.\n"); - exit(1); + printf("ERROR: Expected result to be 84.\n"); + exit(1); } printf("Current logical time is: %lld\n", elapsed_time); printf("Current microstep is: %lld\n", lf_tag().microstep); printf("Current physical time is: %lld\n", lf_time_physical_elapsed()); if (elapsed_time != self->expected_time) { - printf("ERROR: Expected logical time to be %lld.\n", self->expected_time); - exit(2); + printf("ERROR: Expected logical time to be %lld.\n", self->expected_time); + exit(2); } if (lf_tag().microstep != 1) { - printf("ERROR: Expected microstep to be 1\n"); - exit(3); + printf("ERROR: Expected microstep to be 1\n"); + exit(3); } self->expected_time += SEC(1); =} reaction(shutdown) {= if (self->received == 0) { - printf("ERROR: Final reactor received no data.\n"); - exit(3); + printf("ERROR: Final reactor received no data.\n"); + exit(3); } =} } diff --git a/test/C/src/Alignment.lf b/test/C/src/Alignment.lf index 1c5c907a37..c1cba1b948 100644 --- a/test/C/src/Alignment.lf +++ b/test/C/src/Alignment.lf @@ -28,44 +28,44 @@ reactor Sieve { reaction(in) -> out {= // Reject inputs that are out of bounds. if (in->value <= 0 || in->value > 10000) { - lf_print_warning("Sieve: Input value out of range: %d.", in->value); + lf_print_warning("Sieve: Input value out of range: %d.", in->value); } // Primes 1 and 2 are not on the list. if (in->value == 1 || in->value == 2) { - lf_set(out, true); - return; + lf_set(out, true); + return; } // If the input is greater than the last found prime, then // we have to expand the list of primes before checking to // see whether this is prime. int candidate = self->primes[self->last_prime]; while (in->value > self->primes[self->last_prime]) { - // The next prime is always odd, so we can increment by two. - candidate += 2; - bool prime = true; - for (int i = 0; i < self->last_prime; i++) { - if (candidate % self->primes[i] == 0) { - // Candidate is not prime. Break and add 2 - prime = false; - break; - } - } - // If the candidate is not divisible by any prime in the list, it is prime. - if (prime) { - self->last_prime++; - self->primes[self->last_prime] = candidate; - lf_print("Sieve: Found prime: %d.", candidate); + // The next prime is always odd, so we can increment by two. + candidate += 2; + bool prime = true; + for (int i = 0; i < self->last_prime; i++) { + if (candidate % self->primes[i] == 0) { + // Candidate is not prime. Break and add 2 + prime = false; + break; } + } + // If the candidate is not divisible by any prime in the list, it is prime. + if (prime) { + self->last_prime++; + self->primes[self->last_prime] = candidate; + lf_print("Sieve: Found prime: %d.", candidate); + } } // We are now assured that the input is less than or // equal to the last prime on the list. // See whether the input is an already found prime. for (int i = self->last_prime; i >= 0; i--) { - // Search the primes from the end, where they are sparser. - if (self->primes[i] == in->value) { - lf_set(out, true); - return; - } + // Search the primes from the end, where they are sparser. + if (self->primes[i] == in->value) { + lf_set(out, true); + return; + } } =} } @@ -78,17 +78,17 @@ reactor Destination { reaction(ok, in) {= tag_t current_tag = lf_tag(); if (ok->is_present && in->is_present) { - lf_print("Destination: Input %d is prime at tag (%lld, %d).", - in->value, - current_tag.time - lf_time_start(), current_tag.microstep - ); + lf_print("Destination: Input %d is prime at tag (%lld, %d).", + in->value, + current_tag.time - lf_time_start(), current_tag.microstep + ); } if (lf_tag_compare(current_tag, self->last_invoked) <= 0) { - lf_print_error_and_exit("Invoked at tag (%lld, %d), " - "but previously invoked at tag (%lld, %d).", - current_tag.time - lf_time_start(), current_tag.microstep, - self->last_invoked.time - lf_time_start(), self->last_invoked.microstep - ); + lf_print_error_and_exit("Invoked at tag (%lld, %d), " + "but previously invoked at tag (%lld, %d).", + current_tag.time - lf_time_start(), current_tag.microstep, + self->last_invoked.time - lf_time_start(), self->last_invoked.microstep + ); } self->last_invoked = current_tag; =} diff --git a/test/C/src/ArrayAsParameter.lf b/test/C/src/ArrayAsParameter.lf index a513cbee9f..fe0133692d 100644 --- a/test/C/src/ArrayAsParameter.lf +++ b/test/C/src/ArrayAsParameter.lf @@ -11,7 +11,7 @@ reactor Source(sequence: int[] = {0, 1, 2}, n_sequence: int = 3) { lf_set(out, self->sequence[self->count]); self->count++; if (self->count < self->n_sequence) { - lf_schedule(next, 0); + lf_schedule(next, 0); } =} } @@ -25,22 +25,22 @@ reactor Print { self->received++; printf("Received: %d\n", in->value); if (in->value != self->count) { - printf("ERROR: Expected %d.\n", self->count); - exit(1); + printf("ERROR: Expected %d.\n", self->count); + exit(1); } self->count++; =} reaction(shutdown) {= if (self->received == 0) { - printf("ERROR: Final reactor received no data.\n"); - exit(3); + printf("ERROR: Final reactor received no data.\n"); + exit(3); } =} } main reactor ArrayAsParameter { - s = new Source(sequence = {1, 2, 3, 4}, n_sequence = 4) + s = new Source(sequence = {1, 2, 3, 4}, n_sequence=4) p = new Print() s.out -> p.in } diff --git a/test/C/src/ArrayAsType.lf b/test/C/src/ArrayAsType.lf index 8339c6f9c2..d604dd5e51 100644 --- a/test/C/src/ArrayAsType.lf +++ b/test/C/src/ArrayAsType.lf @@ -18,22 +18,22 @@ reactor Print(scale: int = 1) { input in: int[3] reaction(in) {= - int count = 0; // For testing. + int count = 0; // For testing. bool failed = false; // For testing. printf("Received: ["); for (int i = 0; i < 3; i++) { - if (i > 0) printf(", "); - printf("%d", in->value[i]); - // For testing, check whether values match expectation. - if (in->value[i] != self->scale * count) { - failed = true; - } - count++; // For testing. + if (i > 0) printf(", "); + printf("%d", in->value[i]); + // For testing, check whether values match expectation. + if (in->value[i] != self->scale * count) { + failed = true; + } + count++; // For testing. } printf("]\n"); if (failed) { - printf("ERROR: Value received by Print does not match expectation!\n"); - exit(1); + printf("ERROR: Value received by Print does not match expectation!\n"); + exit(1); } =} } diff --git a/test/C/src/ArrayFree.lf b/test/C/src/ArrayFree.lf index ced36f82f7..bfdc04d41a 100644 --- a/test/C/src/ArrayFree.lf +++ b/test/C/src/ArrayFree.lf @@ -15,7 +15,7 @@ reactor Free(scale: int = 2, size: int = 3) { reaction(in) {= for(int i = 0; i < self->size; i++) { - in->value[i] *= self->scale; + in->value[i] *= self->scale; } =} } @@ -24,7 +24,7 @@ main reactor ArrayFree { s = new Source() c = new Free() c2 = new Scale() - p = new Print(scale = 2) + p = new Print(scale=2) s.out -> c.in s.out -> c2.in c2.out -> p.in diff --git a/test/C/src/ArrayFreeMultiple.lf b/test/C/src/ArrayFreeMultiple.lf index 292f5cdb10..f43c7cd924 100644 --- a/test/C/src/ArrayFreeMultiple.lf +++ b/test/C/src/ArrayFreeMultiple.lf @@ -31,7 +31,7 @@ reactor Free(scale: int = 2) { reaction(in) {= for(int i = 0; i < in->length; i++) { - in->value[i] *= self->scale; + in->value[i] *= self->scale; } =} } @@ -40,7 +40,7 @@ main reactor ArrayFreeMultiple { s = new Source() c = new Free() c2 = new Scale() - p = new Print(scale = 2) + p = new Print(scale=2) s.out -> c.in s.out -> c2.in c2.out -> p.in diff --git a/test/C/src/ArrayParallel.lf b/test/C/src/ArrayParallel.lf index 3edb9c659e..635ca1f6a4 100644 --- a/test/C/src/ArrayParallel.lf +++ b/test/C/src/ArrayParallel.lf @@ -12,9 +12,9 @@ import Source, Print from "ArrayPrint.lf" main reactor ArrayParallel { s = new Source() c1 = new Scale() - c2 = new Scale(scale = 3) - p1 = new Print(scale = 2) - p2 = new Print(scale = 3) + c2 = new Scale(scale=3) + p1 = new Print(scale=2) + p2 = new Print(scale=3) s.out -> c1.in s.out -> c2.in c1.out -> p1.in diff --git a/test/C/src/ArrayPrint.lf b/test/C/src/ArrayPrint.lf index 49aaca5c12..d1eb3b31ab 100644 --- a/test/C/src/ArrayPrint.lf +++ b/test/C/src/ArrayPrint.lf @@ -33,18 +33,18 @@ reactor Print(scale: int = 1, size: int = 3) { bool failed = false; // For testing. printf("Received: ["); for (int i = 0; i < self->size; i++) { - if (i > 0) printf(", "); - printf("%d", in->value[i]); - // For testing, check whether values match expectation. - if (in->value[i] != self->scale * self->count) { - failed = true; - } - self->count++; // For testing. + if (i > 0) printf(", "); + printf("%d", in->value[i]); + // For testing, check whether values match expectation. + if (in->value[i] != self->scale * self->count) { + failed = true; + } + self->count++; // For testing. } printf("]\n"); if (failed) { - printf("ERROR: Value received by Print does not match expectation!\n"); - exit(1); + printf("ERROR: Value received by Print does not match expectation!\n"); + exit(1); } =} } diff --git a/test/C/src/ArrayScale.lf b/test/C/src/ArrayScale.lf index 06744dbcf1..7ec283fd81 100644 --- a/test/C/src/ArrayScale.lf +++ b/test/C/src/ArrayScale.lf @@ -14,7 +14,7 @@ reactor Scale(scale: int = 2) { reaction(in) -> out {= for(int i = 0; i < in->length; i++) { - in->value[i] *= self->scale; + in->value[i] *= self->scale; } lf_set_token(out, in->token); =} @@ -23,7 +23,7 @@ reactor Scale(scale: int = 2) { main reactor ArrayScale { s = new Source() c = new Scale() - p = new Print(scale = 2) + p = new Print(scale=2) s.out -> c.in c.out -> p.in } diff --git a/test/C/src/CharLiteralInitializer.lf b/test/C/src/CharLiteralInitializer.lf index ab0c12b1d8..b240640182 100644 --- a/test/C/src/CharLiteralInitializer.lf +++ b/test/C/src/CharLiteralInitializer.lf @@ -6,8 +6,8 @@ main reactor CharLiteralInitializer { reaction(startup) {= if (self->c != 'x') { - fprintf(stderr, "FAILED: Expected 'x', got %c.\n", self->c); - exit(1); + fprintf(stderr, "FAILED: Expected 'x', got %c.\n", self->c); + exit(1); } =} } diff --git a/test/C/src/Composition.lf b/test/C/src/Composition.lf index 823bd1a2fe..906fa5f2f7 100644 --- a/test/C/src/Composition.lf +++ b/test/C/src/Composition.lf @@ -24,14 +24,14 @@ reactor Test { (self->count)++; printf("Received %d\n", x->value); if (x->value != self->count) { - fprintf(stderr, "FAILURE: Expected %d\n", self->count); - exit(1); + fprintf(stderr, "FAILURE: Expected %d\n", self->count); + exit(1); } =} reaction(shutdown) {= if (self->count == 0) { - fprintf(stderr, "FAILURE: No data received.\n"); + fprintf(stderr, "FAILURE: No data received.\n"); } =} } diff --git a/test/C/src/CompositionAfter.lf b/test/C/src/CompositionAfter.lf index c0ce81f46b..8afd36a1df 100644 --- a/test/C/src/CompositionAfter.lf +++ b/test/C/src/CompositionAfter.lf @@ -23,8 +23,8 @@ reactor Test { (self->count)++; printf("Received %d\n", x->value); if (x->value != self->count) { - printf("FAILURE: Expected %d\n", self->count); - exit(1); + printf("FAILURE: Expected %d\n", self->count); + exit(1); } =} } diff --git a/test/C/src/CompositionGain.lf b/test/C/src/CompositionGain.lf index 0b0ead780f..a34c95c10c 100644 --- a/test/C/src/CompositionGain.lf +++ b/test/C/src/CompositionGain.lf @@ -27,8 +27,8 @@ main reactor CompositionGain { reaction(wrapper.y) {= printf("Received %d\n", wrapper.y->value); if (wrapper.y->value != 42 * 2) { - fprintf(stderr, "ERROR: Received value should have been %d.\n", 42 * 2); - exit(2); + fprintf(stderr, "ERROR: Received value should have been %d.\n", 42 * 2); + exit(2); } =} } diff --git a/test/C/src/CompositionInheritance.lf b/test/C/src/CompositionInheritance.lf index cd345149d5..8e31e5e677 100644 --- a/test/C/src/CompositionInheritance.lf +++ b/test/C/src/CompositionInheritance.lf @@ -35,14 +35,14 @@ reactor Test { (self->count)++; printf("Received %d\n", x->value); if (x->value != self->count) { - fprintf(stderr, "FAILURE: Expected %d\n", self->count); - exit(1); + fprintf(stderr, "FAILURE: Expected %d\n", self->count); + exit(1); } =} reaction(shutdown) {= if (self->count == 0) { - fprintf(stderr, "FAILURE: No data received.\n"); + fprintf(stderr, "FAILURE: No data received.\n"); } =} } diff --git a/test/C/src/CountSelf.lf b/test/C/src/CountSelf.lf index ec910c1066..703437f3ba 100644 --- a/test/C/src/CountSelf.lf +++ b/test/C/src/CountSelf.lf @@ -23,6 +23,6 @@ reactor CountSelf2(delay: time = 100 msec) { main reactor { d = new CountSelf2() - t = new TestCount(num_inputs = 11, start = 0) + t = new TestCount(num_inputs=11, start=0) d.out -> t.in } diff --git a/test/C/src/CountTest.lf b/test/C/src/CountTest.lf index 7ac4349d2a..9652aa70c4 100644 --- a/test/C/src/CountTest.lf +++ b/test/C/src/CountTest.lf @@ -9,6 +9,6 @@ import TestCount from "lib/TestCount.lf" main reactor CountTest { count = new Count() - test = new TestCount(num_inputs = 4) + test = new TestCount(num_inputs=4) count.out -> test.in } diff --git a/test/C/src/Deadline.lf b/test/C/src/Deadline.lf index 76d5bf564e..913165b8b2 100644 --- a/test/C/src/Deadline.lf +++ b/test/C/src/Deadline.lf @@ -21,9 +21,9 @@ reactor Source(period: time = 3 sec) { reaction(t) -> y {= if (2 * (self->count / 2) != self->count) { - // The count variable is odd. - // Take time to cause a deadline violation. - lf_sleep(MSEC(1500)); + // The count variable is odd. + // Take time to cause a deadline violation. + lf_sleep(MSEC(1500)); } printf("Source sends: %d.\n", self->count); lf_set(y, self->count); @@ -38,17 +38,17 @@ reactor Destination(timeout: time = 1 sec) { reaction(x) {= printf("Destination receives: %d\n", x->value); if (2 * (self->count / 2) != self->count) { - // The count variable is odd, so the deadline should have been violated. - printf("ERROR: Failed to detect deadline.\n"); - exit(1); + // The count variable is odd, so the deadline should have been violated. + printf("ERROR: Failed to detect deadline.\n"); + exit(1); } (self->count)++; =} deadline(timeout) {= printf("Destination deadline handler receives: %d\n", x->value); if (2 * (self->count / 2) == self->count) { - // The count variable is even, so the deadline should not have been violated. - printf("ERROR: Deadline miss handler invoked without deadline violation.\n"); - exit(2); + // The count variable is even, so the deadline should not have been violated. + printf("ERROR: Deadline miss handler invoked without deadline violation.\n"); + exit(2); } (self->count)++; =} diff --git a/test/C/src/DeadlineAnytime.lf b/test/C/src/DeadlineAnytime.lf index bc5ac67188..5ba39e36e0 100644 --- a/test/C/src/DeadlineAnytime.lf +++ b/test/C/src/DeadlineAnytime.lf @@ -14,9 +14,9 @@ reactor A { reaction(shutdown) {= if (self->i == 42) { - printf("SUCCESS\n"); + printf("SUCCESS\n"); } else { - lf_print_error_and_exit("Expected 42, but got %d", self->i); + lf_print_error_and_exit("Expected 42, but got %d", self->i); } =} } diff --git a/test/C/src/DeadlineHandledAbove.lf b/test/C/src/DeadlineHandledAbove.lf index df20467cad..5d5e35c619 100644 --- a/test/C/src/DeadlineHandledAbove.lf +++ b/test/C/src/DeadlineHandledAbove.lf @@ -36,17 +36,17 @@ main reactor DeadlineHandledAbove { reaction(d.deadline_violation) {= if (d.deadline_violation->value) { - printf("Output successfully produced by deadline miss handler.\n"); - self->violation_detected = true; + printf("Output successfully produced by deadline miss handler.\n"); + self->violation_detected = true; } =} reaction(shutdown) {= if (self->violation_detected) { - printf("SUCCESS. Test passes.\n"); + printf("SUCCESS. Test passes.\n"); } else { - printf("FAILURE. Container did not react to deadline violation.\n"); - exit(2); + printf("FAILURE. Container did not react to deadline violation.\n"); + exit(2); } =} } diff --git a/test/C/src/DeadlineInherited.lf b/test/C/src/DeadlineInherited.lf index de718e34a0..5c99bd56a6 100644 --- a/test/C/src/DeadlineInherited.lf +++ b/test/C/src/DeadlineInherited.lf @@ -20,7 +20,7 @@ reactor WithDeadline { reaction(t) {= if (global_cnt != 0) { - lf_print_error_and_exit("Deadline reaction was not executed first. cnt=%i", global_cnt); + lf_print_error_and_exit("Deadline reaction was not executed first. cnt=%i", global_cnt); } global_cnt--; =} deadline(100 sec) {= =} diff --git a/test/C/src/DeadlinePriority.lf b/test/C/src/DeadlinePriority.lf index 21a810e786..58761975ac 100644 --- a/test/C/src/DeadlinePriority.lf +++ b/test/C/src/DeadlinePriority.lf @@ -18,7 +18,7 @@ reactor WithDeadline { reaction(t) {= if (global_cnt != 0) { - lf_print_error_and_exit("Deadline reaction was not executed first. cnt=%i", global_cnt); + lf_print_error_and_exit("Deadline reaction was not executed first. cnt=%i", global_cnt); } global_cnt--; =} deadline(100 sec) {= =} diff --git a/test/C/src/DeadlineWithAfterDelay.lf b/test/C/src/DeadlineWithAfterDelay.lf index af4d1cc8c8..9478d8e00f 100644 --- a/test/C/src/DeadlineWithAfterDelay.lf +++ b/test/C/src/DeadlineWithAfterDelay.lf @@ -24,7 +24,7 @@ reactor SinkWithDeadline { reaction(in) {= global_cnt--; if (global_cnt != 0) { - lf_print_error_and_exit("Deadline reaction was not executed first. cnt=%i", global_cnt); + lf_print_error_and_exit("Deadline reaction was not executed first. cnt=%i", global_cnt); } =} deadline(100 sec) {= =} } diff --git a/test/C/src/DeadlineWithBanks.lf b/test/C/src/DeadlineWithBanks.lf index 2e1fd9bcca..471d22682e 100644 --- a/test/C/src/DeadlineWithBanks.lf +++ b/test/C/src/DeadlineWithBanks.lf @@ -19,30 +19,30 @@ reactor Bank(bank_index: int = 0) { reaction(t) -> out {= int exp_cnt; switch(self->bank_index) { - case 0: { - exp_cnt = 3; - break; - } - case 1: { - exp_cnt = 1; - break; - } - case 2: { - exp_cnt = 0; - break; - } - case 3: { - exp_cnt = 2; - break; - } + case 0: { + exp_cnt = 3; + break; + } + case 1: { + exp_cnt = 1; + break; + } + case 2: { + exp_cnt = 0; + break; + } + case 3: { + exp_cnt = 2; + break; + } } if (global_cnt != exp_cnt) { - lf_print_error_and_exit("global_cnt=%i expected=%i\n", global_cnt, exp_cnt); + lf_print_error_and_exit("global_cnt=%i expected=%i\n", global_cnt, exp_cnt); } global_cnt++; if (self->bank_index==0) { - global_cnt=0; + global_cnt=0; } =} } diff --git a/test/C/src/DelayArray.lf b/test/C/src/DelayArray.lf index f818446991..6f4bd6a754 100644 --- a/test/C/src/DelayArray.lf +++ b/test/C/src/DelayArray.lf @@ -23,7 +23,7 @@ reactor Source { // https://www.lf-lang.org/docs/handbook/target-language-details?target=c#dynamically-allocated-data int* array = (int*)malloc(3 * sizeof(int)); for (size_t i = 0; i < 3; i++) { - array[i] = i; + array[i] = i; } lf_set(out, array); =} @@ -34,22 +34,22 @@ reactor Print(scale: int = 1) { input in: int[] reaction(in) {= - int count = 0; // For testing. + int count = 0; // For testing. bool failed = false; // For testing. printf("Received: ["); for (int i = 0; i < 3; i++) { - if (i > 0) printf(", "); - printf("%d", in->value[i]); - // For testing, check whether values match expectation. - if (in->value[i] != self->scale * count) { - failed = true; - } - count++; // For testing. + if (i > 0) printf(", "); + printf("%d", in->value[i]); + // For testing, check whether values match expectation. + if (in->value[i] != self->scale * count) { + failed = true; + } + count++; // For testing. } printf("]\n"); if (failed) { - printf("ERROR: Value received by Print does not match expectation!\n"); - exit(1); + printf("ERROR: Value received by Print does not match expectation!\n"); + exit(1); } =} } diff --git a/test/C/src/DelayArrayWithAfter.lf b/test/C/src/DelayArrayWithAfter.lf index 3c3866b00c..58df312758 100644 --- a/test/C/src/DelayArrayWithAfter.lf +++ b/test/C/src/DelayArrayWithAfter.lf @@ -30,35 +30,35 @@ reactor Print(scale: int = 1) { reaction(in) {= self->inputs_received++; - int count = 1; // For testing. + int count = 1; // For testing. bool failed = false; // For testing. printf("At time %lld, received array at address %p\n", lf_time_logical_elapsed(), in->value); printf("Received: ["); for (int i = 0; i < in->length; i++) { - if (i > 0) printf(", "); - printf("%d", in->value[i]); - // For testing, check whether values match expectation. - if (in->value[i] != self->scale * count * self->iteration) { - failed = true; - } - count++; // For testing. + if (i > 0) printf(", "); + printf("%d", in->value[i]); + // For testing, check whether values match expectation. + if (in->value[i] != self->scale * count * self->iteration) { + failed = true; + } + count++; // For testing. } printf("]\n"); if (failed) { - printf("ERROR: Value received by Print does not match expectation!\n"); - exit(1); + printf("ERROR: Value received by Print does not match expectation!\n"); + exit(1); } if (count != 4) { - printf("ERROR: Received array length is not 3!\n"); - exit(2); + printf("ERROR: Received array length is not 3!\n"); + exit(2); } self->iteration++; =} reaction(shutdown) {= if (self->inputs_received == 0) { - printf("ERROR: Print reactor received no inputs.\n"); - exit(3); + printf("ERROR: Print reactor received no inputs.\n"); + exit(3); } =} } diff --git a/test/C/src/DelayInt.lf b/test/C/src/DelayInt.lf index a8fce5fe4e..58e74b2b8a 100644 --- a/test/C/src/DelayInt.lf +++ b/test/C/src/DelayInt.lf @@ -32,20 +32,20 @@ reactor Test { interval_t elapsed = current_time - self->start_time; printf("After %lld nsec of logical time.\n", elapsed); if (elapsed != 100000000LL) { - printf("ERROR: Expected elapsed time to be 100000000. It was %lld.\n", elapsed); - exit(1); + printf("ERROR: Expected elapsed time to be 100000000. It was %lld.\n", elapsed); + exit(1); } if (in->value != 42) { - printf("ERROR: Expected input value to be 42. It was %d.\n", in->value); - exit(2); + printf("ERROR: Expected input value to be 42. It was %d.\n", in->value); + exit(2); } =} reaction(shutdown) {= printf("Checking that communication occurred.\n"); if (!self->received_value) { - printf("ERROR: No communication occurred!\n"); - exit(3); + printf("ERROR: No communication occurred!\n"); + exit(3); } =} } diff --git a/test/C/src/DelayPointer.lf b/test/C/src/DelayPointer.lf index d0dba9d68e..57dd2269d5 100644 --- a/test/C/src/DelayPointer.lf +++ b/test/C/src/DelayPointer.lf @@ -46,20 +46,20 @@ reactor Test { interval_t elapsed = current_time - self->start_time; printf("After %lld nsec of logical time.\n", elapsed); if (elapsed != 100000000LL) { - printf("ERROR: Expected elapsed time to be 100000000. It was %lld.\n", elapsed); - exit(1); + printf("ERROR: Expected elapsed time to be 100000000. It was %lld.\n", elapsed); + exit(1); } if (*(in->value) != 42) { - printf("ERROR: Expected input value to be 42. It was %d.\n", *(in->value)); - exit(2); + printf("ERROR: Expected input value to be 42. It was %d.\n", *(in->value)); + exit(2); } =} reaction(shutdown) {= printf("Checking that communication occurred.\n"); if (!self->received_value) { - printf("ERROR: No communication occurred!\n"); - exit(3); + printf("ERROR: No communication occurred!\n"); + exit(3); } =} } diff --git a/test/C/src/DelayString.lf b/test/C/src/DelayString.lf index 9eb5417375..f49cd270de 100644 --- a/test/C/src/DelayString.lf +++ b/test/C/src/DelayString.lf @@ -33,12 +33,12 @@ reactor Test { interval_t elapsed = lf_time_logical_elapsed(); printf("After %lld nsec of logical time.\n", elapsed); if (elapsed != 100000000LL) { - printf("ERROR: Expected elapsed time to be 100000000. It was %lld.\n", elapsed); - exit(1); + printf("ERROR: Expected elapsed time to be 100000000. It was %lld.\n", elapsed); + exit(1); } if (strcmp(in->value, "Hello") != 0) { - printf("ERROR: Expected input value to be \"Hello\". It was \"%s\".\n", in->value); - exit(2); + printf("ERROR: Expected input value to be \"Hello\". It was \"%s\".\n", in->value); + exit(2); } =} } diff --git a/test/C/src/DelayStruct.lf b/test/C/src/DelayStruct.lf index 3d8ca9c665..11d215947b 100644 --- a/test/C/src/DelayStruct.lf +++ b/test/C/src/DelayStruct.lf @@ -46,8 +46,8 @@ reactor Print(expected: int = 42) { reaction(in) {= printf("Received: name = %s, value = %d\n", in->value->name, in->value->value); if (in->value->value != self->expected) { - printf("ERROR: Expected value to be %d.\n", self->expected); - exit(1); + printf("ERROR: Expected value to be %d.\n", self->expected); + exit(1); } =} } diff --git a/test/C/src/DelayStructWithAfter.lf b/test/C/src/DelayStructWithAfter.lf index 0207ba3ea2..a8b5b773c9 100644 --- a/test/C/src/DelayStructWithAfter.lf +++ b/test/C/src/DelayStructWithAfter.lf @@ -27,8 +27,8 @@ reactor Print(expected: int = 42) { reaction(in) {= printf("Received: name = %s, value = %d\n", in->value->name, in->value->value); if (in->value->value != self->expected) { - printf("ERROR: Expected value to be %d.\n", self->expected); - exit(1); + printf("ERROR: Expected value to be %d.\n", self->expected); + exit(1); } =} } diff --git a/test/C/src/DelayStructWithAfterOverlapped.lf b/test/C/src/DelayStructWithAfterOverlapped.lf index b098e9ecf1..e6a40f88fc 100644 --- a/test/C/src/DelayStructWithAfterOverlapped.lf +++ b/test/C/src/DelayStructWithAfterOverlapped.lf @@ -34,15 +34,15 @@ reactor Print { self->s++; printf("Received: name = %s, value = %d\n", in->value->name, in->value->value); if (in->value->value != 42 * self->s) { - printf("ERROR: Expected value to be %d.\n", 42 * self->s); - exit(1); + printf("ERROR: Expected value to be %d.\n", 42 * self->s); + exit(1); } =} reaction(shutdown) {= if (self->s == 0) { - printf("ERROR: Print received no data.\n"); - exit(2); + printf("ERROR: Print received no data.\n"); + exit(2); } =} } diff --git a/test/C/src/DelayedAction.lf b/test/C/src/DelayedAction.lf index ff7ce075f4..529f92badf 100644 --- a/test/C/src/DelayedAction.lf +++ b/test/C/src/DelayedAction.lf @@ -18,8 +18,8 @@ main reactor DelayedAction { interval_t expected = self->count * 1000000000LL + 100000000LL; self->count++; if (elapsed != expected) { - printf("Expected %lld but got %lld.\n", expected, elapsed); - exit(1); + printf("Expected %lld but got %lld.\n", expected, elapsed); + exit(1); } =} } diff --git a/test/C/src/DelayedReaction.lf b/test/C/src/DelayedReaction.lf index dbdec1a2e8..41cb9f3052 100644 --- a/test/C/src/DelayedReaction.lf +++ b/test/C/src/DelayedReaction.lf @@ -15,8 +15,8 @@ reactor Sink { interval_t elapsed = lf_time_logical_elapsed(); printf("Nanoseconds since start: %lld.\n", elapsed); if (elapsed != 100000000LL) { - printf("ERROR: Expected 100000000 but.\n"); - exit(1); + printf("ERROR: Expected 100000000 but.\n"); + exit(1); } =} } diff --git a/test/C/src/Determinism.lf b/test/C/src/Determinism.lf index a063b108f0..6ccc7dde34 100644 --- a/test/C/src/Determinism.lf +++ b/test/C/src/Determinism.lf @@ -14,15 +14,15 @@ reactor Destination { reaction(x, y) {= int sum = 0; if (x->is_present) { - sum += x->value; + sum += x->value; } if (y->is_present) { - sum += y->value; + sum += y->value; } printf("Received %d.\n", sum); if (sum != 2) { - printf("FAILURE: Expected 2.\n"); - exit(4); + printf("FAILURE: Expected 2.\n"); + exit(4); } =} } diff --git a/test/C/src/DoubleInvocation.lf b/test/C/src/DoubleInvocation.lf index 98c0d51e20..ccebca4336 100644 --- a/test/C/src/DoubleInvocation.lf +++ b/test/C/src/DoubleInvocation.lf @@ -33,11 +33,11 @@ reactor Print { reaction(position, velocity) {= if (position->is_present) { - printf("Position: %d.\n", position->value); + printf("Position: %d.\n", position->value); } if (position->value == self->previous) { - printf("ERROR: Multiple firings at the same logical time!\n"); - exit(1); + printf("ERROR: Multiple firings at the same logical time!\n"); + exit(1); } =} } diff --git a/test/C/src/DoublePort.lf b/test/C/src/DoublePort.lf index 545c7fba1f..046a4f951f 100644 --- a/test/C/src/DoublePort.lf +++ b/test/C/src/DoublePort.lf @@ -30,8 +30,8 @@ reactor Print { interval_t elapsed_time = lf_time_logical_elapsed(); printf("At tag (%lld, %u), received in = %d and in2 = %d.\n", elapsed_time, lf_tag().microstep, in->value, in2->value); if (in->is_present && in2->is_present) { - fprintf(stderr, "ERROR: invalid logical simultaneity.\n"); - exit(1); + fprintf(stderr, "ERROR: invalid logical simultaneity.\n"); + exit(1); } =} diff --git a/test/C/src/DoubleReaction.lf b/test/C/src/DoubleReaction.lf index 4dd17db7c4..b3cb5b51dd 100644 --- a/test/C/src/DoubleReaction.lf +++ b/test/C/src/DoubleReaction.lf @@ -24,15 +24,15 @@ reactor Destination { reaction(x, w) {= int sum = 0; if (x->is_present) { - sum += x->value; + sum += x->value; } if (w->is_present) { - sum += w->value; + sum += w->value; } printf("Sum of inputs is: %d\n", sum); if (sum != self->s) { - printf("FAILURE: Expected sum to be %d, but it was %d.\n", self->s, sum); - exit(1); + printf("FAILURE: Expected sum to be %d, but it was %d.\n", self->s, sum); + exit(1); } self->s += 2; =} diff --git a/test/C/src/DoubleTrigger.lf b/test/C/src/DoubleTrigger.lf index c36eaa0362..755f58abe8 100644 --- a/test/C/src/DoubleTrigger.lf +++ b/test/C/src/DoubleTrigger.lf @@ -12,17 +12,17 @@ main reactor DoubleTrigger { reaction(t1, t2) {= self->s++; if (self->s > 1) { - printf("FAILURE: Reaction got triggered twice.\n"); - exit(1); + printf("FAILURE: Reaction got triggered twice.\n"); + exit(1); } =} reaction(shutdown) {= if (self->s == 1) { - printf("SUCCESS.\n"); + printf("SUCCESS.\n"); } else { - printf("FAILURE: Reaction was never triggered.\n"); - exit(1); + printf("FAILURE: Reaction was never triggered.\n"); + exit(1); } =} } diff --git a/test/C/src/FilePkgReader.lf b/test/C/src/FilePkgReader.lf index 7fdd2d62d2..d8bf41d9d6 100644 --- a/test/C/src/FilePkgReader.lf +++ b/test/C/src/FilePkgReader.lf @@ -6,10 +6,10 @@ reactor Source { reaction(startup) -> out {= char* file_path = - LF_PACKAGE_DIRECTORY - LF_FILE_SEPARATOR "src" - LF_FILE_SEPARATOR "lib" - LF_FILE_SEPARATOR "FileReader.txt"; + LF_PACKAGE_DIRECTORY + LF_FILE_SEPARATOR "src" + LF_FILE_SEPARATOR "lib" + LF_FILE_SEPARATOR "FileReader.txt"; FILE* file = fopen(file_path, "rb"); if (file == NULL) lf_print_error_and_exit("Error opening file at path %s.", file_path); @@ -41,7 +41,7 @@ main reactor { reaction(s.out) {= printf("Received: %s\n", s.out->value); if (strcmp("Hello World", s.out->value) != 0) { - lf_print_error_and_exit("Expected 'Hello World'"); + lf_print_error_and_exit("Expected 'Hello World'"); } =} } diff --git a/test/C/src/FileReader.lf b/test/C/src/FileReader.lf index 4bd093eedf..e802baf115 100644 --- a/test/C/src/FileReader.lf +++ b/test/C/src/FileReader.lf @@ -6,9 +6,9 @@ reactor Source { reaction(startup) -> out {= char* file_path = - LF_SOURCE_DIRECTORY - LF_FILE_SEPARATOR "lib" - LF_FILE_SEPARATOR "FileReader.txt"; + LF_SOURCE_DIRECTORY + LF_FILE_SEPARATOR "lib" + LF_FILE_SEPARATOR "FileReader.txt"; FILE* file = fopen(file_path, "rb"); if (file == NULL) lf_print_error_and_exit("Error opening file at path %s.", file_path); @@ -40,7 +40,7 @@ main reactor { reaction(s.out) {= printf("Received: %s\n", s.out->value); if (strcmp("Hello World", s.out->value) != 0) { - lf_print_error_and_exit("Expected 'Hello World'"); + lf_print_error_and_exit("Expected 'Hello World'"); } =} } diff --git a/test/C/src/FloatLiteral.lf b/test/C/src/FloatLiteral.lf index 0179275083..52fca6be40 100644 --- a/test/C/src/FloatLiteral.lf +++ b/test/C/src/FloatLiteral.lf @@ -14,12 +14,12 @@ main reactor { reaction(startup) {= double F = - self->N * self->charge; if (fabs(F - self->expected) < fabs(self->minus_epsilon)) { - lf_print("The Faraday constant is roughly %f.", F); + lf_print("The Faraday constant is roughly %f.", F); } else { - lf_print_error_and_exit( - "ERROR: Expected %f but computed %f.", - self->expected, F - ); + lf_print_error_and_exit( + "ERROR: Expected %f but computed %f.", + self->expected, F + ); } =} } diff --git a/test/C/src/Gain.lf b/test/C/src/Gain.lf index 5df74e2e01..bc096cf77c 100644 --- a/test/C/src/Gain.lf +++ b/test/C/src/Gain.lf @@ -16,16 +16,16 @@ reactor Test { printf("Received %d.\n", x->value); self->received_value = true; if (x->value != 2) { - printf("ERROR: Expected 2!\n"); - exit(1); + printf("ERROR: Expected 2!\n"); + exit(1); } =} reaction(shutdown) {= if (!self->received_value) { - printf("ERROR: No value received by Test reactor!\n"); + printf("ERROR: No value received by Test reactor!\n"); } else { - printf("Test passes.\n"); + printf("Test passes.\n"); } =} } diff --git a/test/C/src/GetMicroStep.lf b/test/C/src/GetMicroStep.lf index 65a60f7174..4f0fda5e9f 100644 --- a/test/C/src/GetMicroStep.lf +++ b/test/C/src/GetMicroStep.lf @@ -11,11 +11,11 @@ main reactor GetMicroStep { reaction(l) -> l {= microstep_t microstep = lf_tag().microstep; if (microstep != self->s) { - lf_print_error_and_exit("expected microstep %d, got %d instead.", self->s, microstep); + lf_print_error_and_exit("expected microstep %d, got %d instead.", self->s, microstep); } self->s += 1; if (self->s < 10) { - lf_schedule(l, 0); + lf_schedule(l, 0); } =} } diff --git a/test/C/src/Hello.lf b/test/C/src/Hello.lf index 32f822e711..b63622c146 100644 --- a/test/C/src/Hello.lf +++ b/test/C/src/Hello.lf @@ -32,21 +32,21 @@ reactor Reschedule(period: time = 2 sec, message: string = "Hello C") { printf("***** action %d at time %lld\n", self->count, lf_time_logical()); // Check the a_has_value variable. if (a->has_value) { - printf("FAILURE: Expected a_has_value to be false, but it was true.\n"); - exit(2); + printf("FAILURE: Expected a_has_value to be false, but it was true.\n"); + exit(2); } long long time = lf_time_logical(); if (time - self->previous_time != 200000000ll) { - printf("FAILURE: Expected 200ms of logical time to elapse but got %lld nanoseconds.\n", - time - self->previous_time - ); - exit(1); + printf("FAILURE: Expected 200ms of logical time to elapse but got %lld nanoseconds.\n", + time - self->previous_time + ); + exit(1); } =} } reactor Inside(period: time = 1 sec, message: string = "Composite default message.") { - third_instance = new Reschedule(period = period, message = message) + third_instance = new Reschedule(period=period, message=message) } main reactor Hello { diff --git a/test/C/src/HelloWorld.lf b/test/C/src/HelloWorld.lf index 470ebabb6b..d005153f9f 100644 --- a/test/C/src/HelloWorld.lf +++ b/test/C/src/HelloWorld.lf @@ -18,8 +18,8 @@ reactor HelloWorld2 { reaction(shutdown) {= printf("Shutdown invoked.\n"); if (!self->success) { - fprintf(stderr, "ERROR: startup reaction not executed.\n"); - exit(1); + fprintf(stderr, "ERROR: startup reaction not executed.\n"); + exit(1); } =} } diff --git a/test/C/src/Hierarchy.lf b/test/C/src/Hierarchy.lf index 71aa7f9269..47efcf6b65 100644 --- a/test/C/src/Hierarchy.lf +++ b/test/C/src/Hierarchy.lf @@ -24,8 +24,8 @@ reactor Print { reaction(in) {= printf("Received: %d.\n", in->value); if (in->value != 2) { - printf("Expected 2.\n"); - exit(1); + printf("Expected 2.\n"); + exit(1); } =} } diff --git a/test/C/src/Hierarchy2.lf b/test/C/src/Hierarchy2.lf index daa7b832f8..7e361dc580 100644 --- a/test/C/src/Hierarchy2.lf +++ b/test/C/src/Hierarchy2.lf @@ -42,8 +42,8 @@ reactor Print { reaction(in) {= printf("Received: %d.\n", in->value); if (in->value != self->expected) { - printf("Expected %d.\n", self->expected); - exit(1); + printf("Expected %d.\n", self->expected); + exit(1); } self->expected++; =} diff --git a/test/C/src/IdentifierLength.lf b/test/C/src/IdentifierLength.lf index 6e4b34e976..79b2e3aaca 100644 --- a/test/C/src/IdentifierLength.lf +++ b/test/C/src/IdentifierLength.lf @@ -23,8 +23,8 @@ reactor Another_Really_Long_Name_For_A_Test_Class { (self->count)++; printf("Received %d\n", x->value); if (x->value != self->count) { - printf("FAILURE: Expected %d\n", self->count); - exit(1); + printf("FAILURE: Expected %d\n", self->count); + exit(1); } =} } diff --git a/test/C/src/ImportComposition.lf b/test/C/src/ImportComposition.lf index c80bf87eab..41e493f8d9 100644 --- a/test/C/src/ImportComposition.lf +++ b/test/C/src/ImportComposition.lf @@ -14,19 +14,19 @@ main reactor ImportComposition { printf("Received %d at time %lld\n", a.y->value, receive_time); self->received = true; if (receive_time != 55000000LL) { - fprintf(stderr, "ERROR: Received time should have been 55,000,000.\n"); - exit(1); + fprintf(stderr, "ERROR: Received time should have been 55,000,000.\n"); + exit(1); } if (a.y->value != 42 * 2 * 2) { - fprintf(stderr, "ERROR: Received value should have been %d.\n", 42 * 2 * 2); - exit(2); + fprintf(stderr, "ERROR: Received value should have been %d.\n", 42 * 2 * 2); + exit(2); } =} reaction(shutdown) {= if (!self->received) { - fprintf(stderr, "ERROR: Nothing received.\n"); - exit(3); + fprintf(stderr, "ERROR: Nothing received.\n"); + exit(3); } =} } diff --git a/test/C/src/InheritanceAction.lf b/test/C/src/InheritanceAction.lf index f6a87ef360..e2b5857ff7 100644 --- a/test/C/src/InheritanceAction.lf +++ b/test/C/src/InheritanceAction.lf @@ -22,14 +22,14 @@ reactor Test { (self->count)++; printf("Received %d\n", x->value); if (x->value != 42) { - fprintf(stderr, "FAILURE: Expected 42\n"); - exit(1); + fprintf(stderr, "FAILURE: Expected 42\n"); + exit(1); } =} reaction(shutdown) {= if (self->count == 0) { - fprintf(stderr, "FAILURE: No data received.\n"); + fprintf(stderr, "FAILURE: No data received.\n"); } =} } diff --git a/test/C/src/ManualDelayedReaction.lf b/test/C/src/ManualDelayedReaction.lf index 3432f15ec2..24f5cc3d23 100644 --- a/test/C/src/ManualDelayedReaction.lf +++ b/test/C/src/ManualDelayedReaction.lf @@ -37,8 +37,8 @@ reactor Sink { interval_t physical = lf_time_physical(); printf("Nanoseconds since start: %lld %lld %lld.\n", logical, physical, elapsed_logical); if (elapsed_logical < MSEC(100)) { - printf("Expected %lld but got %lld.\n", MSEC(100), elapsed_logical); - exit(1); + printf("Expected %lld but got %lld.\n", MSEC(100), elapsed_logical); + exit(1); } =} deadline(200 msec) {= =} } diff --git a/test/C/src/Methods.lf b/test/C/src/Methods.lf index 45bb9fa4ba..2d69d5c77d 100644 --- a/test/C/src/Methods.lf +++ b/test/C/src/Methods.lf @@ -10,14 +10,14 @@ main reactor { reaction(startup) {= lf_print("Foo is initialized to %d", getFoo()); if (getFoo() != 2) { - lf_print_error_and_exit("Expected 2!"); + lf_print_error_and_exit("Expected 2!"); } add(40); int a = getFoo(); lf_print("2 + 40 = %d", a); if (a != 42) { - lf_print_error_and_exit("Expected 42!"); + lf_print_error_and_exit("Expected 42!"); } =} } diff --git a/test/C/src/MethodsRecursive.lf b/test/C/src/MethodsRecursive.lf index 8ba8a5627b..4e04a0a901 100644 --- a/test/C/src/MethodsRecursive.lf +++ b/test/C/src/MethodsRecursive.lf @@ -14,7 +14,7 @@ main reactor { reaction(startup) {= for (int n = 1; n < 10; n++) { - lf_print("%d-th Fibonacci number is %d", n, fib(n)); + lf_print("%d-th Fibonacci number is %d", n, fib(n)); } =} } diff --git a/test/C/src/MethodsSameName.lf b/test/C/src/MethodsSameName.lf index 349f62fc55..db07a5cd75 100644 --- a/test/C/src/MethodsSameName.lf +++ b/test/C/src/MethodsSameName.lf @@ -10,7 +10,7 @@ reactor Foo { add(40); lf_print("Foo: 2 + 40 = %d", self->foo); if (self->foo != 42) { - lf_print_error_and_exit("Expected 42!"); + lf_print_error_and_exit("Expected 42!"); } =} } @@ -26,7 +26,7 @@ main reactor { add(40); lf_print("Main: 2 + 40 = %d", self->foo); if (self->foo != 42) { - lf_print_error_and_exit("Expected 42!"); + lf_print_error_and_exit("Expected 42!"); } =} } diff --git a/test/C/src/Microsteps.lf b/test/C/src/Microsteps.lf index 1e5cca7bf3..6a2915b53f 100644 --- a/test/C/src/Microsteps.lf +++ b/test/C/src/Microsteps.lf @@ -8,21 +8,21 @@ reactor Destination { interval_t elapsed = lf_time_logical_elapsed(); printf("Time since start: %lld.\n", elapsed); if (elapsed != 0LL) { - printf("Expected elapsed time to be 0, but it was %lld.\n", elapsed); - exit(1); + printf("Expected elapsed time to be 0, but it was %lld.\n", elapsed); + exit(1); } int count = 0; if (x->is_present) { - printf(" x is present.\n"); - count++; + printf(" x is present.\n"); + count++; } if (y->is_present) { - printf(" y is present.\n"); - count++; + printf(" y is present.\n"); + count++; } if (count != 1) { - printf("Expected exactly one input to be present but got %d.\n", count); - exit(1); + printf("Expected exactly one input to be present but got %d.\n", count); + exit(1); } =} } diff --git a/test/C/src/MovingAverage.lf b/test/C/src/MovingAverage.lf index 53e761f61b..79a3824b09 100644 --- a/test/C/src/MovingAverage.lf +++ b/test/C/src/MovingAverage.lf @@ -28,7 +28,7 @@ reactor MovingAverageImpl { // Calculate the output. double sum = in->value; for (int i = 0; i < 3; i++) { - sum += self->delay_line[i]; + sum += self->delay_line[i]; } lf_set(out, sum/4.0); @@ -38,7 +38,7 @@ reactor MovingAverageImpl { // Update the index for the next input. self->index++; if (self->index >= 3) { - self->index = 0; + self->index = 0; } =} } diff --git a/test/C/src/MultipleContained.lf b/test/C/src/MultipleContained.lf index 384543e56f..1e98bff1fb 100644 --- a/test/C/src/MultipleContained.lf +++ b/test/C/src/MultipleContained.lf @@ -12,8 +12,8 @@ reactor Contained { reaction(in1) {= printf("in1 received %d.\n", in1->value); if (in1->value != 42) { - fprintf(stderr, "FAILED: Expected 42.\n"); - exit(1); + fprintf(stderr, "FAILED: Expected 42.\n"); + exit(1); } self->count++; =} @@ -21,15 +21,15 @@ reactor Contained { reaction(in2) {= printf("in2 received %d.\n", in2->value); if (in2->value != 42) { - fprintf(stderr, "FAILED: Expected 42.\n"); - exit(1); + fprintf(stderr, "FAILED: Expected 42.\n"); + exit(1); } self->count++; =} reaction(shutdown) {= if (self->count != 2) { - lf_print_error_and_exit("FAILED: Expected two inputs!"); + lf_print_error_and_exit("FAILED: Expected two inputs!"); } =} } diff --git a/test/C/src/MultipleOutputs.lf b/test/C/src/MultipleOutputs.lf index 4682ce8eef..9581875c02 100644 --- a/test/C/src/MultipleOutputs.lf +++ b/test/C/src/MultipleOutputs.lf @@ -28,7 +28,7 @@ main reactor { reaction(shutdown) {= if (!self->triggered) { - lf_print_error_and_exit("Reaction never triggered.\n"); + lf_print_error_and_exit("Reaction never triggered.\n"); } =} } diff --git a/test/C/src/NativeListsAndTimes.lf b/test/C/src/NativeListsAndTimes.lf index cbb1a6d861..1bf5cfdd6f 100644 --- a/test/C/src/NativeListsAndTimes.lf +++ b/test/C/src/NativeListsAndTimes.lf @@ -2,13 +2,13 @@ target C // This test passes if it is successfully compiled into valid target code. main reactor( - x: int = 0, - y: time = 0, // Units are missing but not required - z = 1 msec, // Type is missing but not required - p: int[] = {1, 2, 3, 4}, // List of integers - q: interval_t[] = {1 msec, 2 msec, 3 msec}, // list of time values - g: time[] = {1 msec, 2 msec} // List of time values -) { + x: int = 0, + y: time = 0, // Units are missing but not required + z = 1 msec, // Type is missing but not required + p: int[] = {1, 2, 3, 4}, // List of integers + q: interval_t[] = {1 msec, 2 msec, 3 msec}, // list of time values + // List of time values + g: time[] = {1 msec, 2 msec}) { state s: time = y // Reference to explicitly typed time parameter state t: time = z // Reference to implicitly typed time parameter state v: bool // Uninitialized boolean state variable diff --git a/test/C/src/NestedTriggeredReactions.lf b/test/C/src/NestedTriggeredReactions.lf index 730bc1db08..ca9ce7476c 100644 --- a/test/C/src/NestedTriggeredReactions.lf +++ b/test/C/src/NestedTriggeredReactions.lf @@ -13,7 +13,7 @@ reactor Container { reaction(shutdown) {= if (!self->triggered) { - lf_print_error_and_exit("The Container reaction was not triggered!"); + lf_print_error_and_exit("The Container reaction was not triggered!"); } =} } @@ -27,7 +27,7 @@ reactor Contained { reaction(shutdown) {= if (!self->triggered) { - lf_print_error_and_exit("The Contained reaction was not triggered!"); + lf_print_error_and_exit("The Contained reaction was not triggered!"); } =} } diff --git a/test/C/src/ParameterHierarchy.lf b/test/C/src/ParameterHierarchy.lf index ef71b43eeb..10ebed6476 100644 --- a/test/C/src/ParameterHierarchy.lf +++ b/test/C/src/ParameterHierarchy.lf @@ -4,21 +4,21 @@ target C reactor Deep(p0: int = 0) { reaction(startup) {= if (self->p0 != 42) { - lf_print_error_and_exit("Parameter value is %d. Should have been 42.", self->p0); + lf_print_error_and_exit("Parameter value is %d. Should have been 42.", self->p0); } else { - lf_print("Success."); + lf_print("Success."); } =} } reactor Intermediate(p1: int = 10) { - a0 = new Deep(p0 = p1) + a0 = new Deep(p0=p1) } reactor Another(p2: int = 20) { - a1 = new Intermediate(p1 = p2) + a1 = new Intermediate(p1=p2) } main reactor ParameterHierarchy { - a2 = new Another(p2 = 42) + a2 = new Another(p2=42) } diff --git a/test/C/src/PeriodicDesugared.lf b/test/C/src/PeriodicDesugared.lf index c31b81e534..0a55f496df 100644 --- a/test/C/src/PeriodicDesugared.lf +++ b/test/C/src/PeriodicDesugared.lf @@ -9,10 +9,10 @@ main reactor(offset: time = 0, period: time = 500 msec) { reaction(startup) -> init, recur {= if (self->offset == 0) { - printf("Hello World!\n"); - lf_schedule(recur, 0); + printf("Hello World!\n"); + lf_schedule(recur, 0); } else { - lf_schedule(init, 0); + lf_schedule(init, 0); } =} diff --git a/test/C/src/PhysicalConnection.lf b/test/C/src/PhysicalConnection.lf index 3276b1e11c..af478e0425 100644 --- a/test/C/src/PhysicalConnection.lf +++ b/test/C/src/PhysicalConnection.lf @@ -14,8 +14,8 @@ reactor Destination { interval_t time = lf_time_logical_elapsed(); printf("Received %d at logical time %lld.\n", in->value, time); if (time <= 0LL) { - fprintf(stderr, "ERROR: Logical time should have been greater than zero.\n"); - exit(1); + fprintf(stderr, "ERROR: Logical time should have been greater than zero.\n"); + exit(1); } =} } diff --git a/test/C/src/PingPong.lf b/test/C/src/PingPong.lf index c3e0a69357..c38bd36683 100644 --- a/test/C/src/PingPong.lf +++ b/test/C/src/PingPong.lf @@ -32,9 +32,9 @@ reactor Ping(count: int = 10) { reaction(receive) -> serve {= if (self->pingsLeft > 0) { - lf_schedule(serve, 0); + lf_schedule(serve, 0); } else { - lf_request_stop(); + lf_request_stop(); } =} } @@ -51,10 +51,10 @@ reactor Pong(expected: int = 10) { reaction(shutdown) {= if (self->count != self->expected) { - fprintf(stderr, "ERROR: Pong expected to receive %d inputs, but it received %d.\n", - self->expected, self->count - ); - exit(1); + fprintf(stderr, "ERROR: Pong expected to receive %d inputs, but it received %d.\n", + self->expected, self->count + ); + exit(1); } printf("Success.\n"); =} diff --git a/test/C/src/Preamble.lf b/test/C/src/Preamble.lf index 28fa5a7d5e..431d007edd 100644 --- a/test/C/src/Preamble.lf +++ b/test/C/src/Preamble.lf @@ -7,7 +7,7 @@ main reactor Preamble { preamble {= #include int add_42(int i) { - return i + 42; + return i + 42; } =} timer t diff --git a/test/C/src/ReadOutputOfContainedReactor.lf b/test/C/src/ReadOutputOfContainedReactor.lf index eb8dba11bf..0625d9ccf3 100644 --- a/test/C/src/ReadOutputOfContainedReactor.lf +++ b/test/C/src/ReadOutputOfContainedReactor.lf @@ -14,8 +14,8 @@ main reactor ReadOutputOfContainedReactor { reaction(startup) c.out {= printf("Startup reaction reading output of contained reactor: %d.\n", c.out->value); if (c.out->value != 42) { - fprintf(stderr, "Expected 42!\n"); - exit(2); + fprintf(stderr, "Expected 42!\n"); + exit(2); } self->count++; =} @@ -23,8 +23,8 @@ main reactor ReadOutputOfContainedReactor { reaction(c.out) {= printf("Reading output of contained reactor: %d.\n", c.out->value); if (c.out->value != 42) { - fprintf(stderr, "Expected 42!\n"); - exit(3); + fprintf(stderr, "Expected 42!\n"); + exit(3); } self->count++; =} @@ -32,18 +32,18 @@ main reactor ReadOutputOfContainedReactor { reaction(startup, c.out) {= printf("Alternate triggering reading output of contained reactor: %d.\n", c.out->value); if (c.out->value != 42) { - fprintf(stderr, "Expected 42!\n"); - exit(4); + fprintf(stderr, "Expected 42!\n"); + exit(4); } self->count++; =} reaction(shutdown) {= if (self->count != 3) { - printf("FAILURE: One of the reactions failed to trigger.\n"); - exit(1); + printf("FAILURE: One of the reactions failed to trigger.\n"); + exit(1); } else { - printf("Test passes.\n"); + printf("Test passes.\n"); } =} } diff --git a/test/C/src/RepeatedInheritance.lf b/test/C/src/RepeatedInheritance.lf index 47d4e46e63..7de84864cd 100644 --- a/test/C/src/RepeatedInheritance.lf +++ b/test/C/src/RepeatedInheritance.lf @@ -33,7 +33,7 @@ reactor A extends B, C { main reactor { c = new Count() a = new A() - t = new TestCount(start = 4, stride = 4, num_inputs = 6) + t = new TestCount(start=4, stride=4, num_inputs=6) (c.out)+ -> a.a, a.b, a.c, a.d a.out -> t.in } diff --git a/test/C/src/RequestStop.lf b/test/C/src/RequestStop.lf index 07e6806f72..55dcaec13a 100644 --- a/test/C/src/RequestStop.lf +++ b/test/C/src/RequestStop.lf @@ -5,7 +5,7 @@ main reactor { reaction(shutdown) {= tag_t current_tag = lf_tag(); lf_print("Shutdown invoked at tag (%lld, %d). Calling lf_request_stop(), which should have no effect.", - current_tag.time - lf_time_start(), current_tag.microstep + current_tag.time - lf_time_start(), current_tag.microstep ); lf_request_stop(); =} diff --git a/test/C/src/Schedule.lf b/test/C/src/Schedule.lf index a806170d74..09f9de5bd9 100644 --- a/test/C/src/Schedule.lf +++ b/test/C/src/Schedule.lf @@ -11,8 +11,8 @@ reactor Schedule2 { interval_t elapsed_time = lf_time_logical_elapsed(); printf("Action triggered at logical time %lld nsec after start.\n", elapsed_time); if (elapsed_time != 200000000LL) { - printf("Expected action time to be 200 msec. It was %lld nsec.\n", elapsed_time); - exit(1); + printf("Expected action time to be 200 msec. It was %lld nsec.\n", elapsed_time); + exit(1); } =} } diff --git a/test/C/src/ScheduleLogicalAction.lf b/test/C/src/ScheduleLogicalAction.lf index 4a301977a3..72835f8a96 100644 --- a/test/C/src/ScheduleLogicalAction.lf +++ b/test/C/src/ScheduleLogicalAction.lf @@ -29,8 +29,8 @@ reactor print { printf("Current logical time is: %lld\n", elapsed_time); printf("Current physical time is: %lld\n", lf_time_physical_elapsed()); if (elapsed_time != self->expected_time) { - printf("ERROR: Expected logical time to be %lld.\n", self->expected_time); - exit(1); + printf("ERROR: Expected logical time to be %lld.\n", self->expected_time); + exit(1); } self->expected_time += MSEC(500); =} diff --git a/test/C/src/ScheduleValue.lf b/test/C/src/ScheduleValue.lf index 05532c145f..0f5ef59eed 100644 --- a/test/C/src/ScheduleValue.lf +++ b/test/C/src/ScheduleValue.lf @@ -26,8 +26,8 @@ main reactor ScheduleValue { reaction(a) {= printf("Received: %s\n", a->value); if (strcmp(a->value, "Hello") != 0) { - fprintf(stderr, "FAILURE: Should have received 'Hello'\n"); - exit(1); + fprintf(stderr, "FAILURE: Should have received 'Hello'\n"); + exit(1); } =} } diff --git a/test/C/src/SelfLoop.lf b/test/C/src/SelfLoop.lf index cf200024ce..204a5e856c 100644 --- a/test/C/src/SelfLoop.lf +++ b/test/C/src/SelfLoop.lf @@ -17,8 +17,8 @@ reactor Self { reaction(x) -> a {= printf("x = %d\n", x->value); if (x->value != self->expected) { - fprintf(stderr, "Expected %d.\n", self->expected); - exit(1); + fprintf(stderr, "Expected %d.\n", self->expected); + exit(1); } self->expected++; lf_schedule_int(a, MSEC(100), x->value); @@ -28,8 +28,8 @@ reactor Self { reaction(shutdown) {= if (self->expected <= 43) { - fprintf(stderr, "Received no data.\n"); - exit(2); + fprintf(stderr, "Received no data.\n"); + exit(2); } =} } diff --git a/test/C/src/SendingInside.lf b/test/C/src/SendingInside.lf index 5371e8892a..5b06489ad7 100644 --- a/test/C/src/SendingInside.lf +++ b/test/C/src/SendingInside.lf @@ -12,8 +12,8 @@ reactor Printer { reaction(x) {= printf("Inside reactor received: %d\n", x->value); if (x->value != self->count) { - printf("FAILURE: Expected %d.\n", self->count); - exit(1); + printf("FAILURE: Expected %d.\n", self->count); + exit(1); } self->count++; =} diff --git a/test/C/src/SendingInside2.lf b/test/C/src/SendingInside2.lf index e1b684ff74..ab15278044 100644 --- a/test/C/src/SendingInside2.lf +++ b/test/C/src/SendingInside2.lf @@ -6,8 +6,8 @@ reactor Printer { reaction(x) {= printf("Inside reactor received: %d\n", x->value); if (x->value != 1) { - fprintf(stderr, "ERROR: Expected 1.\n"); - exit(1); + fprintf(stderr, "ERROR: Expected 1.\n"); + exit(1); } =} } diff --git a/test/C/src/SendsPointerTest.lf b/test/C/src/SendsPointerTest.lf index 639798709f..f05bec4934 100644 --- a/test/C/src/SendsPointerTest.lf +++ b/test/C/src/SendsPointerTest.lf @@ -20,8 +20,8 @@ reactor Print(expected: int = 42) { reaction(in) {= printf("Received: %d\n", *in->value); if (*in->value != self->expected) { - printf("ERROR: Expected value to be %d.\n", self->expected); - exit(1); + printf("ERROR: Expected value to be %d.\n", self->expected); + exit(1); } =} } diff --git a/test/C/src/SetArray.lf b/test/C/src/SetArray.lf index 8926144e62..f1f96c9e12 100644 --- a/test/C/src/SetArray.lf +++ b/test/C/src/SetArray.lf @@ -22,22 +22,22 @@ reactor Print(scale: int = 1) { input in: int[] reaction(in) {= - int count = 0; // For testing. + int count = 0; // For testing. bool failed = false; // For testing. printf("Received: ["); for (int i = 0; i < in->length; i++) { - if (i > 0) printf(", "); - printf("%d", in->value[i]); - // For testing, check whether values match expectation. - if (in->value[i] != self->scale * count) { - failed = true; - } - count++; // For testing. + if (i > 0) printf(", "); + printf("%d", in->value[i]); + // For testing, check whether values match expectation. + if (in->value[i] != self->scale * count) { + failed = true; + } + count++; // For testing. } printf("]\n"); if (failed) { - printf("ERROR: Value received by Print does not match expectation!\n"); - exit(1); + printf("ERROR: Value received by Print does not match expectation!\n"); + exit(1); } =} } diff --git a/test/C/src/SetToken.lf b/test/C/src/SetToken.lf index ff5e63066b..6b589c6e57 100644 --- a/test/C/src/SetToken.lf +++ b/test/C/src/SetToken.lf @@ -17,8 +17,8 @@ reactor Print(expected: int = 42) { reaction(in) {= printf("Received %d\n", *(in->value)); if (*(in->value) != 42) { - printf("ERROR: Expected value to be 42.\n"); - exit(1); + printf("ERROR: Expected value to be 42.\n"); + exit(1); } =} } diff --git a/test/C/src/SimpleDeadline.lf b/test/C/src/SimpleDeadline.lf index 6ae30cfb45..8382b281fa 100644 --- a/test/C/src/SimpleDeadline.lf +++ b/test/C/src/SimpleDeadline.lf @@ -30,7 +30,7 @@ reactor Print { reaction(in) {= if (in) { - printf("Output successfully produced by deadline handler.\n"); + printf("Output successfully produced by deadline handler.\n"); } =} } diff --git a/test/C/src/SlowingClock.lf b/test/C/src/SlowingClock.lf index c7ba2266fc..36cb07c553 100644 --- a/test/C/src/SlowingClock.lf +++ b/test/C/src/SlowingClock.lf @@ -18,13 +18,13 @@ main reactor SlowingClock { reaction(a) -> a {= instant_t elapsed_logical_time = lf_time_logical_elapsed(); printf("Logical time since start: \%lld nsec.\n", - elapsed_logical_time + elapsed_logical_time ); if (elapsed_logical_time != self->expected_time) { - printf("ERROR: Expected time to be: \%lld nsec.\n", - self->expected_time - ); - exit(1); + printf("ERROR: Expected time to be: \%lld nsec.\n", + self->expected_time + ); + exit(1); } lf_schedule(a, self->interval); self->expected_time += MSEC(100) + self->interval; @@ -33,11 +33,11 @@ main reactor SlowingClock { reaction(shutdown) {= if (self->expected_time != MSEC(1500)) { - printf("ERROR: Expected the next expected time to be: 1500000000 nsec.\n"); - printf("It was: \%lld nsec.\n", self->expected_time); - exit(2); + printf("ERROR: Expected the next expected time to be: 1500000000 nsec.\n"); + printf("It was: \%lld nsec.\n", self->expected_time); + exit(2); } else { - printf("Test passes.\n"); + printf("Test passes.\n"); } =} } diff --git a/test/C/src/SlowingClockPhysical.lf b/test/C/src/SlowingClockPhysical.lf index 9ec8d48ef9..9a2b6b4a49 100644 --- a/test/C/src/SlowingClockPhysical.lf +++ b/test/C/src/SlowingClockPhysical.lf @@ -21,13 +21,13 @@ main reactor SlowingClockPhysical { reaction(a) -> a {= instant_t elapsed_logical_time = lf_time_logical_elapsed(); printf("Logical time since start: \%lld nsec.\n", - elapsed_logical_time + elapsed_logical_time ); if (elapsed_logical_time < self->expected_time) { - printf("ERROR: Expected logical time to be at least: \%lld nsec.\n", - self->expected_time - ); - exit(1); + printf("ERROR: Expected logical time to be at least: \%lld nsec.\n", + self->expected_time + ); + exit(1); } self->interval += MSEC(100); self->expected_time = MSEC(100) + self->interval; @@ -37,9 +37,9 @@ main reactor SlowingClockPhysical { reaction(shutdown) {= if (self->expected_time < MSEC(500)) { - printf("ERROR: Expected the next expected time to be at least: 500000000 nsec.\n"); - printf("It was: \%lld nsec.\n", self->expected_time); - exit(2); + printf("ERROR: Expected the next expected time to be at least: 500000000 nsec.\n"); + printf("It was: \%lld nsec.\n", self->expected_time); + exit(2); } =} } diff --git a/test/C/src/StartupOutFromInside.lf b/test/C/src/StartupOutFromInside.lf index 1e9a8a822a..6233e0968f 100644 --- a/test/C/src/StartupOutFromInside.lf +++ b/test/C/src/StartupOutFromInside.lf @@ -12,8 +12,8 @@ main reactor StartupOutFromInside { reaction(startup) bar.out {= printf("Output from bar: %d\n", bar.out->value); if (bar.out->value != 42) { - fprintf(stderr, "Expected 42!\n"); - exit(1); + fprintf(stderr, "Expected 42!\n"); + exit(1); } =} } diff --git a/test/C/src/Starvation.lf b/test/C/src/Starvation.lf index da56c2d4f7..83647fd0fa 100644 --- a/test/C/src/Starvation.lf +++ b/test/C/src/Starvation.lf @@ -13,7 +13,7 @@ reactor SuperDenseSender(number_of_iterations: int = 10) { reaction(startup, loop) -> out {= if (self->iterator < self->number_of_iterations) { - lf_schedule(loop, 0); + lf_schedule(loop, 0); } self->iterator++; lf_set(out, 42); @@ -22,14 +22,14 @@ reactor SuperDenseSender(number_of_iterations: int = 10) { reaction(shutdown) {= tag_t current_tag = lf_tag(); if (current_tag.time == lf_time_start() - && current_tag.microstep == self->number_of_iterations + 1) { - printf("SUCCESS: Sender successfully detected starvation.\n"); + && current_tag.microstep == self->number_of_iterations + 1) { + printf("SUCCESS: Sender successfully detected starvation.\n"); } else { - fprintf(stderr, "ERROR: Failed to properly enforce starvation at sender. " - "Shutting down at tag (%lld, %u).\n", - current_tag.time - lf_time_start(), - current_tag.microstep); - exit(1); + fprintf(stderr, "ERROR: Failed to properly enforce starvation at sender. " + "Shutting down at tag (%lld, %u).\n", + current_tag.time - lf_time_start(), + current_tag.microstep); + exit(1); } =} } @@ -40,22 +40,22 @@ reactor SuperDenseReceiver(number_of_iterations: int = 10) { reaction(in) {= tag_t current_tag = lf_tag(); printf("Received %d at tag (%lld, %u).\n", - in->value, - current_tag.time - lf_time_start(), - current_tag.microstep); + in->value, + current_tag.time - lf_time_start(), + current_tag.microstep); =} reaction(shutdown) {= tag_t current_tag = lf_tag(); if (current_tag.time == lf_time_start() - && current_tag.microstep == self->number_of_iterations + 1) { - printf("SUCCESS: Receiver successfully detected starvation.\n"); + && current_tag.microstep == self->number_of_iterations + 1) { + printf("SUCCESS: Receiver successfully detected starvation.\n"); } else { - fprintf(stderr, "ERROR: Failed to properly enforce starvation at receiver. " - "Shutting down at tag (%lld, %u).\n", - current_tag.time - lf_time_start(), - current_tag.microstep); - exit(1); + fprintf(stderr, "ERROR: Failed to properly enforce starvation at receiver. " + "Shutting down at tag (%lld, %u).\n", + current_tag.time - lf_time_start(), + current_tag.microstep); + exit(1); } =} } diff --git a/test/C/src/Stop.lf b/test/C/src/Stop.lf index a9586ecee7..2dbdf217ba 100644 --- a/test/C/src/Stop.lf +++ b/test/C/src/Stop.lf @@ -16,19 +16,19 @@ reactor Consumer { reaction(in) {= tag_t current_tag = lf_tag(); if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) > 0) { - // The reaction should not have been called at tags larger than (10 msec, 9) - fprintf(stderr, "ERROR: Invoked reaction(in) at tag bigger than shutdown.\n"); - exit(1); + (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) > 0) { + // The reaction should not have been called at tags larger than (10 msec, 9) + fprintf(stderr, "ERROR: Invoked reaction(in) at tag bigger than shutdown.\n"); + exit(1); } else if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 8}) == 0) { - // Call lf_request_stop() at relative tag (10 msec, 8) - printf("Requesting stop.\n"); - lf_request_stop(); + (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 8}) == 0) { + // Call lf_request_stop() at relative tag (10 msec, 8) + printf("Requesting stop.\n"); + lf_request_stop(); } else if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) == 0) { - // Check that this reaction is indeed also triggered at (10 msec, 9) - self->reaction_invoked_correctly = true; + (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) == 0) { + // Check that this reaction is indeed also triggered at (10 msec, 9) + self->reaction_invoked_correctly = true; } =} @@ -37,19 +37,19 @@ reactor Consumer { printf("Shutdown invoked at tag (%lld, %u).\n", current_tag.time - lf_time_start(), current_tag.microstep); // Check to see if shutdown is called at relative tag (10 msec, 9) if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) == 0 && - self->reaction_invoked_correctly == true) { - printf("SUCCESS: successfully enforced stop.\n"); + (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) == 0 && + self->reaction_invoked_correctly == true) { + printf("SUCCESS: successfully enforced stop.\n"); } else if(lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) > 0) { - fprintf(stderr,"ERROR: Shutdown invoked at tag (%llu, %d). Failed to enforce timeout.\n", - current_tag.time - lf_time_start(), current_tag.microstep); - exit(1); + (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) > 0) { + fprintf(stderr,"ERROR: Shutdown invoked at tag (%llu, %d). Failed to enforce timeout.\n", + current_tag.time - lf_time_start(), current_tag.microstep); + exit(1); } else if (self->reaction_invoked_correctly == false) { - // Check to see if reactions were called correctly - fprintf(stderr,"ERROR: Failed to invoke reaction(in) at tag (%llu, %d).\n", - current_tag.time - lf_time_start(), current_tag.microstep); - exit(1); + // Check to see if reactions were called correctly + fprintf(stderr,"ERROR: Failed to invoke reaction(in) at tag (%llu, %d).\n", + current_tag.time - lf_time_start(), current_tag.microstep); + exit(1); } =} } diff --git a/test/C/src/StopZero.lf b/test/C/src/StopZero.lf index ad22467a89..b135204a5a 100644 --- a/test/C/src/StopZero.lf +++ b/test/C/src/StopZero.lf @@ -14,23 +14,23 @@ reactor Sender { reaction(t) -> out, act {= printf("Sending 42 at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_time_logical_elapsed(), + lf_tag().microstep); lf_set(out, 42); lf_schedule(act, 0); tag_t zero = (tag_t) { .time = lf_time_start(), .microstep = 0u }; tag_t one = (tag_t) { .time = lf_time_start(), .microstep = 1u }; if (lf_tag_compare(lf_tag(), zero) == 0) { - // Request stop at (0,0) - printf("Requesting stop at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - lf_request_stop(); + // Request stop at (0,0) + printf("Requesting stop at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + lf_request_stop(); } else if (lf_tag_compare(lf_tag(), one) > 0) { - fprintf(stderr, "ERROR: Reaction called after shutdown at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - exit(1); + fprintf(stderr, "ERROR: Reaction called after shutdown at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + exit(1); } =} @@ -38,28 +38,28 @@ reactor Sender { // Reaction should be invoked at (0,1) tag_t one = (tag_t) { .time = lf_time_start(), .microstep = 1u }; if (lf_tag_compare(lf_tag(), one) == 0) { - self->reaction_invoked_correctly = true; + self->reaction_invoked_correctly = true; } =} reaction(shutdown) {= if (lf_time_logical_elapsed() != USEC(0) || - lf_tag().microstep != 1) { - fprintf(stderr, "ERROR: Sender failed to stop the program in time. " - "Stopping at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - exit(1); + lf_tag().microstep != 1) { + fprintf(stderr, "ERROR: Sender failed to stop the program in time. " + "Stopping at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + exit(1); } else if (self->reaction_invoked_correctly == false) { - fprintf(stderr, "ERROR: Sender reaction(act) was not invoked. " - "Stopping at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - exit(1); + fprintf(stderr, "ERROR: Sender reaction(act) was not invoked. " + "Stopping at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + exit(1); } printf("SUCCESS: Successfully stopped the program at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_time_logical_elapsed(), + lf_tag().microstep); =} } @@ -68,16 +68,16 @@ reactor Receiver { reaction(in) {= printf("Received %d at (%lld, %u).\n", - in->value, - lf_time_logical_elapsed(), - lf_tag().microstep); + in->value, + lf_time_logical_elapsed(), + lf_tag().microstep); tag_t zero = (tag_t) { .time = lf_time_start(), .microstep = 0u }; if (lf_tag_compare(lf_tag(), zero) == 0) { - // Request stop at (0,0) - printf("Requesting stop at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - lf_request_stop(); + // Request stop at (0,0) + printf("Requesting stop at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + lf_request_stop(); } =} @@ -85,16 +85,16 @@ reactor Receiver { // Shutdown events must occur at (0, 1) on the // receiver. if (lf_time_logical_elapsed() != USEC(0) || - lf_tag().microstep != 1) { - fprintf(stderr, "ERROR: Receiver failed to stop the program in time. " - "Stopping at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - exit(1); + lf_tag().microstep != 1) { + fprintf(stderr, "ERROR: Receiver failed to stop the program in time. " + "Stopping at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + exit(1); } printf("SUCCESS: Successfully stopped the program at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_time_logical_elapsed(), + lf_tag().microstep); =} } diff --git a/test/C/src/Stride.lf b/test/C/src/Stride.lf index c4016d5059..dde49e6ef1 100644 --- a/test/C/src/Stride.lf +++ b/test/C/src/Stride.lf @@ -23,14 +23,14 @@ reactor Display { reaction(x) {= printf("Received: %d.\n", x->value); if (x->value != self->expected) { - fprintf(stderr, "ERROR: Expected %d\n", self->expected); + fprintf(stderr, "ERROR: Expected %d\n", self->expected); } self->expected += 2; =} } main reactor Stride { - c = new Count(stride = 2) + c = new Count(stride=2) d = new Display() c.y -> d.x } diff --git a/test/C/src/StructAsState.lf b/test/C/src/StructAsState.lf index c26429e1a7..16cb8ea86a 100644 --- a/test/C/src/StructAsState.lf +++ b/test/C/src/StructAsState.lf @@ -3,8 +3,8 @@ target C preamble {= typedef struct hello_t { - char* name; - int value; + char* name; + int value; } hello_t; =} @@ -14,8 +14,8 @@ main reactor StructAsState { reaction(startup) {= printf("State s.name=\"%s\", value=%d.\n", self->s.name, self->s.value); if (self->s.value != 42) { - fprintf(stderr, "FAILED: Expected 42.\n"); - exit(1); + fprintf(stderr, "FAILED: Expected 42.\n"); + exit(1); } =} } diff --git a/test/C/src/StructAsType.lf b/test/C/src/StructAsType.lf index bf7efbae41..f62ad18f24 100644 --- a/test/C/src/StructAsType.lf +++ b/test/C/src/StructAsType.lf @@ -30,8 +30,8 @@ reactor Print(expected: int = 42) { reaction(in) {= printf("Received: name = %s, value = %d\n", in->value.name, in->value.value); if (in->value.value != self->expected) { - printf("ERROR: Expected value to be %d.\n", self->expected); - exit(1); + printf("ERROR: Expected value to be %d.\n", self->expected); + exit(1); } =} } diff --git a/test/C/src/StructAsTypeDirect.lf b/test/C/src/StructAsTypeDirect.lf index 4a7832ec68..d801455601 100644 --- a/test/C/src/StructAsTypeDirect.lf +++ b/test/C/src/StructAsTypeDirect.lf @@ -24,8 +24,8 @@ reactor Print(expected: int = 42) { reaction(in) {= printf("Received: name = %s, value = %d\n", in->value.name, in->value.value); if (in->value.value != self->expected) { - printf("ERROR: Expected value to be %d.\n", self->expected); - exit(1); + printf("ERROR: Expected value to be %d.\n", self->expected); + exit(1); } =} } diff --git a/test/C/src/StructParallel.lf b/test/C/src/StructParallel.lf index 237f42366e..78f3543713 100644 --- a/test/C/src/StructParallel.lf +++ b/test/C/src/StructParallel.lf @@ -18,16 +18,16 @@ reactor Check(expected: int = 42) { reaction(in) {= printf("Received: name = %s, value = %d\n", in->value->name, in->value->value); if (in->value->value != self->expected) { - printf("ERROR: Expected value to be %d.\n", self->expected); - exit(1); + printf("ERROR: Expected value to be %d.\n", self->expected); + exit(1); } self->invoked = true; =} reaction(shutdown) {= if (self->invoked == false) { - fprintf(stderr, "ERROR: No data received.\n"); - exit(2); + fprintf(stderr, "ERROR: No data received.\n"); + exit(2); } =} } @@ -48,9 +48,9 @@ reactor Print(scale: int = 2) { main reactor StructParallel { s = new Source() c1 = new Print() - c2 = new Print(scale = 3) - p1 = new Check(expected = 84) - p2 = new Check(expected = 126) + c2 = new Print(scale=3) + p1 = new Check(expected=84) + p2 = new Check(expected=126) s.out -> c1.in s.out -> c2.in c1.out -> p1.in diff --git a/test/C/src/StructPrint.lf b/test/C/src/StructPrint.lf index 10bea74d49..dd3bd3b96f 100644 --- a/test/C/src/StructPrint.lf +++ b/test/C/src/StructPrint.lf @@ -27,8 +27,8 @@ reactor Check(expected: int = 42) { reaction(in) {= printf("Received: name = %s, value = %d\n", in->value->name, in->value->value); if (in->value->value != self->expected) { - printf("ERROR: Expected value to be %d.\n", self->expected); - exit(1); + printf("ERROR: Expected value to be %d.\n", self->expected); + exit(1); } =} } diff --git a/test/C/src/StructScale.lf b/test/C/src/StructScale.lf index 39293c2503..4a5dd2d79e 100644 --- a/test/C/src/StructScale.lf +++ b/test/C/src/StructScale.lf @@ -29,16 +29,16 @@ reactor TestInput(expected: int = 42) { reaction(in) {= printf("Received: name = %s, value = %d\n", in->value->name, in->value->value); if (in->value->value != self->expected) { - printf("ERROR: Expected value to be %d.\n", self->expected); - exit(1); + printf("ERROR: Expected value to be %d.\n", self->expected); + exit(1); } self->invoked = true; =} reaction(shutdown) {= if (self->invoked == false) { - fprintf(stderr, "ERROR: No data received.\n"); - exit(2); + fprintf(stderr, "ERROR: No data received.\n"); + exit(2); } =} } @@ -58,7 +58,7 @@ reactor Print(scale: int = 2) { main reactor StructScale { s = new Source() c = new Print() - p = new TestInput(expected = 84) + p = new TestInput(expected=84) s.out -> c.in c.out -> p.in } diff --git a/test/C/src/SubclassesAndStartup.lf b/test/C/src/SubclassesAndStartup.lf index 46e184e378..77fbc72946 100644 --- a/test/C/src/SubclassesAndStartup.lf +++ b/test/C/src/SubclassesAndStartup.lf @@ -10,8 +10,8 @@ reactor Super { reaction(shutdown) {= if (self->count == 0) { - fprintf(stderr, "No startup reaction was invoked!\n"); - exit(3); + fprintf(stderr, "No startup reaction was invoked!\n"); + exit(3); } =} } @@ -20,8 +20,8 @@ reactor SubA(name: string = "SubA") extends Super { reaction(startup) {= printf("%s started\n", self->name); if (self->count == 0) { - fprintf(stderr, "Base class startup reaction was not invoked!\n"); - exit(1); + fprintf(stderr, "Base class startup reaction was not invoked!\n"); + exit(1); } =} } @@ -30,8 +30,8 @@ reactor SubB(name: string = "SubB") extends Super { reaction(startup) {= printf("%s started\n", self->name); if (self->count == 0) { - fprintf(stderr, "Base class startup reaction was not invoked!\n"); - exit(2); + fprintf(stderr, "Base class startup reaction was not invoked!\n"); + exit(2); } =} } diff --git a/test/C/src/TestForPreviousOutput.lf b/test/C/src/TestForPreviousOutput.lf index 0151715df0..cd11767592 100644 --- a/test/C/src/TestForPreviousOutput.lf +++ b/test/C/src/TestForPreviousOutput.lf @@ -20,15 +20,15 @@ reactor Source { srand(time(0)); // Randomly produce an output or not. if (rand() % 2) { - lf_set(out, 21); + lf_set(out, 21); } =} reaction(startup) -> out {= if (out->is_present) { - lf_set(out, 2 * out->value); + lf_set(out, 2 * out->value); } else { - lf_set(out, 42); + lf_set(out, 42); } =} } @@ -39,8 +39,8 @@ reactor Sink { reaction(in) {= printf("Received %d.\n", in->value); if (in->value != 42) { - fprintf(stderr, "FAILED: Expected 42.\n"); - exit(1); + fprintf(stderr, "FAILED: Expected 42.\n"); + exit(1); } =} } diff --git a/test/C/src/TimeLimit.lf b/test/C/src/TimeLimit.lf index efffe62f98..4b1ea4f248 100644 --- a/test/C/src/TimeLimit.lf +++ b/test/C/src/TimeLimit.lf @@ -23,8 +23,8 @@ reactor Destination { reaction(x) {= // printf("%d\n", x->value); if (x->value != self->s) { - printf("Error: Expected %d and got %d.\n", self->s, x->value); - exit(1); + printf("Error: Expected %d and got %d.\n", self->s, x->value); + exit(1); } self->s++; =} @@ -32,15 +32,15 @@ reactor Destination { reaction(shutdown) {= printf("**** shutdown reaction invoked.\n"); if (self->s != 12) { - fprintf(stderr, "ERROR: Expected 12 but got %d.\n", self->s); - exit(1); + fprintf(stderr, "ERROR: Expected 12 but got %d.\n", self->s); + exit(1); } =} } main reactor TimeLimit(period: time = 1 sec) { timer stop(10 sec) - c = new Clock(period = period) + c = new Clock(period=period) d = new Destination() c.y -> d.x diff --git a/test/C/src/Timeout.lf b/test/C/src/Timeout.lf index e6198c4c13..00eaf1b9cd 100644 --- a/test/C/src/Timeout.lf +++ b/test/C/src/Timeout.lf @@ -16,13 +16,13 @@ reactor Consumer { reaction(in) {= tag_t current_tag = lf_tag(); if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(11) + lf_time_start(), .microstep = 0}) > 0) { - fprintf(stderr,"ERROR: Tag (%lld, %d) received. Failed to enforce timeout.\n", - current_tag.time, current_tag.microstep); - exit(1); + (tag_t) { .time = MSEC(11) + lf_time_start(), .microstep = 0}) > 0) { + fprintf(stderr,"ERROR: Tag (%lld, %d) received. Failed to enforce timeout.\n", + current_tag.time, current_tag.microstep); + exit(1); } else if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(11) + lf_time_start(), .microstep = 0}) == 0) { - self->success = true; // Successfully invoked the reaction at (timeout, 0) + (tag_t) { .time = MSEC(11) + lf_time_start(), .microstep = 0}) == 0) { + self->success = true; // Successfully invoked the reaction at (timeout, 0) } =} @@ -30,13 +30,13 @@ reactor Consumer { tag_t current_tag = lf_tag(); printf("Shutdown invoked at tag (%lld, %u).\n", current_tag.time - lf_time_start(), current_tag.microstep); if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(11) + lf_time_start(), .microstep = 0}) == 0 && - self->success == true) { - printf("SUCCESS: successfully enforced timeout.\n"); + (tag_t) { .time = MSEC(11) + lf_time_start(), .microstep = 0}) == 0 && + self->success == true) { + printf("SUCCESS: successfully enforced timeout.\n"); } else { - fprintf(stderr,"ERROR: Shutdown invoked at tag (%llu, %d). Failed to enforce timeout.\n", - current_tag.time, current_tag.microstep); - exit(1); + fprintf(stderr,"ERROR: Shutdown invoked at tag (%llu, %d). Failed to enforce timeout.\n", + current_tag.time, current_tag.microstep); + exit(1); } =} } diff --git a/test/C/src/TimeoutZero.lf b/test/C/src/TimeoutZero.lf index 414a4460b0..a0ba757b30 100644 --- a/test/C/src/TimeoutZero.lf +++ b/test/C/src/TimeoutZero.lf @@ -16,13 +16,13 @@ reactor Consumer { reaction(in) {= tag_t current_tag = lf_tag(); if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(0) + lf_time_start(), .microstep = 0}) > 0) { - fprintf(stderr,"ERROR: Tag (%lld, %d) received. Failed to enforce timeout.\n", - current_tag.time, current_tag.microstep); - exit(1); + (tag_t) { .time = MSEC(0) + lf_time_start(), .microstep = 0}) > 0) { + fprintf(stderr,"ERROR: Tag (%lld, %d) received. Failed to enforce timeout.\n", + current_tag.time, current_tag.microstep); + exit(1); } else if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(0) + lf_time_start(), .microstep = 0}) == 0) { - self->success = true; // Successfully invoked the reaction at (timeout, 0) + (tag_t) { .time = MSEC(0) + lf_time_start(), .microstep = 0}) == 0) { + self->success = true; // Successfully invoked the reaction at (timeout, 0) } =} @@ -30,13 +30,13 @@ reactor Consumer { tag_t current_tag = lf_tag(); printf("Shutdown invoked at tag (%lld, %u).\n", current_tag.time - lf_time_start(), current_tag.microstep); if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(0) + lf_time_start(), .microstep = 0}) == 0 && - self->success == true) { - printf("SUCCESS: successfully enforced timeout.\n"); + (tag_t) { .time = MSEC(0) + lf_time_start(), .microstep = 0}) == 0 && + self->success == true) { + printf("SUCCESS: successfully enforced timeout.\n"); } else { - fprintf(stderr,"ERROR: Shutdown invoked at tag (%llu, %d). Failed to enforce timeout.\n", - current_tag.time, current_tag.microstep); - exit(1); + fprintf(stderr,"ERROR: Shutdown invoked at tag (%llu, %d). Failed to enforce timeout.\n", + current_tag.time, current_tag.microstep); + exit(1); } =} } diff --git a/test/C/src/ToReactionNested.lf b/test/C/src/ToReactionNested.lf index 14be00164d..4a643d053c 100644 --- a/test/C/src/ToReactionNested.lf +++ b/test/C/src/ToReactionNested.lf @@ -19,18 +19,18 @@ main reactor { reaction(s.out) {= if (s.out->is_present) { - lf_print("Received %d.", s.out->value); - if (self->count != s.out->value) { - lf_print_error_and_exit("Expected %d.", self->count); - } - self->received = true; + lf_print("Received %d.", s.out->value); + if (self->count != s.out->value) { + lf_print_error_and_exit("Expected %d.", self->count); + } + self->received = true; } self->count++; =} reaction(shutdown) {= if (!self->received) { - lf_print_error_and_exit("No inputs present."); + lf_print_error_and_exit("No inputs present."); } =} } diff --git a/test/C/src/TriggerDownstreamOnlyIfPresent2.lf b/test/C/src/TriggerDownstreamOnlyIfPresent2.lf index 25eb13e564..c2ed6f1642 100644 --- a/test/C/src/TriggerDownstreamOnlyIfPresent2.lf +++ b/test/C/src/TriggerDownstreamOnlyIfPresent2.lf @@ -11,9 +11,9 @@ reactor Source { reaction(t) -> out {= if (self->count++ % 2 == 0) { - lf_set(out[0], self->count); + lf_set(out[0], self->count); } else { - lf_set(out[1], self->count); + lf_set(out[1], self->count); } =} } @@ -23,8 +23,8 @@ reactor Destination { reaction(in) {= if (!in->is_present) { - fprintf(stderr, "Reaction to input of triggered even though all inputs are absent!\n"); - exit(1); + fprintf(stderr, "Reaction to input of triggered even though all inputs are absent!\n"); + exit(1); } =} } diff --git a/test/C/src/UnconnectedInput.lf b/test/C/src/UnconnectedInput.lf index 88f7554149..71a141f158 100644 --- a/test/C/src/UnconnectedInput.lf +++ b/test/C/src/UnconnectedInput.lf @@ -32,8 +32,8 @@ reactor Print { reaction(in) {= printf("Received: %d.\n", in->value); if (in->value != self->expected) { - printf("ERROR: Expected %d.\n", self->expected); - exit(1); + printf("ERROR: Expected %d.\n", self->expected); + exit(1); } self->expected++; =} diff --git a/test/C/src/Wcet.lf b/test/C/src/Wcet.lf index 984f95244f..9e6f84be6a 100644 --- a/test/C/src/Wcet.lf +++ b/test/C/src/Wcet.lf @@ -20,9 +20,9 @@ reactor Work { reaction(in1, in2) -> out {= int ret; if (in1->value > 10) { - ret = in2->value * in1->value; + ret = in2->value * in1->value; } else { - ret = in2->value + in1->value; + ret = in2->value + in1->value; } lf_set(out, ret); =} diff --git a/test/C/src/arduino/Fade.lf b/test/C/src/arduino/Fade.lf index 5be1e79a79..2684ef2dd7 100644 --- a/test/C/src/arduino/Fade.lf +++ b/test/C/src/arduino/Fade.lf @@ -25,7 +25,7 @@ main reactor Fade { self->brightness += self->fadeAmount; // reverse the direction of the fading at the ends of the fade: if (self->brightness <= 0 || self->brightness >= 255) { - self->fadeAmount = -self->fadeAmount; + self->fadeAmount = -self->fadeAmount; } =} } diff --git a/test/C/src/concurrent/AsyncCallback.lf b/test/C/src/concurrent/AsyncCallback.lf index d43dbc2a90..b6f4d9c25c 100644 --- a/test/C/src/concurrent/AsyncCallback.lf +++ b/test/C/src/concurrent/AsyncCallback.lf @@ -24,20 +24,20 @@ preamble {= main reactor AsyncCallback { preamble {= void callback(void* a) { - // Schedule twice. If the action is not physical, these should - // get consolidated into a single action triggering. If it is, - // then they cause two separate triggerings with close but not - // equal time stamps. The minimum time between these is determined - // by the argument in the physical action definition. - lf_schedule(a, 0LL); - lf_schedule(a, 0LL); + // Schedule twice. If the action is not physical, these should + // get consolidated into a single action triggering. If it is, + // then they cause two separate triggerings with close but not + // equal time stamps. The minimum time between these is determined + // by the argument in the physical action definition. + lf_schedule(a, 0LL); + lf_schedule(a, 0LL); } // Simulate time passing before a callback occurs. void* take_time(void* a) { - instant_t sleep_time = 100000000; - lf_sleep(sleep_time); - callback(a); - return NULL; + instant_t sleep_time = 100000000; + lf_sleep(sleep_time); + callback(a); + return NULL; } lf_thread_t threadId; =} @@ -57,16 +57,16 @@ main reactor AsyncCallback { reaction(a) {= instant_t elapsed_time = lf_time_logical_elapsed(); printf("Asynchronous callback %d: Assigned logical time greater than start time by %lld nsec.\n", - self->i++, elapsed_time); + self->i++, elapsed_time); if (elapsed_time <= self->expected_time) { - printf("ERROR: Expected logical time to be larger than %lld.\n", self->expected_time); - exit(1); + printf("ERROR: Expected logical time to be larger than %lld.\n", self->expected_time); + exit(1); } if (self->toggle) { - self->toggle = false; - self->expected_time += 200000000LL; + self->toggle = false; + self->expected_time += 200000000LL; } else { - self->toggle = true; + self->toggle = true; } =} } diff --git a/test/C/src/concurrent/AsyncCallbackDrop.lf b/test/C/src/concurrent/AsyncCallbackDrop.lf index 245048d910..2281601e62 100644 --- a/test/C/src/concurrent/AsyncCallbackDrop.lf +++ b/test/C/src/concurrent/AsyncCallbackDrop.lf @@ -19,20 +19,20 @@ preamble {= main reactor { preamble {= void callback(void* a) { - // Schedule twice in rapid succession. - // The second value should be dropped because the - // timestamps will not be sufficiently separated. - // The minimum time between these is determined - // by the argument in the physical action definition. - lf_schedule_int(a, 0, 0); - lf_schedule_int(a, 0, 1); + // Schedule twice in rapid succession. + // The second value should be dropped because the + // timestamps will not be sufficiently separated. + // The minimum time between these is determined + // by the argument in the physical action definition. + lf_schedule_int(a, 0, 0); + lf_schedule_int(a, 0, 1); } // Simulate time passing before a callback occurs. void* take_time(void* a) { - instant_t sleep_time = 100000000; - lf_sleep(sleep_time); - callback(a); - return NULL; + instant_t sleep_time = 100000000; + lf_sleep(sleep_time); + callback(a); + return NULL; } lf_thread_t threadId; =} @@ -53,18 +53,18 @@ main reactor { instant_t elapsed_time = lf_time_logical_elapsed(); printf("Asynchronous callback %d: Assigned logical time greater than start time by %lld nsec.\n", self->i++, elapsed_time); if (elapsed_time <= self->expected_time) { - printf("ERROR: Expected logical time to be larger than %lld.\n", self->expected_time); - exit(1); + printf("ERROR: Expected logical time to be larger than %lld.\n", self->expected_time); + exit(1); } if (a->value != 0) { - printf("ERROR: Received: %d, expected 0 because the second event should have been dropped.\n", a->value); - exit(2); + printf("ERROR: Received: %d, expected 0 because the second event should have been dropped.\n", a->value); + exit(2); } if (self->toggle) { - self->toggle = false; - self->expected_time += 200000000LL; + self->toggle = false; + self->expected_time += 200000000LL; } else { - self->toggle = true; + self->toggle = true; } =} } diff --git a/test/C/src/concurrent/AsyncCallbackReplace.lf b/test/C/src/concurrent/AsyncCallbackReplace.lf index 2809012ac9..4581e38fb9 100644 --- a/test/C/src/concurrent/AsyncCallbackReplace.lf +++ b/test/C/src/concurrent/AsyncCallbackReplace.lf @@ -19,20 +19,20 @@ preamble {= main reactor { preamble {= void callback(void* a) { - // Schedule twice in rapid succession. - // The second value should be dropped because the - // timestamps will not be sufficiently separated. - // The minimum time between these is determined - // by the argument in the physical action definition. - lf_schedule_int(a, 0, 0); - lf_schedule_int(a, 0, 1); + // Schedule twice in rapid succession. + // The second value should be dropped because the + // timestamps will not be sufficiently separated. + // The minimum time between these is determined + // by the argument in the physical action definition. + lf_schedule_int(a, 0, 0); + lf_schedule_int(a, 0, 1); } // Simulate time passing before a callback occurs. void* take_time(void* a) { - instant_t sleep_time = 100000000; - lf_sleep(sleep_time); - callback(a); - return NULL; + instant_t sleep_time = 100000000; + lf_sleep(sleep_time); + callback(a); + return NULL; } lf_thread_t threadId; =} @@ -53,18 +53,18 @@ main reactor { instant_t elapsed_time = lf_time_logical_elapsed(); printf("Asynchronous callback %d: Assigned logical time greater than start time by %lld nsec.\n", self->i++, elapsed_time); if (elapsed_time <= self->expected_time) { - printf("ERROR: Expected logical time to be larger than %lld.\n", self->expected_time); - exit(1); + printf("ERROR: Expected logical time to be larger than %lld.\n", self->expected_time); + exit(1); } if (a->value != 1) { - printf("ERROR: Received: %d, expected 1 because the second event should have replaced the first.\n", a->value); - exit(2); + printf("ERROR: Received: %d, expected 1 because the second event should have replaced the first.\n", a->value); + exit(2); } if (self->toggle) { - self->toggle = false; - self->expected_time += 200000000LL; + self->toggle = false; + self->expected_time += 200000000LL; } else { - self->toggle = true; + self->toggle = true; } =} } diff --git a/test/C/src/concurrent/CompositionThreaded.lf b/test/C/src/concurrent/CompositionThreaded.lf index ed40610e62..f7f2e959f6 100644 --- a/test/C/src/concurrent/CompositionThreaded.lf +++ b/test/C/src/concurrent/CompositionThreaded.lf @@ -23,8 +23,8 @@ reactor Test { (self->count)++; printf("Received %d\n", x->value); if (x->value != self->count) { - printf("FAILURE: Expected %d\n", self->count); - exit(1); + printf("FAILURE: Expected %d\n", self->count); + exit(1); } =} } diff --git a/test/C/src/concurrent/DeadlineHandledAboveThreaded.lf b/test/C/src/concurrent/DeadlineHandledAboveThreaded.lf index 175745baa5..ec8a4a3322 100644 --- a/test/C/src/concurrent/DeadlineHandledAboveThreaded.lf +++ b/test/C/src/concurrent/DeadlineHandledAboveThreaded.lf @@ -36,17 +36,17 @@ main reactor { reaction(d.deadline_violation) {= if (d.deadline_violation) { - printf("Output successfully produced by deadline miss handler.\n"); - self->violation_detected = true; + printf("Output successfully produced by deadline miss handler.\n"); + self->violation_detected = true; } =} reaction(shutdown) {= if (self->violation_detected) { - printf("SUCCESS. Test passes.\n"); + printf("SUCCESS. Test passes.\n"); } else { - printf("FAILURE. Container did not react to deadline violation.\n"); - exit(2); + printf("FAILURE. Container did not react to deadline violation.\n"); + exit(2); } =} } diff --git a/test/C/src/concurrent/DeadlineThreaded.lf b/test/C/src/concurrent/DeadlineThreaded.lf index 0639d1e709..ac90b9865d 100644 --- a/test/C/src/concurrent/DeadlineThreaded.lf +++ b/test/C/src/concurrent/DeadlineThreaded.lf @@ -21,9 +21,9 @@ reactor Source(period: time = 3000 msec) { reaction(t) -> y {= if (2 * (self->count / 2) != self->count) { - // The count variable is odd. - // Take time to cause a deadline violation. - lf_sleep(MSEC(1100)); + // The count variable is odd. + // Take time to cause a deadline violation. + lf_sleep(MSEC(1100)); } printf("Source sends: %d.\n", self->count); lf_set(y, self->count); @@ -38,17 +38,17 @@ reactor Destination(timeout: time = 1 sec) { reaction(x) {= printf("Destination receives: %d\n", x->value); if (2 * (self->count / 2) != self->count) { - // The count variable is odd, so the deadline should have been violated. - printf("ERROR: Failed to detect deadline.\n"); - exit(1); + // The count variable is odd, so the deadline should have been violated. + printf("ERROR: Failed to detect deadline.\n"); + exit(1); } (self->count)++; =} deadline(timeout) {= printf("Destination deadline handler receives: %d\n", x->value); if (2 * (self->count / 2) == self->count) { - // The count variable is even, so the deadline should not have been violated. - printf("ERROR: Unexpected deadline violation.\n"); - exit(2); + // The count variable is even, so the deadline should not have been violated. + printf("ERROR: Unexpected deadline violation.\n"); + exit(2); } (self->count)++; =} diff --git a/test/C/src/concurrent/DelayIntThreaded.lf b/test/C/src/concurrent/DelayIntThreaded.lf index 57d3987386..d328954454 100644 --- a/test/C/src/concurrent/DelayIntThreaded.lf +++ b/test/C/src/concurrent/DelayIntThreaded.lf @@ -32,20 +32,20 @@ reactor Test { interval_t elapsed = current_time - self->start_time; printf("After %lld nsec of logical time.\n", elapsed); if (elapsed != 100000000LL) { - printf("ERROR: Expected elapsed time to be 100000000. It was %lld.\n", elapsed); - exit(1); + printf("ERROR: Expected elapsed time to be 100000000. It was %lld.\n", elapsed); + exit(1); } if (in->value != 42) { - printf("ERROR: Expected input value to be 42. It was %d.\n", in->value); - exit(2); + printf("ERROR: Expected input value to be 42. It was %d.\n", in->value); + exit(2); } =} reaction(shutdown) {= printf("Checking that communication occurred.\n"); if (!self->received_value) { - printf("ERROR: No communication occurred!\n"); - exit(3); + printf("ERROR: No communication occurred!\n"); + exit(3); } =} } diff --git a/test/C/src/concurrent/DeterminismThreaded.lf b/test/C/src/concurrent/DeterminismThreaded.lf index a0df17b15c..813405f25f 100644 --- a/test/C/src/concurrent/DeterminismThreaded.lf +++ b/test/C/src/concurrent/DeterminismThreaded.lf @@ -14,15 +14,15 @@ reactor Destination { reaction(x, y) {= int sum = 0; if (x->is_present) { - sum += x->value; + sum += x->value; } if (y->is_present) { - sum += y->value; + sum += y->value; } printf("Received %d.\n", sum); if (sum != 2) { - printf("FAILURE: Expected 2.\n"); - exit(4); + printf("FAILURE: Expected 2.\n"); + exit(4); } =} } diff --git a/test/C/src/concurrent/DoubleReactionThreaded.lf b/test/C/src/concurrent/DoubleReactionThreaded.lf index 25eeb9f846..69f8ea85c2 100644 --- a/test/C/src/concurrent/DoubleReactionThreaded.lf +++ b/test/C/src/concurrent/DoubleReactionThreaded.lf @@ -24,15 +24,15 @@ reactor Destination { reaction(x, w) {= int sum = 0; if (x->is_present) { - sum += x->value; + sum += x->value; } if (w->is_present) { - sum += w->value; + sum += w->value; } printf("Sum of inputs is: %d\n", sum); if (sum != self->s) { - printf("FAILURE: Expected sum to be %d, but it was %d.\n", self->s, sum); - exit(1); + printf("FAILURE: Expected sum to be %d, but it was %d.\n", self->s, sum); + exit(1); } self->s += 2; =} diff --git a/test/C/src/concurrent/GainThreaded.lf b/test/C/src/concurrent/GainThreaded.lf index f1407793bd..688a36eabd 100644 --- a/test/C/src/concurrent/GainThreaded.lf +++ b/test/C/src/concurrent/GainThreaded.lf @@ -16,16 +16,16 @@ reactor Test { printf("Received %d.\n", x->value); self->received_value = true; if (x->value != 2) { - printf("ERROR: Expected 2!\n"); - exit(1); + printf("ERROR: Expected 2!\n"); + exit(1); } =} reaction(shutdown) {= if (!self->received_value) { - printf("ERROR: No value received by Test reactor!\n"); + printf("ERROR: No value received by Test reactor!\n"); } else { - printf("Test passes.\n"); + printf("Test passes.\n"); } =} } diff --git a/test/C/src/concurrent/HelloThreaded.lf b/test/C/src/concurrent/HelloThreaded.lf index afe424aaaf..a1630610a6 100644 --- a/test/C/src/concurrent/HelloThreaded.lf +++ b/test/C/src/concurrent/HelloThreaded.lf @@ -32,21 +32,21 @@ reactor Reschedule(period: time = 2 sec, message: string = "Hello C") { printf("***** action %d at time %lld\n", self->count, lf_time_logical()); // Check the a_has_value variable. if (a->has_value) { - printf("FAILURE: Expected a->has_value to be false, but it was true.\n"); - exit(2); + printf("FAILURE: Expected a->has_value to be false, but it was true.\n"); + exit(2); } long long time = lf_time_logical(); if (time - self->previous_time != 200000000ll) { - printf("FAILURE: Expected 200ms of logical time to elapse but got %lld nanoseconds.\n", - time - self->previous_time - ); - exit(1); + printf("FAILURE: Expected 200ms of logical time to elapse but got %lld nanoseconds.\n", + time - self->previous_time + ); + exit(1); } =} } reactor Inside(period: time = 1 sec, message: string = "Composite default message.") { - third_instance = new Reschedule(period = period, message = message) + third_instance = new Reschedule(period=period, message=message) } main reactor HelloThreaded { diff --git a/test/C/src/concurrent/PingPongThreaded.lf b/test/C/src/concurrent/PingPongThreaded.lf index 4d6532acdd..69d7b512a2 100644 --- a/test/C/src/concurrent/PingPongThreaded.lf +++ b/test/C/src/concurrent/PingPongThreaded.lf @@ -31,9 +31,9 @@ reactor Ping(count: int = 10) { reaction(receive) -> serve {= if (self->pingsLeft > 0) { - lf_schedule(serve, 0); + lf_schedule(serve, 0); } else { - lf_request_stop(); + lf_request_stop(); } =} } @@ -50,10 +50,10 @@ reactor Pong(expected: int = 10) { reaction(shutdown) {= if (self->count != self->expected) { - fprintf(stderr, "Pong expected to receive %d inputs, but it received %d.\n", - self->expected, self->count - ); - exit(1); + fprintf(stderr, "Pong expected to receive %d inputs, but it received %d.\n", + self->expected, self->count + ); + exit(1); } printf("Success.\n"); =} diff --git a/test/C/src/concurrent/ScheduleAt.lf b/test/C/src/concurrent/ScheduleAt.lf index d2d866ac0b..b0f0f322fe 100644 --- a/test/C/src/concurrent/ScheduleAt.lf +++ b/test/C/src/concurrent/ScheduleAt.lf @@ -23,44 +23,42 @@ reactor Scheduler { state microstep_delay_list: uint32_t[] = {0, 1, 1, 2, 2, 0, 0, 1, 1, 0, 2, 3, 3, 4, 4, 5} state times: int[] = { - 0, - 0, - 0, - 0, - 0, - 400 msec, - 400 msec, - 400 msec, - 400 msec, // List of the corresponding times. Size = 16 - 800 msec, - 800 msec, - 800 msec, - 800 msec, - 900 msec, - 900 msec, - 900 msec - } + 0, + 0, + 0, + 0, + 0, + 400 msec, + 400 msec, + 400 msec, + 400 msec, // List of the corresponding times. Size = 16 + 800 msec, + 800 msec, + 800 msec, + 800 msec, + 900 msec, + 900 msec, + 900 msec} // Size = 9 state action_hit_list_microstep: int[] = {1, 2, 0, 1, 0, 2, 3, 4, 5} state action_hit_list_times: int[] = { - 0, - 0, - 400 msec, - 400 msec, - 800 msec, - 800 msec, - 800 msec, - 900 msec, - 900 msec - } + 0, + 0, + 400 msec, + 400 msec, + 800 msec, + 800 msec, + 800 msec, + 900 msec, + 900 msec} // Size = 9 state action_hit_list_index: int = 0 reaction(startup) -> act {= for (int i=0; i < 16; i++) { - _lf_schedule_at_tag(self->base.environment, act->_base.trigger, - (tag_t) { .time = self->times[i] + lf_time_logical(), .microstep = self->microstep_delay_list[i]}, - NULL); + _lf_schedule_at_tag(self->base.environment, act->_base.trigger, + (tag_t) { .time = self->times[i] + lf_time_logical(), .microstep = self->microstep_delay_list[i]}, + NULL); } =} @@ -68,16 +66,16 @@ reactor Scheduler { microstep_t microstep = lf_tag().microstep; instant_t elapsed_time = lf_time_logical_elapsed(); if (elapsed_time == self->action_hit_list_times[self->action_hit_list_index] && - microstep == self->action_hit_list_microstep[self->action_hit_list_index]) { - self->action_hit_list_index++; + microstep == self->action_hit_list_microstep[self->action_hit_list_index]) { + self->action_hit_list_index++; } printf("Triggered at tag (%lld, %u).\n", elapsed_time, microstep); =} reaction(shutdown) {= if (self->action_hit_list_index != 9) { - fprintf(stderr, "ERROR: incorrect number of actions were correctly scheduled: %d.", self->action_hit_list_index); - exit(1); + fprintf(stderr, "ERROR: incorrect number of actions were correctly scheduled: %d.", self->action_hit_list_index); + exit(1); } printf("SUCCESS: successfully scheduled all the events.\n"); =} diff --git a/test/C/src/concurrent/ScheduleTwice.lf b/test/C/src/concurrent/ScheduleTwice.lf index 06a1c2c1cb..747ecd067e 100644 --- a/test/C/src/concurrent/ScheduleTwice.lf +++ b/test/C/src/concurrent/ScheduleTwice.lf @@ -15,20 +15,20 @@ main reactor ScheduleTwice { reaction(a) {= printf("Received %d at tag(%lld, %u).\n", a->value, lf_time_logical_elapsed(), lf_tag().microstep); if (lf_tag().microstep == 0 && a->value != 42) { - fprintf(stderr, "ERROR: Expected 42 at microstep 0.\n"); - exit(1); + fprintf(stderr, "ERROR: Expected 42 at microstep 0.\n"); + exit(1); } if (lf_tag().microstep == 1 && a->value != 84) { - fprintf(stderr, "ERROR: Expected 84 at microstep 1.\n"); - exit(1); + fprintf(stderr, "ERROR: Expected 84 at microstep 1.\n"); + exit(1); } self->rc_count++; =} reaction(shutdown) {= if (self->rc_count < 2) { - fprintf(stderr, "Didn't see two events.\n"); - exit(2); + fprintf(stderr, "Didn't see two events.\n"); + exit(2); } =} } diff --git a/test/C/src/concurrent/ScheduleTwiceThreaded.lf b/test/C/src/concurrent/ScheduleTwiceThreaded.lf index d7e3d926f3..8365f28045 100644 --- a/test/C/src/concurrent/ScheduleTwiceThreaded.lf +++ b/test/C/src/concurrent/ScheduleTwiceThreaded.lf @@ -12,20 +12,20 @@ main reactor { reaction(a) {= printf("Received %d at tag(%lld, %u).\n", a->value, lf_time_logical_elapsed(), lf_tag().microstep); if (lf_tag().microstep == 0 && a->value != 42) { - fprintf(stderr, "ERROR: Expected 42 at microstep 0.\n"); - exit(1); + fprintf(stderr, "ERROR: Expected 42 at microstep 0.\n"); + exit(1); } if (lf_tag().microstep == 1 && a->value != 84) { - fprintf(stderr, "ERROR: Expected 84 at microstep 1.\n"); - exit(1); + fprintf(stderr, "ERROR: Expected 84 at microstep 1.\n"); + exit(1); } self->rc_count++; =} reaction(shutdown) {= if (self->rc_count < 2) { - fprintf(stderr, "Didn't see two events.\n"); - exit(2); + fprintf(stderr, "Didn't see two events.\n"); + exit(2); } =} } diff --git a/test/C/src/concurrent/SendingInsideThreaded.lf b/test/C/src/concurrent/SendingInsideThreaded.lf index e651f0fc69..0e0010e77f 100644 --- a/test/C/src/concurrent/SendingInsideThreaded.lf +++ b/test/C/src/concurrent/SendingInsideThreaded.lf @@ -12,8 +12,8 @@ reactor Printer { reaction(x) {= printf("Inside reactor received: %d\n", x->value); if (x->value != self->count) { - printf("FAILURE: Expected %d.\n", self->count); - exit(1); + printf("FAILURE: Expected %d.\n", self->count); + exit(1); } self->count++; =} diff --git a/test/C/src/concurrent/StarvationThreaded.lf b/test/C/src/concurrent/StarvationThreaded.lf index 5152b4daa0..a6d3206199 100644 --- a/test/C/src/concurrent/StarvationThreaded.lf +++ b/test/C/src/concurrent/StarvationThreaded.lf @@ -13,7 +13,7 @@ reactor SuperDenseSender(number_of_iterations: int = 10) { reaction(startup, loop) -> out {= if (self->iterator < self->number_of_iterations) { - lf_schedule(loop, 0); + lf_schedule(loop, 0); } self->iterator++; lf_set(out, 42); @@ -22,14 +22,14 @@ reactor SuperDenseSender(number_of_iterations: int = 10) { reaction(shutdown) {= tag_t current_tag = lf_tag(); if (current_tag.time == lf_time_start() - && current_tag.microstep == self->number_of_iterations + 1) { - printf("SUCCESS: Sender successfully detected starvation.\n"); + && current_tag.microstep == self->number_of_iterations + 1) { + printf("SUCCESS: Sender successfully detected starvation.\n"); } else { - fprintf(stderr, "ERROR: Failed to properly enforce starvation at sender. " - "Shutting down at tag (%lld, %u).\n", - current_tag.time - lf_time_start(), - current_tag.microstep); - exit(1); + fprintf(stderr, "ERROR: Failed to properly enforce starvation at sender. " + "Shutting down at tag (%lld, %u).\n", + current_tag.time - lf_time_start(), + current_tag.microstep); + exit(1); } =} } @@ -40,22 +40,22 @@ reactor SuperDenseReceiver(number_of_iterations: int = 10) { reaction(in) {= tag_t current_tag = lf_tag(); printf("Received %d at tag (%lld, %u).\n", - in->value, - current_tag.time - lf_time_start(), - current_tag.microstep); + in->value, + current_tag.time - lf_time_start(), + current_tag.microstep); =} reaction(shutdown) {= tag_t current_tag = lf_tag(); if (current_tag.time == lf_time_start() - && current_tag.microstep == self->number_of_iterations + 1) { - printf("SUCCESS: Receiver successfully detected starvation.\n"); + && current_tag.microstep == self->number_of_iterations + 1) { + printf("SUCCESS: Receiver successfully detected starvation.\n"); } else { - fprintf(stderr, "ERROR: Failed to properly enforce starvation at receiver. " - "Shutting down at tag (%lld, %u).\n", - current_tag.time - lf_time_start(), - current_tag.microstep); - exit(1); + fprintf(stderr, "ERROR: Failed to properly enforce starvation at receiver. " + "Shutting down at tag (%lld, %u).\n", + current_tag.time - lf_time_start(), + current_tag.microstep); + exit(1); } =} } diff --git a/test/C/src/concurrent/StopThreaded.lf b/test/C/src/concurrent/StopThreaded.lf index 3c00bff39f..f02e953111 100644 --- a/test/C/src/concurrent/StopThreaded.lf +++ b/test/C/src/concurrent/StopThreaded.lf @@ -18,22 +18,22 @@ reactor Consumer { reaction(in) {= tag_t current_tag = lf_tag(); if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) > 0) { - // The reaction should not have been called at tags larger than (10 - // msec, 9) - char time[255]; - lf_print_error_and_exit("Invoked reaction(in) at tag (%llu, %d) which is bigger than shutdown.", - current_tag.time - lf_time_start(), current_tag.microstep); + (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) > 0) { + // The reaction should not have been called at tags larger than (10 + // msec, 9) + char time[255]; + lf_print_error_and_exit("Invoked reaction(in) at tag (%llu, %d) which is bigger than shutdown.", + current_tag.time - lf_time_start(), current_tag.microstep); } else if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 8}) == 0) { - // Call lf_request_stop() at relative tag (10 msec, 8) - lf_print("Requesting stop."); - lf_request_stop(); + (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 8}) == 0) { + // Call lf_request_stop() at relative tag (10 msec, 8) + lf_print("Requesting stop."); + lf_request_stop(); } else if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) == 0) { - // Check that this reaction is indeed also triggered at (10 msec, 9) - // printf("Reaction invoked.\n"); - self->reaction_invoked_correctly = true; + (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) == 0) { + // Check that this reaction is indeed also triggered at (10 msec, 9) + // printf("Reaction invoked.\n"); + self->reaction_invoked_correctly = true; } =} @@ -42,17 +42,17 @@ reactor Consumer { lf_print("Shutdown invoked at tag (%lld, %u).", current_tag.time - lf_time_start(), current_tag.microstep); // Check to see if shutdown is called at relative tag (10 msec, 9) if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) == 0 && - self->reaction_invoked_correctly == true) { - lf_print("SUCCESS: successfully enforced stop."); + (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) == 0 && + self->reaction_invoked_correctly == true) { + lf_print("SUCCESS: successfully enforced stop."); } else if(lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) > 0) { - lf_print_error_and_exit("Shutdown invoked at tag (%llu, %d). Failed to enforce timeout.", - current_tag.time - lf_time_start(), current_tag.microstep); + (tag_t) { .time = MSEC(10) + lf_time_start(), .microstep = 9}) > 0) { + lf_print_error_and_exit("Shutdown invoked at tag (%llu, %d). Failed to enforce timeout.", + current_tag.time - lf_time_start(), current_tag.microstep); } else if (self->reaction_invoked_correctly == false) { - // Check to see if reactions were called correctly - lf_print_error_and_exit("Failed to invoke reaction(in) at tag (%llu, %d).", - current_tag.time - lf_time_start(), current_tag.microstep); + // Check to see if reactions were called correctly + lf_print_error_and_exit("Failed to invoke reaction(in) at tag (%llu, %d).", + current_tag.time - lf_time_start(), current_tag.microstep); } =} } diff --git a/test/C/src/concurrent/StopZeroThreaded.lf b/test/C/src/concurrent/StopZeroThreaded.lf index 80713d15ac..4b1b29b4e7 100644 --- a/test/C/src/concurrent/StopZeroThreaded.lf +++ b/test/C/src/concurrent/StopZeroThreaded.lf @@ -13,23 +13,23 @@ reactor Sender { reaction(t) -> out, act {= printf("Sending 42 at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_time_logical_elapsed(), + lf_tag().microstep); lf_set(out, 42); lf_schedule(act, 0); tag_t zero = (tag_t) { .time = lf_time_start(), .microstep = 0u }; tag_t one = (tag_t) { .time = lf_time_start(), .microstep = 1u }; if (lf_tag_compare(lf_tag(), zero) == 0) { - // Request stop at (0,0) - printf("Requesting stop at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - lf_request_stop(); + // Request stop at (0,0) + printf("Requesting stop at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + lf_request_stop(); } else if (lf_tag_compare(lf_tag(), one) > 0) { - fprintf(stderr, "ERROR: Reaction called after shutdown at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - exit(1); + fprintf(stderr, "ERROR: Reaction called after shutdown at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + exit(1); } =} @@ -37,28 +37,28 @@ reactor Sender { // Reaction should be invoked at (0,1) tag_t one = (tag_t) { .time = lf_time_start(), .microstep = 1u }; if (lf_tag_compare(lf_tag(), one) == 0) { - self->reaction_invoked_correctly = true; + self->reaction_invoked_correctly = true; } =} reaction(shutdown) {= if (lf_time_logical_elapsed() != USEC(0) || - lf_tag().microstep != 1) { - fprintf(stderr, "ERROR: Sender failed to stop the program in time. " - "Stopping at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - exit(1); + lf_tag().microstep != 1) { + fprintf(stderr, "ERROR: Sender failed to stop the program in time. " + "Stopping at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + exit(1); } else if (self->reaction_invoked_correctly == false) { - fprintf(stderr, "ERROR: Sender reaction(act) was not invoked. " - "Stopping at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - exit(1); + fprintf(stderr, "ERROR: Sender reaction(act) was not invoked. " + "Stopping at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + exit(1); } printf("SUCCESS: Successfully stopped the program at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_time_logical_elapsed(), + lf_tag().microstep); =} } @@ -67,16 +67,16 @@ reactor Receiver { reaction(in) {= printf("Received %d at (%lld, %u).\n", - in->value, - lf_time_logical_elapsed(), - lf_tag().microstep); + in->value, + lf_time_logical_elapsed(), + lf_tag().microstep); tag_t zero = (tag_t) { .time = lf_time_start(), .microstep = 0u }; if (lf_tag_compare(lf_tag(), zero) == 0) { - // Request stop at (0,0) - printf("Requesting stop at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - lf_request_stop(); + // Request stop at (0,0) + printf("Requesting stop at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + lf_request_stop(); } =} @@ -84,16 +84,16 @@ reactor Receiver { // Shutdown events must occur at (0, 1) on the // receiver. if (lf_time_logical_elapsed() != USEC(0) || - lf_tag().microstep != 1) { - fprintf(stderr, "ERROR: Receiver failed to stop the program in time. " - "Stopping at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - exit(1); + lf_tag().microstep != 1) { + fprintf(stderr, "ERROR: Receiver failed to stop the program in time. " + "Stopping at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + exit(1); } printf("SUCCESS: Successfully stopped the program at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_time_logical_elapsed(), + lf_tag().microstep); =} } diff --git a/test/C/src/concurrent/Threaded.lf b/test/C/src/concurrent/Threaded.lf index 0b5f20a79c..88a9acd6b6 100644 --- a/test/C/src/concurrent/Threaded.lf +++ b/test/C/src/concurrent/Threaded.lf @@ -31,7 +31,7 @@ reactor TakeTime { // nanosleep(&sleep_time, &remaining_time); int offset = 0; for (int i = 0; i < 100000000; i++) { - offset++; + offset++; } lf_set(out, in->value + offset); =} @@ -44,12 +44,12 @@ reactor Destination(width: int = 4) { reaction(in) {= int sum = 0; for (int i = 0; i < in_width; i++) { - sum += in[i]->value; + sum += in[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += in_width; =} @@ -59,6 +59,6 @@ main reactor(width: int = 4) { a = new Source() t = new[width] TakeTime() (a.out)+ -> t.in - b = new Destination(width = width) + b = new Destination(width=width) t.out -> b.in } diff --git a/test/C/src/concurrent/ThreadedMultiport.lf b/test/C/src/concurrent/ThreadedMultiport.lf index b6bb6fbe8a..6fce42f0e9 100644 --- a/test/C/src/concurrent/ThreadedMultiport.lf +++ b/test/C/src/concurrent/ThreadedMultiport.lf @@ -11,7 +11,7 @@ reactor Source(width: int = 4) { reaction(t) -> out {= for(int i = 0; i < out_width; i++) { - lf_set(out[i], self->s); + lf_set(out[i], self->s); } self->s++; =} @@ -27,7 +27,7 @@ reactor Computation(iterations: int = 100000000) { // nanosleep(&sleep_time, &remaining_time); int offset = 0; for (int i = 0; i < self->iterations; i++) { - offset++; + offset++; } lf_set(out, in->value + offset); =} @@ -41,29 +41,29 @@ reactor Destination(width: int = 4, iterations: int = 100000000) { int expected = self->iterations * self->width + self->s; int sum = 0; for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) sum += in[i]->value; + if (in[i]->is_present) sum += in[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != expected) { - printf("ERROR: Expected %d.\n", expected); - exit(1); + printf("ERROR: Expected %d.\n", expected); + exit(1); } self->s += self->width; =} reaction(shutdown) {= if (self->s == 0) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} } main reactor ThreadedMultiport(width: int = 4, iterations: int = 100000000) { - a = new Source(width = width) - t = new[width] Computation(iterations = iterations) - b = new Destination(width = width, iterations = iterations) + a = new Source(width=width) + t = new[width] Computation(iterations=iterations) + b = new Destination(width=width, iterations=iterations) a.out -> t.in t.out -> b.in } diff --git a/test/C/src/concurrent/ThreadedThreaded.lf b/test/C/src/concurrent/ThreadedThreaded.lf index b644256401..0b011b3118 100644 --- a/test/C/src/concurrent/ThreadedThreaded.lf +++ b/test/C/src/concurrent/ThreadedThreaded.lf @@ -31,7 +31,7 @@ reactor TakeTime { // nanosleep(&sleep_time, &remaining_time); int offset = 0; for (int i = 0; i < 100000000; i++) { - offset++; + offset++; } lf_set(out, in->value + offset); =} @@ -44,12 +44,12 @@ reactor Destination(width: int = 4) { reaction(in) {= int sum = 0; for (int i = 0; i < in_width; i++) { - sum += in[i]->value; + sum += in[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += in_width; =} @@ -59,6 +59,6 @@ main reactor ThreadedThreaded(width: int = 4) { a = new Source() t = new[width] TakeTime() (a.out)+ -> t.in - b = new Destination(width = width) + b = new Destination(width=width) t.out -> b.in } diff --git a/test/C/src/concurrent/TimeLimitThreaded.lf b/test/C/src/concurrent/TimeLimitThreaded.lf index e1a08b06ab..8ada5f42f5 100644 --- a/test/C/src/concurrent/TimeLimitThreaded.lf +++ b/test/C/src/concurrent/TimeLimitThreaded.lf @@ -23,8 +23,8 @@ reactor Destination { reaction(x) {= // printf("%d\n", x->value); if (x->value != self->s) { - printf("Error: Expected %d and got %d.\n", self->s, x->value); - exit(1); + printf("Error: Expected %d and got %d.\n", self->s, x->value); + exit(1); } self->s++; =} @@ -32,15 +32,15 @@ reactor Destination { reaction(shutdown) {= printf("**** shutdown reaction invoked.\n"); if (self->s != 12) { - fprintf(stderr, "ERROR: Expected 12 but got %d.\n", self->s); - exit(1); + fprintf(stderr, "ERROR: Expected 12 but got %d.\n", self->s); + exit(1); } =} } main reactor(period: time = 1 sec) { timer stop(10 sec) - c = new Clock(period = period) + c = new Clock(period=period) d = new Destination() c.y -> d.x diff --git a/test/C/src/concurrent/TimeoutThreaded.lf b/test/C/src/concurrent/TimeoutThreaded.lf index fe733bef56..0a8fc63d2a 100644 --- a/test/C/src/concurrent/TimeoutThreaded.lf +++ b/test/C/src/concurrent/TimeoutThreaded.lf @@ -16,13 +16,13 @@ reactor Consumer { reaction(in) {= tag_t current_tag = lf_tag(); if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(11) + lf_time_start(), .microstep = 0}) > 0) { - fprintf(stderr,"ERROR: Tag (%lld, %d) received. Failed to enforce timeout.\n", - current_tag.time, current_tag.microstep); - exit(1); + (tag_t) { .time = MSEC(11) + lf_time_start(), .microstep = 0}) > 0) { + fprintf(stderr,"ERROR: Tag (%lld, %d) received. Failed to enforce timeout.\n", + current_tag.time, current_tag.microstep); + exit(1); } else if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(11) + lf_time_start(), .microstep = 0}) == 0) { - self->success = true; // Successfully invoked the reaction at (timeout, 0) + (tag_t) { .time = MSEC(11) + lf_time_start(), .microstep = 0}) == 0) { + self->success = true; // Successfully invoked the reaction at (timeout, 0) } =} @@ -30,13 +30,13 @@ reactor Consumer { tag_t current_tag = lf_tag(); printf("Shutdown invoked at tag (%lld, %u).\n", current_tag.time - lf_time_start(), current_tag.microstep); if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(11) + lf_time_start(), .microstep = 0}) == 0 && - self->success == true) { - printf("SUCCESS: successfully enforced timeout.\n"); + (tag_t) { .time = MSEC(11) + lf_time_start(), .microstep = 0}) == 0 && + self->success == true) { + printf("SUCCESS: successfully enforced timeout.\n"); } else { - fprintf(stderr,"ERROR: Shutdown invoked at tag (%llu, %d). Failed to enforce timeout.\n", - current_tag.time - lf_time_start(), current_tag.microstep); - exit(1); + fprintf(stderr,"ERROR: Shutdown invoked at tag (%llu, %d). Failed to enforce timeout.\n", + current_tag.time - lf_time_start(), current_tag.microstep); + exit(1); } =} } diff --git a/test/C/src/concurrent/TimeoutZeroThreaded.lf b/test/C/src/concurrent/TimeoutZeroThreaded.lf index 5a33aa3c4c..301a144c84 100644 --- a/test/C/src/concurrent/TimeoutZeroThreaded.lf +++ b/test/C/src/concurrent/TimeoutZeroThreaded.lf @@ -17,13 +17,13 @@ reactor Consumer { reaction(in) {= tag_t current_tag = lf_tag(); if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(0) + lf_time_start(), .microstep = 0}) > 0) { - fprintf(stderr,"ERROR: Tag (%lld, %d) received. Failed to enforce timeout.\n", - current_tag.time - lf_time_start(), current_tag.microstep); - exit(1); + (tag_t) { .time = MSEC(0) + lf_time_start(), .microstep = 0}) > 0) { + fprintf(stderr,"ERROR: Tag (%lld, %d) received. Failed to enforce timeout.\n", + current_tag.time - lf_time_start(), current_tag.microstep); + exit(1); } else if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(0) + lf_time_start(), .microstep = 0}) == 0) { - self->success = true; // Successfully invoked the reaction at (timeout, 0) + (tag_t) { .time = MSEC(0) + lf_time_start(), .microstep = 0}) == 0) { + self->success = true; // Successfully invoked the reaction at (timeout, 0) } =} @@ -31,13 +31,13 @@ reactor Consumer { tag_t current_tag = lf_tag(); printf("Shutdown invoked at tag (%lld, %u).\n", current_tag.time - lf_time_start(), current_tag.microstep); if (lf_tag_compare(current_tag, - (tag_t) { .time = MSEC(0) + lf_time_start(), .microstep = 0}) == 0 && - self->success == true) { - printf("SUCCESS: successfully enforced timeout.\n"); + (tag_t) { .time = MSEC(0) + lf_time_start(), .microstep = 0}) == 0 && + self->success == true) { + printf("SUCCESS: successfully enforced timeout.\n"); } else { - fprintf(stderr,"ERROR: Shutdown invoked at tag (%llu, %d). Failed to enforce timeout.\n", - current_tag.time - lf_time_start(), current_tag.microstep); - exit(1); + fprintf(stderr,"ERROR: Shutdown invoked at tag (%llu, %d). Failed to enforce timeout.\n", + current_tag.time - lf_time_start(), current_tag.microstep); + exit(1); } =} } diff --git a/test/C/src/concurrent/Tracing.lf b/test/C/src/concurrent/Tracing.lf index b151896e23..983c9e737a 100644 --- a/test/C/src/concurrent/Tracing.lf +++ b/test/C/src/concurrent/Tracing.lf @@ -35,8 +35,8 @@ reactor TakeTime(bank_index: int = 0) { // Register the user trace event. if (!register_user_trace_event(self, self->event)) { - fprintf(stderr, "ERROR: Failed to register trace event.\n"); - exit(1); + fprintf(stderr, "ERROR: Failed to register trace event.\n"); + exit(1); } =} @@ -46,7 +46,7 @@ reactor TakeTime(bank_index: int = 0) { // nanosleep(&sleep_time, &remaining_time); int offset = 0; for (int i = 0; i < 100000000; i++) { - offset++; + offset++; } tracepoint_user_event(self, self->event); lf_set(out, in->value + offset); @@ -68,8 +68,8 @@ reactor Destination(width: int = 4) { reaction(startup) {= // Register the user value event. if (!register_user_trace_event(self, "Number of Destination invocations")) { - fprintf(stderr, "ERROR: Failed to register trace event.\n"); - exit(1); + fprintf(stderr, "ERROR: Failed to register trace event.\n"); + exit(1); } =} @@ -78,12 +78,12 @@ reactor Destination(width: int = 4) { tracepoint_user_value(self, "Number of Destination invocations", self->count); int sum = 0; for (int i = 0; i < in_width; i++) { - sum += in[i]->value; + sum += in[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += in_width; =} @@ -93,6 +93,6 @@ main reactor(width: int = 4) { a = new Source() t = new[width] TakeTime() (a.out)+ -> t.in - b = new Destination(width = width) + b = new Destination(width=width) t.out -> b.in } diff --git a/test/C/src/concurrent/Workers.lf b/test/C/src/concurrent/Workers.lf index 90dbecb468..369b6927ee 100644 --- a/test/C/src/concurrent/Workers.lf +++ b/test/C/src/concurrent/Workers.lf @@ -5,9 +5,9 @@ target C { main reactor { reaction(startup) {= if (NUMBER_OF_WORKERS != 16) { - lf_print_error_and_exit("Expected to have 16 workers."); + lf_print_error_and_exit("Expected to have 16 workers."); } else { - lf_print("Using 16 workers."); + lf_print("Using 16 workers."); } =} } diff --git a/test/C/src/concurrent/failing/Watchdog.lf b/test/C/src/concurrent/failing/Watchdog.lf index 93e0d2c4df..e38d98b045 100644 --- a/test/C/src/concurrent/failing/Watchdog.lf +++ b/test/C/src/concurrent/failing/Watchdog.lf @@ -17,29 +17,29 @@ reactor Watcher(timeout: time = 1500 ms) { state count: int = 0 watchdog poodle(timeout) {= - instant_t p = lf_time_physical_elapsed(); - lf_print("******** Watchdog timed out at elapsed physical time: " PRINTF_TIME, p); - self->count++; + instant_t p = lf_time_physical_elapsed(); + lf_print("******** Watchdog timed out at elapsed physical time: " PRINTF_TIME, p); + self->count++; =} reaction(t) -> poodle, d {= - lf_watchdog_start(poodle, 0); - lf_print("Watchdog started at physical time " PRINTF_TIME, lf_time_physical_elapsed()); - lf_print("Will expire at " PRINTF_TIME, lf_time_logical_elapsed() + self->timeout); - lf_set(d, 42); + lf_watchdog_start(poodle, 0); + lf_print("Watchdog started at physical time " PRINTF_TIME, lf_time_physical_elapsed()); + lf_print("Will expire at " PRINTF_TIME, lf_time_logical_elapsed() + self->timeout); + lf_set(d, 42); =} reaction(poodle) -> d {= - lf_print("Reaction poodle was called."); - lf_set(d, 1); + lf_print("Reaction poodle was called."); + lf_set(d, 1); =} reaction(shutdown) -> poodle {= - lf_watchdog_stop(poodle); - // Watchdog may expire in tests even without the sleep, but it should at least expire twice. - if (self->count < 2) { - lf_print_error_and_exit("Watchdog expired %d times. Expected at least 2.", self->count); - } + lf_watchdog_stop(poodle); + // Watchdog may expire in tests even without the sleep, but it should at least expire twice. + if (self->count < 2) { + lf_print_error_and_exit("Watchdog expired %d times. Expected at least 2.", self->count); + } =} } @@ -50,17 +50,17 @@ main reactor { w = new Watcher() reaction(w.d) {= - lf_print("Watcher reactor produced an output. %d", self->count % 2); - self->count++; - if (self->count % 4 == 0) { - lf_print(">>>>>> Taking a long time to process that output!"); - lf_sleep(MSEC(1600)); - } + lf_print("Watcher reactor produced an output. %d", self->count % 2); + self->count++; + if (self->count % 4 == 0) { + lf_print(">>>>>> Taking a long time to process that output!"); + lf_sleep(MSEC(1600)); + } =} reaction(shutdown) {= - if (self->count < 12) { - lf_print_error_and_exit("Watchdog produced output %d times. Expected at least 12.", self->count); - } + if (self->count < 12) { + lf_print_error_and_exit("Watchdog produced output %d times. Expected at least 12.", self->count); + } =} } diff --git a/test/C/src/federated/BroadcastFeedback.lf b/test/C/src/federated/BroadcastFeedback.lf index b1fa201ed5..179d49edc7 100644 --- a/test/C/src/federated/BroadcastFeedback.lf +++ b/test/C/src/federated/BroadcastFeedback.lf @@ -13,14 +13,14 @@ reactor SenderAndReceiver { reaction(in) {= if (in[0]->is_present && in[1]->is_present && in[0]->value == 42 && in[1]->value == 42) { - lf_print("SUCCESS"); - self->received = true; + lf_print("SUCCESS"); + self->received = true; } =} reaction(shutdown) {= if (!self->received == true) { - lf_print_error_and_exit("Failed to receive broadcast"); + lf_print_error_and_exit("Failed to receive broadcast"); } =} } diff --git a/test/C/src/federated/BroadcastFeedbackWithHierarchy.lf b/test/C/src/federated/BroadcastFeedbackWithHierarchy.lf index fe269ce401..9896c1fdf8 100644 --- a/test/C/src/federated/BroadcastFeedbackWithHierarchy.lf +++ b/test/C/src/federated/BroadcastFeedbackWithHierarchy.lf @@ -20,14 +20,14 @@ reactor Receiver { reaction(in) {= if (in[0]->is_present && in[1]->is_present && in[0]->value == 42 && in[1]->value == 42) { - lf_print("SUCCESS"); - self->received = true; + lf_print("SUCCESS"); + self->received = true; } =} reaction(shutdown) {= if (!self->received == true) { - lf_print_error_and_exit("Failed to receive broadcast"); + lf_print_error_and_exit("Failed to receive broadcast"); } =} } diff --git a/test/C/src/federated/ChainWithDelay.lf b/test/C/src/federated/ChainWithDelay.lf index c0a4c6a2a9..dea606bf51 100644 --- a/test/C/src/federated/ChainWithDelay.lf +++ b/test/C/src/federated/ChainWithDelay.lf @@ -14,7 +14,7 @@ import TestCount from "../lib/TestCount.lf" federated reactor { c = new Count(period = 1 msec) i = new InternalDelay(delay = 500 usec) - t = new TestCount(num_inputs = 3) + t = new TestCount(num_inputs=3) c.out -> i.in i.out -> t.in } diff --git a/test/C/src/federated/CycleDetection.lf b/test/C/src/federated/CycleDetection.lf index 5e6b3b868d..175d03fa02 100644 --- a/test/C/src/federated/CycleDetection.lf +++ b/test/C/src/federated/CycleDetection.lf @@ -16,10 +16,10 @@ reactor CAReplica { reaction(local_update, remote_update) {= if (local_update->is_present) { - self->balance += local_update->value; + self->balance += local_update->value; } if (remote_update->is_present) { - self->balance += remote_update->value; + self->balance += remote_update->value; } =} @@ -34,7 +34,7 @@ reactor UserInput { reaction(balance) {= if (balance->value != 200) { - lf_print_error_and_exit("Did not receive the expected balance. Expected: 200. Got: %d.", balance->value); + lf_print_error_and_exit("Did not receive the expected balance. Expected: 200. Got: %d.", balance->value); } lf_print("Balance: %d", balance->value); lf_request_stop(); diff --git a/test/C/src/federated/DecentralizedP2PComm.lf b/test/C/src/federated/DecentralizedP2PComm.lf index bb96cb32d2..63163bd98b 100644 --- a/test/C/src/federated/DecentralizedP2PComm.lf +++ b/test/C/src/federated/DecentralizedP2PComm.lf @@ -17,32 +17,32 @@ reactor Platform(start: int = 0, expected_start: int = 0, stp_offset_param: time reaction(in) {= lf_print("Received %d.", in->value); if (in->value != self->expected_start++) { - lf_print_error_and_exit("Expected %d but got %d.", - self->expected_start - 1, - in->value - ); + lf_print_error_and_exit("Expected %d but got %d.", + self->expected_start - 1, + in->value + ); } =} STP(stp_offset_param) {= lf_print("Received %d late.", in->value); tag_t current_tag = lf_tag(); self->expected_start++; lf_print_error("STP offset was violated by (%lld, %u).", - current_tag.time - in->intended_tag.time, - current_tag.microstep - in->intended_tag.microstep + current_tag.time - in->intended_tag.time, + current_tag.microstep - in->intended_tag.microstep ); =} reaction(shutdown) {= lf_print("Shutdown invoked."); if (self->expected == self->expected_start) { - lf_print_error_and_exit("Did not receive anything."); + lf_print_error_and_exit("Did not receive anything."); } =} } federated reactor DecentralizedP2PComm { - a = new Platform(expected_start = 100, stp_offset_param = 10 msec) - b = new Platform(start = 100, stp_offset_param = 10 msec) + a = new Platform(expected_start=100, stp_offset_param = 10 msec) + b = new Platform(start=100, stp_offset_param = 10 msec) a.out -> b.in b.out -> a.in } diff --git a/test/C/src/federated/DecentralizedP2PUnbalancedTimeout.lf b/test/C/src/federated/DecentralizedP2PUnbalancedTimeout.lf index d6a372d56b..0ebed39189 100644 --- a/test/C/src/federated/DecentralizedP2PUnbalancedTimeout.lf +++ b/test/C/src/federated/DecentralizedP2PUnbalancedTimeout.lf @@ -32,9 +32,9 @@ reactor Destination { lf_print("Received %d", x->value); tag_t current_tag = lf_tag(); if (x->value != self->s) { - lf_print_error_and_exit("At tag (%lld, %u) expected %d and got %d.", - current_tag.time - lf_time_start(), current_tag.microstep, self->s, x->value - ); + lf_print_error_and_exit("At tag (%lld, %u) expected %d and got %d.", + current_tag.time - lf_time_start(), current_tag.microstep, self->s, x->value + ); } self->s++; =} @@ -46,7 +46,7 @@ reactor Destination { } federated reactor(period: time = 10 usec) { - c = new Clock(period = period) + c = new Clock(period=period) d = new Destination() c.y -> d.x } diff --git a/test/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf b/test/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf index bb3b6544c0..356222a266 100644 --- a/test/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf +++ b/test/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf @@ -32,7 +32,7 @@ reactor Destination { reaction(x) {= // printf("%d\n", x->value); if (x->value != self->s) { - lf_print_error_and_exit("Expected %d and got %d.", self->s, x->value); + lf_print_error_and_exit("Expected %d and got %d.", self->s, x->value); } self->s++; =} @@ -44,7 +44,7 @@ reactor Destination { } federated reactor(period: time = 10 usec) { - c = new Clock(period = period) + c = new Clock(period=period) d = new Destination() c.y ~> d.x } diff --git a/test/C/src/federated/DistributedBank.lf b/test/C/src/federated/DistributedBank.lf index 85bc8875b7..130ae95961 100644 --- a/test/C/src/federated/DistributedBank.lf +++ b/test/C/src/federated/DistributedBank.lf @@ -12,7 +12,7 @@ reactor Node { reaction(shutdown) {= if (self->count == 0) { - lf_print_error_and_exit("Timer reactions did not execute."); + lf_print_error_and_exit("Timer reactions did not execute."); } =} } diff --git a/test/C/src/federated/DistributedBankToMultiport.lf b/test/C/src/federated/DistributedBankToMultiport.lf index fdc1b67b84..d73b0959fd 100644 --- a/test/C/src/federated/DistributedBankToMultiport.lf +++ b/test/C/src/federated/DistributedBankToMultiport.lf @@ -11,17 +11,17 @@ reactor Destination { reaction(in) {= for (int i = 0; i < in_width; i++) { - lf_print("Received %d.", in[i]->value); - if (self->count != in[i]->value) { - lf_print_error_and_exit("Expected %d.", self->count); - } + lf_print("Received %d.", in[i]->value); + if (self->count != in[i]->value) { + lf_print_error_and_exit("Expected %d.", self->count); + } } self->count++; =} reaction(shutdown) {= if (self->count == 0) { - lf_print_error_and_exit("No data received."); + lf_print_error_and_exit("No data received."); } =} } diff --git a/test/C/src/federated/DistributedCount.lf b/test/C/src/federated/DistributedCount.lf index 9e1a1b2e93..d8be836430 100644 --- a/test/C/src/federated/DistributedCount.lf +++ b/test/C/src/federated/DistributedCount.lf @@ -19,17 +19,17 @@ reactor Print { 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); + lf_print_error_and_exit("Expected to receive %d.", self->c); } if (elapsed_time != MSEC(200) + SEC(1) * (self->c - 1) ) { - lf_print_error_and_exit("Expected received time to be %lld.", MSEC(200) * self->c); + lf_print_error_and_exit("Expected received time to be %lld.", MSEC(200) * self->c); } self->c++; =} reaction(shutdown) {= if (self->c != 6) { - lf_print_error_and_exit("Expected to receive 5 items."); + lf_print_error_and_exit("Expected to receive 5 items."); } =} } diff --git a/test/C/src/federated/DistributedCountDecentralized.lf b/test/C/src/federated/DistributedCountDecentralized.lf index 0b99861269..78eb8f2435 100644 --- a/test/C/src/federated/DistributedCountDecentralized.lf +++ b/test/C/src/federated/DistributedCountDecentralized.lf @@ -18,27 +18,27 @@ reactor Print { reaction(in) {= interval_t elapsed_time = lf_time_logical_elapsed(); printf("At tag (%lld, %u), received %d. " - "The original intended tag of the message was (%lld, %u).\n", - (long long int)elapsed_time, - lf_tag().microstep, - in->value, - (long long int)(in->intended_tag.time - lf_time_start()), - in->intended_tag.microstep); + "The original intended tag of the message was (%lld, %u).\n", + (long long int)elapsed_time, + lf_tag().microstep, + in->value, + (long long int)(in->intended_tag.time - lf_time_start()), + in->intended_tag.microstep); if (in->value != self->c) { - printf("Expected to receive %d.\n", self->c); - exit(1); + printf("Expected to receive %d.\n", self->c); + exit(1); } if (elapsed_time != MSEC(200) + SEC(1) * (self->c - 1)) { - printf("Expected received time to be %lld.\n", MSEC(200) * self->c); - exit(3); + printf("Expected received time to be %lld.\n", MSEC(200) * self->c); + exit(3); } self->c++; =} reaction(shutdown) {= if (self->c != 6) { - fprintf(stderr, "Expected to receive 5 items.\n"); - exit(2); + fprintf(stderr, "Expected to receive 5 items.\n"); + exit(2); } printf("SUCCESS: Successfully received 5 items.\n"); =} diff --git a/test/C/src/federated/DistributedCountDecentralizedLate.lf b/test/C/src/federated/DistributedCountDecentralizedLate.lf index d08edbdb52..56d64004c6 100644 --- a/test/C/src/federated/DistributedCountDecentralizedLate.lf +++ b/test/C/src/federated/DistributedCountDecentralizedLate.lf @@ -24,22 +24,22 @@ reactor Print { reaction(in) {= tag_t current_tag = lf_tag(); printf("At tag (%lld, %u) received %d. Intended tag is (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep, - in->value, - in->intended_tag.time - lf_time_start(), - in->intended_tag.microstep); + lf_time_logical_elapsed(), + lf_tag().microstep, + in->value, + in->intended_tag.time - lf_time_start(), + in->intended_tag.microstep); if (lf_tag_compare((tag_t){.time=current_tag.time - lf_time_start(), .microstep=current_tag.microstep}, - (tag_t){.time=SEC(1) * self->c, .microstep=0}) == 0) { - self->success++; // Message was on-time + (tag_t){.time=SEC(1) * self->c, .microstep=0}) == 0) { + self->success++; // Message was on-time } self->c++; =} STP(0) {= tag_t current_tag = lf_tag(); printf("At tag (%lld, %u), message has violated the STP offset by (%lld, %u).\n", - current_tag.time - lf_time_start(), current_tag.microstep, - current_tag.time - in->intended_tag.time, - current_tag.microstep - in->intended_tag.microstep); + current_tag.time - lf_time_start(), current_tag.microstep, + current_tag.time - in->intended_tag.time, + current_tag.microstep - in->intended_tag.microstep); self->success_stp_violation++; self->c++; =} @@ -50,10 +50,10 @@ reactor Print { reaction(shutdown) {= if ((self->success + self->success_stp_violation) != 5) { - fprintf(stderr, "Failed to detect STP violations in messages.\n"); - exit(1); + fprintf(stderr, "Failed to detect STP violations in messages.\n"); + exit(1); } else { - printf("Successfully detected STP violation (%d violations, %d on-time).\n", self->success_stp_violation, self->success); + printf("Successfully detected STP violation (%d violations, %d on-time).\n", self->success_stp_violation, self->success); } =} } diff --git a/test/C/src/federated/DistributedCountDecentralizedLateHierarchy.lf b/test/C/src/federated/DistributedCountDecentralizedLateHierarchy.lf index baf267ca74..cd9f8097aa 100644 --- a/test/C/src/federated/DistributedCountDecentralizedLateHierarchy.lf +++ b/test/C/src/federated/DistributedCountDecentralizedLateHierarchy.lf @@ -24,21 +24,21 @@ reactor ImportantActuator { reaction(in) {= tag_t current_tag = lf_tag(); printf("At tag (%lld, %u) received %d. Intended tag is (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep, - in->value, - in->intended_tag.time - lf_time_start(), - in->intended_tag.microstep); + lf_time_logical_elapsed(), + lf_tag().microstep, + in->value, + in->intended_tag.time - lf_time_start(), + in->intended_tag.microstep); if (lf_tag_compare((tag_t){.time=current_tag.time - lf_time_start(), .microstep=current_tag.microstep}, - (tag_t){.time=SEC(1) * self->c, .microstep=0}) == 0) { - self->success++; // Message was on-time + (tag_t){.time=SEC(1) * self->c, .microstep=0}) == 0) { + self->success++; // Message was on-time } self->c++; =} STP(0) {= tag_t current_tag = lf_tag(); printf("Message violated STP offset by (%lld, %u).\n", - current_tag.time - in->intended_tag.time, - current_tag.microstep - in->intended_tag.microstep); + current_tag.time - in->intended_tag.time, + current_tag.microstep - in->intended_tag.microstep); self->success_stp_violation++; self->c++; =} @@ -49,10 +49,10 @@ reactor ImportantActuator { reaction(shutdown) {= if ((self->success + self->success_stp_violation) != 5) { - fprintf(stderr, "Failed to detect STP violations in messages.\n"); - exit(1); + fprintf(stderr, "Failed to detect STP violations in messages.\n"); + exit(1); } else { - printf("Successfully detected STP violations (%d violations, %d on-time).\n", self->success_stp_violation, self->success); + printf("Successfully detected STP violations (%d violations, %d on-time).\n", self->success_stp_violation, self->success); } =} } @@ -63,11 +63,11 @@ reactor Print { reaction(in) {= tag_t current_tag = lf_tag(); printf("At tag (%lld, %u) received %d. Intended tag is (%lld, %u).\n", - current_tag.time - lf_time_start(), - current_tag.microstep, - in->value, - in->intended_tag.time - lf_time_start(), - in->intended_tag.microstep); + current_tag.time - lf_time_start(), + current_tag.microstep, + in->value, + in->intended_tag.time - lf_time_start(), + in->intended_tag.microstep); =} } diff --git a/test/C/src/federated/DistributedCountPhysical.lf b/test/C/src/federated/DistributedCountPhysical.lf index 9baa1dd1cc..e678c3fee4 100644 --- a/test/C/src/federated/DistributedCountPhysical.lf +++ b/test/C/src/federated/DistributedCountPhysical.lf @@ -30,21 +30,21 @@ reactor Print { interval_t elapsed_time = lf_time_logical_elapsed(); printf("At time %lld, received %d.\n", elapsed_time, in->value); if (in->value != self->c) { - fprintf(stderr, "ERROR: Expected to receive %d.\n", self->c); - exit(1); + fprintf(stderr, "ERROR: Expected to receive %d.\n", self->c); + exit(1); } if (!(elapsed_time > (SEC(1) * self->c) + MSEC(200))) { - fprintf(stderr, "ERROR: Expected received time to be strictly greater than %lld. " - "Got %lld.\n", MSEC(200) * self->c, elapsed_time); - exit(3); + fprintf(stderr, "ERROR: Expected received time to be strictly greater than %lld. " + "Got %lld.\n", MSEC(200) * self->c, elapsed_time); + exit(3); } self->c++; =} reaction(shutdown) {= if (self->c != 1) { - fprintf(stderr, "ERROR: Expected to receive 1 item. Received %d.\n", self->c); - exit(2); + fprintf(stderr, "ERROR: Expected to receive 1 item. Received %d.\n", self->c); + exit(2); } printf("SUCCESS: Successfully received 1 item.\n"); =} diff --git a/test/C/src/federated/DistributedCountPhysicalAfterDelay.lf b/test/C/src/federated/DistributedCountPhysicalAfterDelay.lf index 9eb2a1acff..d34f16a6d4 100644 --- a/test/C/src/federated/DistributedCountPhysicalAfterDelay.lf +++ b/test/C/src/federated/DistributedCountPhysicalAfterDelay.lf @@ -18,14 +18,14 @@ reactor Print { interval_t elapsed_time = lf_time_logical_elapsed(); printf("At time " PRINTF_TIME ", received %d.\n", elapsed_time, in->value); if (in->value != self->c) { - fprintf(stderr, "ERROR: Expected to receive %d.\n", self->c); - exit(1); + fprintf(stderr, "ERROR: Expected to receive %d.\n", self->c); + exit(1); } if (!(elapsed_time > MSEC(600))) { - fprintf(stderr, "ERROR: Expected received time to be strictly greater than " - PRINTF_TIME ".\n", MSEC(600) - ); - exit(3); + fprintf(stderr, "ERROR: Expected received time to be strictly greater than " + PRINTF_TIME ".\n", MSEC(600) + ); + exit(3); } self->c++; lf_request_stop(); @@ -33,18 +33,18 @@ reactor Print { reaction(shutdown) {= if (self->c != 2) { - fprintf( - stderr, "ERROR: Expected to receive 1 item. Received %d.\n", - self->c - 1 - ); - exit(2); + fprintf( + stderr, "ERROR: Expected to receive 1 item. Received %d.\n", + self->c - 1 + ); + exit(2); } printf("SUCCESS: Successfully received 1 item.\n"); =} } federated reactor at localhost { - c = new Count(offset = 200 msec, period = 0) + c = new Count(offset = 200 msec, period=0) p = new Print() c.out ~> p.in after 400 msec // Indicating a 'physical' connection with a 400 msec after delay. } diff --git a/test/C/src/federated/DistributedCountPhysicalDecentralized.lf b/test/C/src/federated/DistributedCountPhysicalDecentralized.lf index 581d0f9670..f9da77b2c7 100644 --- a/test/C/src/federated/DistributedCountPhysicalDecentralized.lf +++ b/test/C/src/federated/DistributedCountPhysicalDecentralized.lf @@ -30,21 +30,21 @@ reactor Print { reaction(in) {= interval_t elapsed_time = lf_time_logical_elapsed(); printf("At time %lld, received %d.\n", elapsed_time, in->value); - if (in->value != self->c) { - fprintf(stderr, "ERROR: Expected to receive %d.\n", self->c); - exit(1); + if (in->value != self->c) { + fprintf(stderr, "ERROR: Expected to receive %d.\n", self->c); + exit(1); } if (!(elapsed_time > (SEC(1) * self->c) + MSEC(200))) { - fprintf(stderr, "ERROR: Expected received time to be strictly greater than %lld.\n", MSEC(200) * self->c); - exit(3); + fprintf(stderr, "ERROR: Expected received time to be strictly greater than %lld.\n", MSEC(200) * self->c); + exit(3); } self->c++; =} reaction(shutdown) {= if (self->c != 1) { - fprintf(stderr, "ERROR: Expected to receive 1 item. Received %d.\n", self->c); - exit(2); + fprintf(stderr, "ERROR: Expected to receive 1 item. Received %d.\n", self->c); + exit(2); } printf("SUCCESS: Successfully received 1 item.\n"); =} diff --git a/test/C/src/federated/DistributedDoublePort.lf b/test/C/src/federated/DistributedDoublePort.lf index e478f8c596..5885d20a7e 100644 --- a/test/C/src/federated/DistributedDoublePort.lf +++ b/test/C/src/federated/DistributedDoublePort.lf @@ -31,7 +31,7 @@ reactor Print { interval_t elapsed_time = lf_time_logical_elapsed(); lf_print("At tag (%lld, %u), received in = %d and in2 = %d.", elapsed_time, lf_tag().microstep, in->value, in2->value); if (in->is_present && in2->is_present) { - lf_print_error_and_exit("ERROR: invalid logical simultaneity."); + lf_print_error_and_exit("ERROR: invalid logical simultaneity."); } =} diff --git a/test/C/src/federated/DistributedLogicalActionUpstreamLong.lf b/test/C/src/federated/DistributedLogicalActionUpstreamLong.lf index 3205c466c2..50e8951847 100644 --- a/test/C/src/federated/DistributedLogicalActionUpstreamLong.lf +++ b/test/C/src/federated/DistributedLogicalActionUpstreamLong.lf @@ -23,7 +23,7 @@ reactor WithLogicalAction { federated reactor { a = new WithLogicalAction() - test = new TestCount(num_inputs = 21) + test = new TestCount(num_inputs=21) passThroughs1 = new PassThrough() passThroughs2 = new PassThrough() diff --git a/test/C/src/federated/DistributedLoopedAction.lf b/test/C/src/federated/DistributedLoopedAction.lf index db26c1b462..d4b54c569a 100644 --- a/test/C/src/federated/DistributedLoopedAction.lf +++ b/test/C/src/federated/DistributedLoopedAction.lf @@ -19,23 +19,23 @@ reactor Receiver(take_a_break_after: int = 10, break_interval: time = 400 msec) // but forces the logical time to advance Comment this line for a more sensible log output. reaction(in) {= printf("At tag (%lld, %u) received value %d.\n", - lf_time_logical_elapsed(), - lf_tag().microstep, - in->value); + lf_time_logical_elapsed(), + lf_tag().microstep, + in->value); self->total_received_messages++; if (in->value != self->received_messages++) { - fprintf(stderr,"ERROR: received messages out of order.\n"); - // exit(1); + fprintf(stderr,"ERROR: received messages out of order.\n"); + // exit(1); } if (lf_time_logical_elapsed() != self->breaks * self->break_interval) { - fprintf(stderr,"ERROR: received messages at an incorrect time: %lld.\n", lf_time_logical_elapsed()); - // exit(2); + fprintf(stderr,"ERROR: received messages at an incorrect time: %lld.\n", lf_time_logical_elapsed()); + // exit(2); } if (self->received_messages == self->take_a_break_after) { - // Sender is taking a break; - self->breaks++; - self->received_messages = 0; + // Sender is taking a break; + self->breaks++; + self->received_messages = 0; } =} @@ -45,10 +45,10 @@ reactor Receiver(take_a_break_after: int = 10, break_interval: time = 400 msec) reaction(shutdown) {= if (self->breaks != 3 || - (self->total_received_messages != ((SEC(1)/self->break_interval)+1) * self->take_a_break_after) + (self->total_received_messages != ((SEC(1)/self->break_interval)+1) * self->take_a_break_after) ) { - fprintf(stderr,"ERROR: test failed.\n"); - exit(4); + fprintf(stderr,"ERROR: test failed.\n"); + exit(4); } printf("SUCCESS: Successfully received all messages from the sender.\n"); =} diff --git a/test/C/src/federated/DistributedLoopedActionDecentralized.lf b/test/C/src/federated/DistributedLoopedActionDecentralized.lf index 0d364f026d..3a639914ea 100644 --- a/test/C/src/federated/DistributedLoopedActionDecentralized.lf +++ b/test/C/src/federated/DistributedLoopedActionDecentralized.lf @@ -27,61 +27,60 @@ reactor Receiver(take_a_break_after: int = 10, break_interval: time = 400 msec) reaction(in) {= tag_t current_tag = lf_tag(); lf_print("At tag (%lld, %u) received value %d with STP violation (%lld, %u).", - current_tag.time - lf_time_start(), - current_tag.microstep, - in->value, - current_tag.time - in->intended_tag.time, - current_tag.microstep - in->intended_tag.microstep + current_tag.time - lf_time_start(), + current_tag.microstep, + in->value, + current_tag.time - in->intended_tag.time, + current_tag.microstep - in->intended_tag.microstep ); self->total_received_messages++; if (in->value != lf_tag().microstep) { - lf_print_warning("Received incorrect value %d. Expected %d.", in->value, lf_tag().microstep); - // exit(1); // The receiver should tolerate this type of error - // in this test because messages on the network can - // arrive late. Note that with an accurate STP offset, - // this type of error should be extremely rare. + lf_print_warning("Received incorrect value %d. Expected %d.", in->value, lf_tag().microstep); + // exit(1); // The receiver should tolerate this type of error + // in this test because messages on the network can + // arrive late. Note that with an accurate STP offset, + // this type of error should be extremely rare. } if (in->value != self->received_messages) { - lf_print_warning("Skipped expected value %d. Received value %d.", self->received_messages, in->value); - self->received_messages = in->value; - // exit(1); // The receiver should tolerate this type of error - // in this test because multiple messages arriving - // at a given tag (t, m) can overwrite each other. - // Because messages arrive in order, only the last - // value that is received on the port at a given tag - // can be observed. Note that with an accurate STP - // offset, this type of error should be extremely - // rare. - // FIXME: Messages should not be dropped or - // overwritten. + lf_print_warning("Skipped expected value %d. Received value %d.", self->received_messages, in->value); + self->received_messages = in->value; + // exit(1); // The receiver should tolerate this type of error + // in this test because multiple messages arriving + // at a given tag (t, m) can overwrite each other. + // Because messages arrive in order, only the last + // value that is received on the port at a given tag + // can be observed. Note that with an accurate STP + // offset, this type of error should be extremely + // rare. + // FIXME: Messages should not be dropped or + // overwritten. } self->received_messages++; if (self->received_messages == self->take_a_break_after) { - // Sender is taking a break; - self->breaks++; - self->received_messages = 0; + // Sender is taking a break; + self->breaks++; + self->received_messages = 0; } =} reaction(shutdown) {= if (self->breaks != 3 || - (self->total_received_messages != ((SEC(1)/self->break_interval)+1) * self->take_a_break_after) + (self->total_received_messages != ((SEC(1)/self->break_interval)+1) * self->take_a_break_after) ) { - lf_print_error_and_exit("Test failed. Breaks: %d, Messages: %d.", self->breaks, self->total_received_messages); + lf_print_error_and_exit("Test failed. Breaks: %d, Messages: %d.", self->breaks, self->total_received_messages); } lf_print("SUCCESS: Successfully received all messages from the sender. Breaks: %d, Messages: %d.", self->breaks, self->total_received_messages); =} } reactor STPReceiver( - take_a_break_after: int = 10, - break_interval: time = 400 msec, - stp_offset: time = 0 -) { + take_a_break_after: int = 10, + break_interval: time = 400 msec, + stp_offset: time = 0) { input in: int state last_time_updated_stp: time = 0 - receiver = new Receiver(take_a_break_after = 10, break_interval = 400 msec) + receiver = new Receiver(take_a_break_after=10, break_interval = 400 msec) timer t(0, 1 msec) // Force advancement of logical time reaction(in) -> receiver.in {= @@ -91,16 +90,16 @@ reactor STPReceiver( lf_print("Received %d late.", in->value); tag_t current_tag = lf_tag(); lf_print("STP violation of (%lld, %u) perceived on the input.", - current_tag.time - in->intended_tag.time, - current_tag.microstep - in->intended_tag.microstep); + current_tag.time - in->intended_tag.time, + current_tag.microstep - in->intended_tag.microstep); lf_set(receiver.in, in->value); // Only update the STP offset once per // time step. if (current_tag.time != self->last_time_updated_stp) { - lf_print("Raising the STP offset by %lld.", MSEC(10)); - self->stp_offset += MSEC(10); - lf_set_stp_offset(MSEC(10)); - self->last_time_updated_stp = current_tag.time; + lf_print("Raising the STP offset by %lld.", MSEC(10)); + self->stp_offset += MSEC(10); + lf_set_stp_offset(MSEC(10)); + self->last_time_updated_stp = current_tag.time; } =} @@ -110,8 +109,8 @@ reactor STPReceiver( } federated reactor DistributedLoopedActionDecentralized { - sender = new Sender(take_a_break_after = 10, break_interval = 400 msec) - stpReceiver = new STPReceiver(take_a_break_after = 10, break_interval = 400 msec) + sender = new Sender(take_a_break_after=10, break_interval = 400 msec) + stpReceiver = new STPReceiver(take_a_break_after=10, break_interval = 400 msec) sender.out -> stpReceiver.in } diff --git a/test/C/src/federated/DistributedLoopedPhysicalAction.lf b/test/C/src/federated/DistributedLoopedPhysicalAction.lf index ace74a219f..226dee1370 100644 --- a/test/C/src/federated/DistributedLoopedPhysicalAction.lf +++ b/test/C/src/federated/DistributedLoopedPhysicalAction.lf @@ -26,11 +26,11 @@ reactor Sender(take_a_break_after: int = 10, break_interval: time = 550 msec) { lf_set(out, self->sent_messages); self->sent_messages++; if (self->sent_messages < self->take_a_break_after) { - lf_schedule(act, 0); + lf_schedule(act, 0); } else { - // Take a break - self->sent_messages = 0; - lf_schedule(act, self->break_interval); + // Take a break + self->sent_messages = 0; + lf_schedule(act, self->break_interval); } =} } @@ -46,18 +46,18 @@ reactor Receiver(take_a_break_after: int = 10, break_interval: time = 550 msec) reaction(in) {= tag_t current_tag = lf_tag(); lf_print("At tag (%lld, %u) received %d.", - current_tag.time - lf_time_start(), - current_tag.microstep, - in->value); + current_tag.time - lf_time_start(), + current_tag.microstep, + in->value); self->total_received_messages++; if (in->value != self->received_messages++) { - lf_print_error_and_exit("Expected %d.", self->received_messages - 1); + lf_print_error_and_exit("Expected %d.", self->received_messages - 1); } if (self->received_messages == self->take_a_break_after) { - // Sender is taking a break; - self->breaks++; - self->received_messages = 0; + // Sender is taking a break; + self->breaks++; + self->received_messages = 0; } =} @@ -67,9 +67,9 @@ reactor Receiver(take_a_break_after: int = 10, break_interval: time = 550 msec) reaction(shutdown) {= if (self->breaks != 2 || - (self->total_received_messages != ((SEC(1)/self->break_interval)+1) * self->take_a_break_after) + (self->total_received_messages != ((SEC(1)/self->break_interval)+1) * self->take_a_break_after) ) { - lf_print_error_and_exit("Test failed. Breaks: %d, Messages: %d.", self->breaks, self->total_received_messages); + lf_print_error_and_exit("Test failed. Breaks: %d, Messages: %d.", self->breaks, self->total_received_messages); } lf_print("SUCCESS: Successfully received all messages from the sender."); =} diff --git a/test/C/src/federated/DistributedMultiport.lf b/test/C/src/federated/DistributedMultiport.lf index 7590710339..f17c7311c2 100644 --- a/test/C/src/federated/DistributedMultiport.lf +++ b/test/C/src/federated/DistributedMultiport.lf @@ -11,7 +11,7 @@ reactor Source { reaction(t) -> out {= for (int i = 0; i < out_width; i++) { - lf_set(out[i], self->count++); + lf_set(out[i], self->count++); } =} } @@ -22,18 +22,18 @@ reactor Destination { reaction(in) {= for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) { - lf_print("Received %d.", in[i]->value); - if (in[i]->value != self->count++) { - lf_print_error_and_exit("Expected %d.", self->count - 1); - } + if (in[i]->is_present) { + lf_print("Received %d.", in[i]->value); + if (in[i]->value != self->count++) { + lf_print_error_and_exit("Expected %d.", self->count - 1); } + } } =} reaction(shutdown) {= if (self->count == 0) { - lf_print_error_and_exit("No data received."); + lf_print_error_and_exit("No data received."); } =} } diff --git a/test/C/src/federated/DistributedMultiportToBank.lf b/test/C/src/federated/DistributedMultiportToBank.lf index c7a3b7dd5f..d8171de51e 100644 --- a/test/C/src/federated/DistributedMultiportToBank.lf +++ b/test/C/src/federated/DistributedMultiportToBank.lf @@ -10,7 +10,7 @@ reactor Source { reaction(t) -> out {= for (int i = 0; i < out_width; i++) { - lf_set(out[i], self->count); + lf_set(out[i], self->count); } self->count++; =} @@ -23,13 +23,13 @@ reactor Destination { reaction(in) {= lf_print("Received %d.", in->value); if (self->count++ != in->value) { - lf_print_error_and_exit("Expected %d.", self->count - 1); + lf_print_error_and_exit("Expected %d.", self->count - 1); } =} reaction(shutdown) {= if (self->count == 0) { - lf_print_error_and_exit("No data received."); + lf_print_error_and_exit("No data received."); } =} } diff --git a/test/C/src/federated/DistributedMultiportToken.lf b/test/C/src/federated/DistributedMultiportToken.lf index 821f48d17a..61fd8caff9 100644 --- a/test/C/src/federated/DistributedMultiportToken.lf +++ b/test/C/src/federated/DistributedMultiportToken.lf @@ -12,17 +12,17 @@ reactor Source { reaction(t) -> out {= for (int i = 0; i < out_width; i++) { - // With NULL, 0 arguments, snprintf tells us how many bytes are needed. - // Add one for the null terminator. - int length = snprintf(NULL, 0, "Hello %d", self->count) + 1; - // Dynamically allocate memory for the output. - SET_NEW_ARRAY(out[i], length); - // Populate the output string and increment the count. - snprintf(out[i]->value, length, "Hello %d", self->count++); - lf_print("MessageGenerator: At time %lld, send message: %s.", - lf_time_logical_elapsed(), - out[i]->value - ); + // With NULL, 0 arguments, snprintf tells us how many bytes are needed. + // Add one for the null terminator. + int length = snprintf(NULL, 0, "Hello %d", self->count) + 1; + // Dynamically allocate memory for the output. + SET_NEW_ARRAY(out[i], length); + // Populate the output string and increment the count. + snprintf(out[i]->value, length, "Hello %d", self->count++); + lf_print("MessageGenerator: At time %lld, send message: %s.", + lf_time_logical_elapsed(), + out[i]->value + ); } =} } @@ -32,9 +32,9 @@ reactor Destination { reaction(in) {= for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) { - lf_print("Received %s.", in[i]->value); - } + if (in[i]->is_present) { + lf_print("Received %s.", in[i]->value); + } } =} } diff --git a/test/C/src/federated/DistributedNetworkOrder.lf b/test/C/src/federated/DistributedNetworkOrder.lf index 552affa999..1a99b64a91 100644 --- a/test/C/src/federated/DistributedNetworkOrder.lf +++ b/test/C/src/federated/DistributedNetworkOrder.lf @@ -29,12 +29,12 @@ reactor Sender { reaction(t) -> out {= int payload = 1; if (lf_time_logical_elapsed() == 0LL) { - send_timed_message(self->base.environment, MSEC(10), MSG_TYPE_TAGGED_MESSAGE, 0, 1, "federate 1", sizeof(int), - (unsigned char*)&payload); + send_timed_message(self->base.environment, MSEC(10), MSG_TYPE_TAGGED_MESSAGE, 0, 1, "federate 1", sizeof(int), + (unsigned char*)&payload); } else if (lf_time_logical_elapsed() == MSEC(5)) { - payload = 2; - send_timed_message(self->base.environment, MSEC(5), MSG_TYPE_TAGGED_MESSAGE, 0, 1, "federate 1", sizeof(int), - (unsigned char*)&payload); + payload = 2; + send_timed_message(self->base.environment, MSEC(5), MSG_TYPE_TAGGED_MESSAGE, 0, 1, "federate 1", sizeof(int), + (unsigned char*)&payload); } =} } @@ -46,22 +46,22 @@ reactor Receiver { reaction(in) {= tag_t current_tag = lf_tag(); if (current_tag.time == (lf_time_start() + MSEC(10))) { - if (current_tag.microstep == 0 && in->value == 1) { - self->success++; - } else if (current_tag.microstep == 1 && in->value == 2) { - self->success++; - } + if (current_tag.microstep == 0 && in->value == 1) { + self->success++; + } else if (current_tag.microstep == 1 && in->value == 2) { + self->success++; + } } printf("Received %d at tag (%lld, %u).\n", - in->value, - lf_time_logical_elapsed(), - lf_tag().microstep); + in->value, + lf_time_logical_elapsed(), + lf_tag().microstep); =} reaction(shutdown) {= if (self->success != 2) { - fprintf(stderr, "ERROR: Failed to receive messages.\n"); - exit(1); + fprintf(stderr, "ERROR: Failed to receive messages.\n"); + exit(1); } printf("SUCCESS.\n"); =} diff --git a/test/C/src/federated/DistributedPhysicalActionUpstream.lf b/test/C/src/federated/DistributedPhysicalActionUpstream.lf index e4c8ad1e68..847e9547ed 100644 --- a/test/C/src/federated/DistributedPhysicalActionUpstream.lf +++ b/test/C/src/federated/DistributedPhysicalActionUpstream.lf @@ -22,16 +22,16 @@ reactor WithPhysicalAction { preamble {= int _counter = 1; void callback(void *a) { - lf_schedule_int(a, 0, _counter++); + lf_schedule_int(a, 0, _counter++); } // Simulate time passing before a callback occurs. void* take_time(void* a) { - while (_counter < 15) { - instant_t sleep_time = MSEC(10); - lf_sleep(sleep_time); - callback(a); - } - return NULL; + while (_counter < 15) { + instant_t sleep_time = MSEC(10); + lf_sleep(sleep_time); + callback(a); + } + return NULL; } =} @@ -51,7 +51,7 @@ federated reactor { a = new WithPhysicalAction() m1 = new PassThrough() m2 = new PassThrough() - test = new TestCount(num_inputs = 14) + test = new TestCount(num_inputs=14) a.out -> m1.in m1.out -> m2.in m2.out -> test.in diff --git a/test/C/src/federated/DistributedPhysicalActionUpstreamLong.lf b/test/C/src/federated/DistributedPhysicalActionUpstreamLong.lf index cc9f556df0..180e05be47 100644 --- a/test/C/src/federated/DistributedPhysicalActionUpstreamLong.lf +++ b/test/C/src/federated/DistributedPhysicalActionUpstreamLong.lf @@ -22,16 +22,16 @@ reactor WithPhysicalAction { preamble {= int _counter = 1; void callback(void *a) { - lf_schedule_int(a, 0, _counter++); + lf_schedule_int(a, 0, _counter++); } // Simulate time passing before a callback occurs. void* take_time(void* a) { - while (_counter < 20) { - instant_t sleep_time = USEC(50); - lf_sleep(sleep_time); - callback(a); - } - return NULL; + while (_counter < 20) { + instant_t sleep_time = USEC(50); + lf_sleep(sleep_time); + callback(a); + } + return NULL; } =} output out: int @@ -48,7 +48,7 @@ reactor WithPhysicalAction { federated reactor { a = new WithPhysicalAction() - test = new TestCount(num_inputs = 19) + test = new TestCount(num_inputs=19) passThroughs1 = new PassThrough() passThroughs2 = new PassThrough() diff --git a/test/C/src/federated/DistributedStop.lf b/test/C/src/federated/DistributedStop.lf index 4af4685169..e4dca56917 100644 --- a/test/C/src/federated/DistributedStop.lf +++ b/test/C/src/federated/DistributedStop.lf @@ -13,78 +13,78 @@ reactor Sender { reaction(t, act) -> out, act {= lf_print("Sending 42 at (%lld, %u).", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_time_logical_elapsed(), + lf_tag().microstep); lf_set(out, 42); if (lf_tag().microstep == 0) { - // Instead of having a separate reaction - // for 'act' like Stop.lf, we trigger the - // same reaction to test lf_request_stop() being - // called multiple times - lf_schedule(act, 0); + // Instead of having a separate reaction + // for 'act' like Stop.lf, we trigger the + // same reaction to test lf_request_stop() being + // called multiple times + lf_schedule(act, 0); } if (lf_time_logical_elapsed() == USEC(1)) { - // Call lf_request_stop() both at (1 usec, 0) and - // (1 usec, 1) - lf_print("Requesting stop at (%lld, %u).", - lf_time_logical_elapsed(), - lf_tag().microstep); - lf_request_stop(); + // Call lf_request_stop() both at (1 usec, 0) and + // (1 usec, 1) + lf_print("Requesting stop at (%lld, %u).", + lf_time_logical_elapsed(), + lf_tag().microstep); + lf_request_stop(); } tag_t _1usec1 = (tag_t) { .time = USEC(1) + lf_time_start(), .microstep = 1u }; if (lf_tag_compare(lf_tag(), _1usec1) == 0) { - // The reaction was invoked at (1 usec, 1) as expected - self->reaction_invoked_correctly = true; + // The reaction was invoked at (1 usec, 1) as expected + self->reaction_invoked_correctly = true; } else if (lf_tag_compare(lf_tag(), _1usec1) > 0) { - // The reaction should not have been invoked at tags larger than (1 usec, 1) - lf_print_error_and_exit("ERROR: Invoked reaction(t, act) at tag bigger than shutdown."); + // The reaction should not have been invoked at tags larger than (1 usec, 1) + lf_print_error_and_exit("ERROR: Invoked reaction(t, act) at tag bigger than shutdown."); } =} reaction(shutdown) {= if (lf_time_logical_elapsed() != USEC(1) || - lf_tag().microstep != 1) { - lf_print_error_and_exit("ERROR: Sender failed to stop the federation in time. " - "Stopping at (%lld, %u).", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_tag().microstep != 1) { + lf_print_error_and_exit("ERROR: Sender failed to stop the federation in time. " + "Stopping at (%lld, %u).", + lf_time_logical_elapsed(), + lf_tag().microstep); } else if (self->reaction_invoked_correctly == false) { - lf_print_error_and_exit("ERROR: Sender reaction(t, act) was not invoked at (1 usec, 1). " - "Stopping at (%lld, %u).", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_print_error_and_exit("ERROR: Sender reaction(t, act) was not invoked at (1 usec, 1). " + "Stopping at (%lld, %u).", + lf_time_logical_elapsed(), + lf_tag().microstep); } lf_print("SUCCESS: Successfully stopped the federation at (%lld, %u).", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_time_logical_elapsed(), + lf_tag().microstep); =} } reactor Receiver( - stp_offset: time = 10 msec // Used in the decentralized variant of the test -) { + // Used in the decentralized variant of the test + stp_offset: time = 10 msec) { input in: int state reaction_invoked_correctly: bool = false reaction(in) {= lf_print("Received %d at (%lld, %u).", - in->value, - lf_time_logical_elapsed(), - lf_tag().microstep); + in->value, + lf_time_logical_elapsed(), + lf_tag().microstep); if (lf_time_logical_elapsed() == USEC(1)) { - lf_print("Requesting stop at (%lld, %u).", - lf_time_logical_elapsed(), - lf_tag().microstep); - lf_request_stop(); - // The receiver should receive a message at tag - // (1 usec, 1) and trigger this reaction - self->reaction_invoked_correctly = true; + lf_print("Requesting stop at (%lld, %u).", + lf_time_logical_elapsed(), + lf_tag().microstep); + lf_request_stop(); + // The receiver should receive a message at tag + // (1 usec, 1) and trigger this reaction + self->reaction_invoked_correctly = true; } tag_t _1usec1 = (tag_t) { .time = USEC(1) + lf_time_start(), .microstep = 1u }; if (lf_tag_compare(lf_tag(), _1usec1) > 0) { - self->reaction_invoked_correctly = false; + self->reaction_invoked_correctly = false; } =} @@ -93,20 +93,20 @@ reactor Receiver( // Therefore, the shutdown events must occur at (1000, 0) on the // receiver. if (lf_time_logical_elapsed() != USEC(1) || - lf_tag().microstep != 1) { - lf_print_error_and_exit("Receiver failed to stop the federation at the right time. " - "Stopping at (%lld, %u).", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_tag().microstep != 1) { + lf_print_error_and_exit("Receiver failed to stop the federation at the right time. " + "Stopping at (%lld, %u).", + lf_time_logical_elapsed(), + lf_tag().microstep); } else if (self->reaction_invoked_correctly == false) { - lf_print_error_and_exit("Receiver reaction(in) was not invoked the correct number of times. " - "Stopping at (%lld, %u).", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_print_error_and_exit("Receiver reaction(in) was not invoked the correct number of times. " + "Stopping at (%lld, %u).", + lf_time_logical_elapsed(), + lf_tag().microstep); } lf_print("SUCCESS: Successfully stopped the federation at (%lld, %u).", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_time_logical_elapsed(), + lf_tag().microstep); =} } diff --git a/test/C/src/federated/DistributedStopZero.lf b/test/C/src/federated/DistributedStopZero.lf index 2e0529ea1d..9b8dcdddfa 100644 --- a/test/C/src/federated/DistributedStopZero.lf +++ b/test/C/src/federated/DistributedStopZero.lf @@ -11,32 +11,32 @@ reactor Sender { reaction(t) -> out {= printf("Sending 42 at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_time_logical_elapsed(), + lf_tag().microstep); lf_set(out, 42); tag_t zero = (tag_t) { .time = lf_time_start(), .microstep = 0u }; if (lf_tag_compare(lf_tag(), zero) == 0) { - // Request stop at (0,0) - printf("Requesting stop at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - lf_request_stop(); + // Request stop at (0,0) + printf("Requesting stop at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + lf_request_stop(); } =} reaction(shutdown) {= if (lf_time_logical_elapsed() != USEC(0) || - lf_tag().microstep != 1) { - fprintf(stderr, "ERROR: Sender failed to stop the federation in time. " - "Stopping at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - exit(1); + lf_tag().microstep != 1) { + fprintf(stderr, "ERROR: Sender failed to stop the federation in time. " + "Stopping at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + exit(1); } printf("SUCCESS: Successfully stopped the federation at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_time_logical_elapsed(), + lf_tag().microstep); =} } @@ -45,16 +45,16 @@ reactor Receiver { reaction(in) {= printf("Received %d at (%lld, %u).\n", - in->value, - lf_time_logical_elapsed(), - lf_tag().microstep); + in->value, + lf_time_logical_elapsed(), + lf_tag().microstep); tag_t zero = (tag_t) { .time = lf_time_start(), .microstep = 0u }; if (lf_tag_compare(lf_tag(), zero) == 0) { - // Request stop at (0,0) - printf("Requesting stop at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - lf_request_stop(); + // Request stop at (0,0) + printf("Requesting stop at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + lf_request_stop(); } =} @@ -63,16 +63,16 @@ reactor Receiver { // Therefore, the shutdown events must occur at (0, 0) on the // receiver. if (lf_time_logical_elapsed() != USEC(0) || - lf_tag().microstep != 1) { - fprintf(stderr, "ERROR: Receiver failed to stop the federation in time. " - "Stopping at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); - exit(1); + lf_tag().microstep != 1) { + fprintf(stderr, "ERROR: Receiver failed to stop the federation in time. " + "Stopping at (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep); + exit(1); } printf("SUCCESS: Successfully stopped the federation at (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep); + lf_time_logical_elapsed(), + lf_tag().microstep); =} } diff --git a/test/C/src/federated/DistributedToken.lf b/test/C/src/federated/DistributedToken.lf index 14ce0b94e0..3d8662f27f 100644 --- a/test/C/src/federated/DistributedToken.lf +++ b/test/C/src/federated/DistributedToken.lf @@ -41,8 +41,8 @@ reactor MessageGenerator(root: string = "") { // Populate the output string and increment the count. snprintf(message->value, length, "%s %d", self->root, self->count++); printf("MessageGenerator: At time %lld, send message: %s\n", - lf_time_logical_elapsed(), - message->value + lf_time_logical_elapsed(), + message->value ); =} } @@ -58,37 +58,37 @@ reactor PrintMessage { reaction(message) {= printf("PrintMessage: At (elapsed) logical time %lld, receiver receives: %s\n", - lf_time_logical_elapsed(), - message->value + lf_time_logical_elapsed(), + message->value ); // Check the trailing number only of the message. self->count++; int trailing_number = atoi(&message->value[12]); if (trailing_number != self->count) { - printf("ERROR: Expected message to be 'Hello World %d'.\n", self->count); - exit(1); + printf("ERROR: Expected message to be 'Hello World %d'.\n", self->count); + exit(1); } =} STP(0) {= printf("PrintMessage: At (elapsed) tag (%lld, %u), receiver receives: %s\n" - "Original intended tag was (%lld, %u).\n", - lf_time_logical_elapsed(), - lf_tag().microstep, - message->value, - message->intended_tag.time - lf_time_start(), - message->intended_tag.microstep); + "Original intended tag was (%lld, %u).\n", + lf_time_logical_elapsed(), + lf_tag().microstep, + message->value, + message->intended_tag.time - lf_time_start(), + message->intended_tag.microstep); // Check the trailing number only of the message. self->count++; int trailing_number = atoi(&message->value[12]); if (trailing_number != self->count) { - printf("ERROR: Expected message to be 'Hello World %d'.\n", self->count); - exit(1); + printf("ERROR: Expected message to be 'Hello World %d'.\n", self->count); + exit(1); } =} reaction(shutdown) {= if (self->count == 0) { - printf("ERROR: No messages received.\n"); - exit(2); + printf("ERROR: No messages received.\n"); + exit(2); } =} } diff --git a/test/C/src/federated/FederatedFilePkgReader.lf b/test/C/src/federated/FederatedFilePkgReader.lf index e4396b7783..cf79291acf 100644 --- a/test/C/src/federated/FederatedFilePkgReader.lf +++ b/test/C/src/federated/FederatedFilePkgReader.lf @@ -8,10 +8,10 @@ reactor Source { reaction(startup) -> out {= char* file_path = - LF_PACKAGE_DIRECTORY - LF_FILE_SEPARATOR "src" - LF_FILE_SEPARATOR "lib" - LF_FILE_SEPARATOR "FileReader.txt"; + LF_PACKAGE_DIRECTORY + LF_FILE_SEPARATOR "src" + LF_FILE_SEPARATOR "lib" + LF_FILE_SEPARATOR "FileReader.txt"; FILE* file = fopen(file_path, "rb"); if (file == NULL) lf_print_error_and_exit("Error opening file at path %s.", file_path); @@ -45,7 +45,7 @@ reactor Check { reaction(in) {= printf("Received: %s\n", in->value); if (strcmp("Hello World", in->value) != 0) { - lf_print_error_and_exit("Expected 'Hello World'"); + lf_print_error_and_exit("Expected 'Hello World'"); } =} } diff --git a/test/C/src/federated/FederatedFileReader.lf b/test/C/src/federated/FederatedFileReader.lf index 9a2534195a..30efe2edfd 100644 --- a/test/C/src/federated/FederatedFileReader.lf +++ b/test/C/src/federated/FederatedFileReader.lf @@ -8,10 +8,10 @@ reactor Source { reaction(startup) -> out {= char* file_path = - LF_SOURCE_DIRECTORY - LF_FILE_SEPARATOR ".." - LF_FILE_SEPARATOR "lib" - LF_FILE_SEPARATOR "FileReader.txt"; + LF_SOURCE_DIRECTORY + LF_FILE_SEPARATOR ".." + LF_FILE_SEPARATOR "lib" + LF_FILE_SEPARATOR "FileReader.txt"; FILE* file = fopen(file_path, "rb"); if (file == NULL) lf_print_error_and_exit("Error opening file at path %s.", file_path); @@ -45,7 +45,7 @@ reactor Check { reaction(in) {= printf("Received: %s\n", in->value); if (strcmp("Hello World", in->value) != 0) { - lf_print_error_and_exit("Expected 'Hello World'"); + lf_print_error_and_exit("Expected 'Hello World'"); } =} } diff --git a/test/C/src/federated/FeedbackDelay.lf b/test/C/src/federated/FeedbackDelay.lf index abfe5f1d6c..ed458a9749 100644 --- a/test/C/src/federated/FeedbackDelay.lf +++ b/test/C/src/federated/FeedbackDelay.lf @@ -37,7 +37,7 @@ reactor Controller { reaction(sensor) -> control, request_for_planning {= if (!self->first) { - lf_set(control, self->latest_control); + lf_set(control, self->latest_control); } self->first = false; lf_set(request_for_planning, sensor->value); diff --git a/test/C/src/federated/FeedbackDelaySimple.lf b/test/C/src/federated/FeedbackDelaySimple.lf index 7f4756c49d..ece831bf11 100644 --- a/test/C/src/federated/FeedbackDelaySimple.lf +++ b/test/C/src/federated/FeedbackDelaySimple.lf @@ -11,11 +11,11 @@ reactor Loop { reaction(in) {= lf_print("Received %d.", in->value); if (in->value != self->count) { - lf_print_error_and_exit( - "Expected %d. Got %d.", - self->count, - in->value - ); + lf_print_error_and_exit( + "Expected %d. Got %d.", + self->count, + in->value + ); } self->count++; =} @@ -24,10 +24,10 @@ reactor Loop { reaction(shutdown) {= if (self->count != 11) { - lf_print_error_and_exit( - "Expected 11 messages. Got %d.", - self->count - ); + lf_print_error_and_exit( + "Expected 11 messages. Got %d.", + self->count + ); } =} } diff --git a/test/C/src/federated/HelloDistributed.lf b/test/C/src/federated/HelloDistributed.lf index d2c4ea4c16..4b06399fa4 100644 --- a/test/C/src/federated/HelloDistributed.lf +++ b/test/C/src/federated/HelloDistributed.lf @@ -29,8 +29,8 @@ reactor Destination { reaction(in) {= lf_print("At logical time %lld, destination received: %s", lf_time_logical_elapsed(), in->value); if (strcmp(in->value, "Hello World!") != 0) { - fprintf(stderr, "ERROR: Expected to receive 'Hello World!'\n"); - exit(1); + fprintf(stderr, "ERROR: Expected to receive 'Hello World!'\n"); + exit(1); } self->received = true; =} @@ -38,7 +38,7 @@ reactor Destination { reaction(shutdown) {= lf_print("Shutdown invoked."); if (!self->received) { - lf_print_error_and_exit("Destination did not receive the message."); + lf_print_error_and_exit("Destination did not receive the message."); } =} } diff --git a/test/C/src/federated/LevelPattern.lf b/test/C/src/federated/LevelPattern.lf index cdbcc46ffe..da47325ba1 100644 --- a/test/C/src/federated/LevelPattern.lf +++ b/test/C/src/federated/LevelPattern.lf @@ -37,7 +37,7 @@ reactor A { federated reactor { c = new Count() - test = new TestCount(num_inputs = 2) + test = new TestCount(num_inputs=2) b = new A() t = new Through() diff --git a/test/C/src/federated/LoopDistributedCentralized.lf b/test/C/src/federated/LoopDistributedCentralized.lf index c8b08ee317..343d77ab36 100644 --- a/test/C/src/federated/LoopDistributedCentralized.lf +++ b/test/C/src/federated/LoopDistributedCentralized.lf @@ -36,14 +36,14 @@ reactor Looper(incr: int = 1, delay: time = 0 msec) { reaction(shutdown) {= lf_print("******* Shutdown invoked."); if (self->count != 5 * self->incr) { - lf_print_error_and_exit("Failed to receive all five expected inputs."); + lf_print_error_and_exit("Failed to receive all five expected inputs."); } =} } federated reactor LoopDistributedCentralized(delay: time = 0) { left = new Looper() - right = new Looper(incr = -1) + right = new Looper(incr=-1) left.out -> right.in right.out -> left.in } diff --git a/test/C/src/federated/LoopDistributedCentralized2.lf b/test/C/src/federated/LoopDistributedCentralized2.lf index e83fc1e308..45a8dddfe2 100644 --- a/test/C/src/federated/LoopDistributedCentralized2.lf +++ b/test/C/src/federated/LoopDistributedCentralized2.lf @@ -35,7 +35,7 @@ reactor Looper(incr: int = 1, delay: time = 0 msec) { reaction(shutdown) {= lf_print("******* Shutdown invoked."); if (self->count != 5 * self->incr) { - lf_print_error_and_exit("Failed to receive all five expected inputs."); + lf_print_error_and_exit("Failed to receive all five expected inputs."); } =} } @@ -63,14 +63,14 @@ reactor Looper2(incr: int = 1, delay: time = 0 msec) { reaction(shutdown) {= lf_print("******* Shutdown invoked."); if (self->count != 5 * self->incr) { - lf_print_error_and_exit("Failed to receive all five expected inputs."); + lf_print_error_and_exit("Failed to receive all five expected inputs."); } =} } federated reactor(delay: time = 0) { left = new Looper() - right = new Looper2(incr = -1) + right = new Looper2(incr=-1) left.out -> right.in right.out -> left.in } diff --git a/test/C/src/federated/LoopDistributedCentralizedPhysicalAction.lf b/test/C/src/federated/LoopDistributedCentralizedPhysicalAction.lf index 5b9d47fd88..2f0da4e3de 100644 --- a/test/C/src/federated/LoopDistributedCentralizedPhysicalAction.lf +++ b/test/C/src/federated/LoopDistributedCentralizedPhysicalAction.lf @@ -23,12 +23,12 @@ reactor Looper(incr: int = 1, delay: time = 0 msec) { bool stop = false; // Thread to trigger an action once every second. void* ping(void* actionref) { - while(!stop) { - lf_print("Scheduling action."); - lf_schedule(actionref, 0); - sleep(1); - } - return NULL; + while(!stop) { + lf_print("Scheduling action."); + lf_schedule(actionref, 0); + sleep(1); + } + return NULL; } =} input in: int @@ -60,14 +60,14 @@ reactor Looper(incr: int = 1, delay: time = 0 msec) { // Stop the thread that is scheduling actions. stop = true; if (self->count != 5 * self->incr) { - lf_print_error_and_exit("Failed to receive all five expected inputs."); + lf_print_error_and_exit("Failed to receive all five expected inputs."); } =} } federated reactor(delay: time = 0) { left = new Looper() - right = new Looper(incr = -1) + right = new Looper(incr=-1) left.out -> right.in right.out -> left.in } diff --git a/test/C/src/federated/LoopDistributedCentralizedPrecedence.lf b/test/C/src/federated/LoopDistributedCentralizedPrecedence.lf index 9d4ed9e4fe..51a10faac2 100644 --- a/test/C/src/federated/LoopDistributedCentralizedPrecedence.lf +++ b/test/C/src/federated/LoopDistributedCentralizedPrecedence.lf @@ -36,21 +36,21 @@ reactor Looper(incr: int = 1, delay: time = 0 msec) { reaction(t) {= if (self->received_count != self->count) { - lf_print_error_and_exit("reaction(t) was invoked before reaction(in). Precedence order was not kept."); + lf_print_error_and_exit("reaction(t) was invoked before reaction(in). Precedence order was not kept."); } =} reaction(shutdown) {= lf_print("******* Shutdown invoked."); if (self->count != 6 * self->incr) { - lf_print_error_and_exit("Failed to receive all six expected inputs."); + lf_print_error_and_exit("Failed to receive all six expected inputs."); } =} } federated reactor(delay: time = 0) { left = new Looper() - right = new Looper(incr = -1) + right = new Looper(incr=-1) left.out -> right.in right.out -> left.in } diff --git a/test/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf b/test/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf index da6054251c..9e8fb02059 100644 --- a/test/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf +++ b/test/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf @@ -26,7 +26,7 @@ reactor Contained(incr: int = 1) { reaction(t) {= if (self->received_count != self->count) { - lf_print_error_and_exit("reaction(t) was invoked before reaction(in). Precedence order was not kept."); + lf_print_error_and_exit("reaction(t) was invoked before reaction(in). Precedence order was not kept."); } =} } @@ -37,7 +37,7 @@ reactor Looper(incr: int = 1, delay: time = 0 msec) { state count: int = 0 timer t(0, 1 sec) - c = new Contained(incr = incr) + c = new Contained(incr=incr) in -> c.in reaction(t) -> out {= @@ -56,14 +56,14 @@ reactor Looper(incr: int = 1, delay: time = 0 msec) { reaction(shutdown) {= lf_print("******* Shutdown invoked."); if (self->count != 6 * self->incr) { - lf_print_error_and_exit("Failed to receive all six expected inputs."); + lf_print_error_and_exit("Failed to receive all six expected inputs."); } =} } federated reactor(delay: time = 0) { left = new Looper() - right = new Looper(incr = -1) + right = new Looper(incr=-1) left.out -> right.in right.out -> left.in } diff --git a/test/C/src/federated/LoopDistributedDecentralized.lf b/test/C/src/federated/LoopDistributedDecentralized.lf index 387ec55325..d5c430ef3e 100644 --- a/test/C/src/federated/LoopDistributedDecentralized.lf +++ b/test/C/src/federated/LoopDistributedDecentralized.lf @@ -19,12 +19,12 @@ reactor Looper(incr: int = 1, delay: time = 0 msec, stp_offset: time = 0) { bool stop = false; // Thread to trigger an action once every second. void* ping(void* actionref) { - while(!stop) { - lf_print("Scheduling action."); - lf_schedule(actionref, 0); - sleep(1); - } - return NULL; + while(!stop) { + lf_print("Scheduling action."); + lf_schedule(actionref, 0); + sleep(1); + } + return NULL; } =} input in: int @@ -67,14 +67,14 @@ reactor Looper(incr: int = 1, delay: time = 0 msec, stp_offset: time = 0) { // Stop the thread that is scheduling actions. stop = true; if (self->count != 5 * self->incr) { - lf_print_error_and_exit("Failed to receive all five expected inputs."); + lf_print_error_and_exit("Failed to receive all five expected inputs."); } =} } federated reactor LoopDistributedDecentralized(delay: time = 0) { left = new Looper(stp_offset = 900 usec) - right = new Looper(incr = -1, stp_offset = 2400 usec) + right = new Looper(incr=-1, stp_offset = 2400 usec) left.out -> right.in right.out -> left.in } diff --git a/test/C/src/federated/LoopDistributedDouble.lf b/test/C/src/federated/LoopDistributedDouble.lf index 69c84799c7..45d3c207ac 100644 --- a/test/C/src/federated/LoopDistributedDouble.lf +++ b/test/C/src/federated/LoopDistributedDouble.lf @@ -23,12 +23,12 @@ reactor Looper(incr: int = 1, delay: time = 0 msec) { bool stop = false; // Thread to trigger an action once every second. void* ping(void* actionref) { - while(!stop) { - lf_print("Scheduling action."); - lf_schedule(actionref, 0); - sleep(1); - } - return NULL; + while(!stop) { + lf_print("Scheduling action."); + lf_schedule(actionref, 0); + sleep(1); + } + return NULL; } =} input in: int @@ -48,9 +48,9 @@ reactor Looper(incr: int = 1, delay: time = 0 msec) { reaction(a) -> out, out2 {= if (self->count%2 == 0) { - lf_set(out, self->count); + lf_set(out, self->count); } else { - lf_set(out2, self->count); + lf_set(out2, self->count); } self->count += self->incr; =} @@ -58,23 +58,23 @@ reactor Looper(incr: int = 1, delay: time = 0 msec) { reaction(in) {= tag_t current_tag = lf_tag(); lf_print("Received %d at logical time (%lld, %d).", - in->value, - current_tag.time - lf_time_start(), current_tag.microstep + in->value, + current_tag.time - lf_time_start(), current_tag.microstep ); =} reaction(in2) {= tag_t current_tag = lf_tag(); lf_print("Received %d on in2 at logical time (%lld, %d).", - in2->value, - current_tag.time - lf_time_start(), current_tag.microstep + in2->value, + current_tag.time - lf_time_start(), current_tag.microstep ); =} reaction(t) {= tag_t current_tag = lf_tag(); lf_print("Timer triggered at logical time (%lld, %d).", - current_tag.time - lf_time_start(), current_tag.microstep + current_tag.time - lf_time_start(), current_tag.microstep ); =} @@ -83,14 +83,14 @@ reactor Looper(incr: int = 1, delay: time = 0 msec) { // Stop the thread that is scheduling actions. stop = true; if (self->count != 5 * self->incr) { - lf_print_error_and_exit("Failed to receive all five expected inputs."); + lf_print_error_and_exit("Failed to receive all five expected inputs."); } =} } federated reactor(delay: time = 0) { left = new Looper() - right = new Looper(incr = -1) + right = new Looper(incr=-1) left.out -> right.in right.out -> left.in right.out2 -> left.in2 diff --git a/test/C/src/federated/ParallelDestinations.lf b/test/C/src/federated/ParallelDestinations.lf index 1d76627853..a4a4c026db 100644 --- a/test/C/src/federated/ParallelDestinations.lf +++ b/test/C/src/federated/ParallelDestinations.lf @@ -16,8 +16,8 @@ reactor Source { federated reactor { s = new Source() - t1 = new TestCount(num_inputs = 3) - t2 = new TestCount(num_inputs = 3) + t1 = new TestCount(num_inputs=3) + t2 = new TestCount(num_inputs=3) s.out -> t1.in, t2.in } diff --git a/test/C/src/federated/ParallelSources.lf b/test/C/src/federated/ParallelSources.lf index adcab8c689..0bedc87d68 100644 --- a/test/C/src/federated/ParallelSources.lf +++ b/test/C/src/federated/ParallelSources.lf @@ -9,8 +9,8 @@ import TestCount from "../lib/TestCount.lf" reactor Destination { input[2] in: int - t1 = new TestCount(num_inputs = 3) - t2 = new TestCount(num_inputs = 3) + t1 = new TestCount(num_inputs=3) + t2 = new TestCount(num_inputs=3) in -> t1.in, t2.in } diff --git a/test/C/src/federated/ParallelSourcesMultiport.lf b/test/C/src/federated/ParallelSourcesMultiport.lf index 7d76c31522..026c223463 100644 --- a/test/C/src/federated/ParallelSourcesMultiport.lf +++ b/test/C/src/federated/ParallelSourcesMultiport.lf @@ -17,9 +17,9 @@ reactor Source { reactor Destination1 { input[3] in: int - t1 = new TestCount(num_inputs = 3) - t2 = new TestCount(num_inputs = 3) - t3 = new TestCount(num_inputs = 3) + t1 = new TestCount(num_inputs=3) + t2 = new TestCount(num_inputs=3) + t3 = new TestCount(num_inputs=3) in -> t1.in, t2.in, t3.in } @@ -28,7 +28,7 @@ federated reactor { s1 = new Source() s2 = new Source() d1 = new Destination1() - t4 = new TestCount(num_inputs = 3) + t4 = new TestCount(num_inputs=3) s1.out, s2.out -> d1.in, t4.in } diff --git a/test/C/src/federated/PhysicalSTP.lf b/test/C/src/federated/PhysicalSTP.lf index 130ca02996..efd9313e4e 100644 --- a/test/C/src/federated/PhysicalSTP.lf +++ b/test/C/src/federated/PhysicalSTP.lf @@ -14,14 +14,14 @@ reactor Print(STP_offset_param: time = 0) { 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); + lf_print_error_and_exit("Expected to receive %d.", self->c); } instant_t STP_discrepency = lf_time_logical() + self->STP_offset_param - in->physical_time_of_arrival; if (STP_discrepency < 0) { - lf_print("The message has violated the STP offset by %lld in physical time.", -1 * STP_discrepency); - self->c++; + lf_print("The message has violated the STP offset by %lld in physical time.", -1 * STP_discrepency); + self->c++; } else { - lf_print_error_and_exit("Message arrived %lld early.", STP_discrepency); + lf_print_error_and_exit("Message arrived %lld early.", STP_discrepency); } =} STP(STP_offset_param) {= // This STP handler should never be invoked because the only source of event @@ -31,7 +31,7 @@ reactor Print(STP_offset_param: time = 0) { reaction(shutdown) {= if (self->c != 3) { - lf_print_error_and_exit("Expected to receive 2 items but got %d.", self->c); + lf_print_error_and_exit("Expected to receive 2 items but got %d.", self->c); } =} } diff --git a/test/C/src/federated/PingPongDistributed.lf b/test/C/src/federated/PingPongDistributed.lf index 5fcc1bf32b..fa89e6f306 100644 --- a/test/C/src/federated/PingPongDistributed.lf +++ b/test/C/src/federated/PingPongDistributed.lf @@ -21,8 +21,8 @@ target C import Ping, Pong from "PingPongDistributedPhysical.lf" federated reactor(count: int = 10) { - ping = new Ping(count = count) - pong = new Pong(expected = count) + ping = new Ping(count=count) + pong = new Pong(expected=count) ping.send -> pong.receive pong.send -> ping.receive } diff --git a/test/C/src/federated/PingPongDistributedPhysical.lf b/test/C/src/federated/PingPongDistributedPhysical.lf index 63ea109a14..c5cbc9d495 100644 --- a/test/C/src/federated/PingPongDistributedPhysical.lf +++ b/test/C/src/federated/PingPongDistributedPhysical.lf @@ -37,9 +37,9 @@ reactor Ping(count: int = 10) { reaction(receive) -> serve {= if (self->pingsLeft > 0) { - lf_schedule(serve, 0); + lf_schedule(serve, 0); } else { - lf_request_stop(); + lf_request_stop(); } =} } @@ -54,24 +54,24 @@ reactor Pong(expected: int = 10) { printf("At logical time %lld, Pong received %d.\n", lf_time_logical_elapsed(), receive->value); lf_set(send, receive->value); if (self->count == self->expected) { - lf_request_stop(); + lf_request_stop(); } =} reaction(shutdown) {= if (self->count != self->expected) { - fprintf(stderr, "Pong expected to receive %d inputs, but it received %d.\n", - self->expected, self->count - ); - exit(1); + fprintf(stderr, "Pong expected to receive %d inputs, but it received %d.\n", + self->expected, self->count + ); + exit(1); } printf("Pong received %d pings.\n", self->count); =} } federated reactor(count: int = 10) { - ping = new Ping(count = count) - pong = new Pong(expected = count) + ping = new Ping(count=count) + pong = new Pong(expected=count) ping.send ~> pong.receive pong.send ~> ping.receive } diff --git a/test/C/src/federated/STPParameter.lf b/test/C/src/federated/STPParameter.lf index 97710dec50..f9d42b62f4 100644 --- a/test/C/src/federated/STPParameter.lf +++ b/test/C/src/federated/STPParameter.lf @@ -22,7 +22,7 @@ reactor PrintTimer(STP_offset: time = 1 sec, start: int = 1, stride: int = 1, nu reaction(in) {= lf_print("Received %d.", in->value); if (in->value != self->count) { - lf_print_error_and_exit("Expected %d.", self->count); + lf_print_error_and_exit("Expected %d.", self->count); } self->count += self->stride; self->inputs_received++; @@ -31,16 +31,16 @@ reactor PrintTimer(STP_offset: time = 1 sec, start: int = 1, stride: int = 1, nu reaction(shutdown) {= lf_print("Shutdown invoked."); if (self->inputs_received != self->num_inputs) { - lf_print_error_and_exit("Expected to receive %d inputs, but got %d.", - self->num_inputs, - self->inputs_received - ); + lf_print_error_and_exit("Expected to receive %d inputs, but got %d.", + self->num_inputs, + self->inputs_received + ); } =} reaction(t) {= lf_print("Timer ticked at (%lld, %d).", - lf_time_logical_elapsed(), lf_tag().microstep + lf_time_logical_elapsed(), lf_tag().microstep ); =} } diff --git a/test/C/src/federated/TopLevelArtifacts.lf b/test/C/src/federated/TopLevelArtifacts.lf index 8332821089..b2e486b31d 100644 --- a/test/C/src/federated/TopLevelArtifacts.lf +++ b/test/C/src/federated/TopLevelArtifacts.lf @@ -33,7 +33,7 @@ federated reactor { reaction(shutdown) {= if (self->successes != 3) { - lf_print_error_and_exit("Failed to properly execute top-level reactions"); + lf_print_error_and_exit("Failed to properly execute top-level reactions"); } lf_print("SUCCESS!"); =} diff --git a/test/C/src/federated/failing/ClockSync.lf b/test/C/src/federated/failing/ClockSync.lf index 57aca058b8..057c7830a2 100644 --- a/test/C/src/federated/failing/ClockSync.lf +++ b/test/C/src/federated/failing/ClockSync.lf @@ -10,16 +10,16 @@ target C { timeout: 10 sec, clock-sync: on, // Turn on runtime clock synchronization. clock-sync-options: { - local-federates-on: true, // Forces all federates to perform clock sync. - // Collect useful statistics like average network delay and the standard deviation for the - // network delay over one clock synchronization cycle. Generates a warning if the standard - // deviation is higher than the clock sync guard. Artificially offsets clocks by multiples of - // 200 msec. - collect-stats: true, - test-offset: 200 msec, - period: 5 msec, // Period with which runtime clock sync is performed. - trials: 10, // Number of messages exchanged to perform clock sync. - attenuation: 10 // Attenuation applied to runtime clock sync adjustments. + local-federates-on: true, // Forces all federates to perform clock sync. + // Collect useful statistics like average network delay and the standard deviation for the + // network delay over one clock synchronization cycle. Generates a warning if the standard + // deviation is higher than the clock sync guard. Artificially offsets clocks by multiples of + // 200 msec. + collect-stats: true, + test-offset: 200 msec, + period: 5 msec, // Period with which runtime clock sync is performed. + trials: 10, // Number of messages exchanged to perform clock sync. + attenuation: 10 // Attenuation applied to runtime clock sync adjustments. } } @@ -37,20 +37,20 @@ reactor Printer { input in: int reaction(startup) {= - interval_t offset = _lf_time_physical_clock_offset + _lf_time_test_physical_clock_offset; - lf_print("Clock sync error at startup is %lld ns.", offset); + interval_t offset = _lf_time_physical_clock_offset + _lf_time_test_physical_clock_offset; + lf_print("Clock sync error at startup is %lld ns.", offset); =} reaction(in) {= lf_print("Received %d.", in->value); =} reaction(shutdown) {= - interval_t offset = _lf_time_physical_clock_offset + _lf_time_test_physical_clock_offset; - lf_print("Clock sync error at shutdown is %lld ns.", offset); - // Error out if the offset is bigger than 100 msec. - if (offset > MSEC(100)) { - lf_print_error("Offset exceeds test threshold of 100 msec."); - exit(1); - } + interval_t offset = _lf_time_physical_clock_offset + _lf_time_test_physical_clock_offset; + lf_print("Clock sync error at shutdown is %lld ns.", offset); + // Error out if the offset is bigger than 100 msec. + if (offset > MSEC(100)) { + lf_print_error("Offset exceeds test threshold of 100 msec."); + exit(1); + } =} } diff --git a/test/C/src/federated/failing/DistributedDoublePortLooped.lf b/test/C/src/federated/failing/DistributedDoublePortLooped.lf index 15b42ea92d..fbadc7b03f 100644 --- a/test/C/src/federated/failing/DistributedDoublePortLooped.lf +++ b/test/C/src/federated/failing/DistributedDoublePortLooped.lf @@ -53,12 +53,12 @@ reactor Print { timer t(0, 2 msec) reaction(in1, in2, in3, t) -> out {= - interval_t elapsed_time = lf_time_logical_elapsed(); - lf_print("At tag (%lld, %u), received in = %d and in2 = %d.", elapsed_time, lf_tag().microstep, in1->value, in2->value); - if (in1->is_present && in2->is_present) { - lf_print_error_and_exit("ERROR: invalid logical simultaneity."); - } - lf_set(out, in1->value); + interval_t elapsed_time = lf_time_logical_elapsed(); + lf_print("At tag (%lld, %u), received in = %d and in2 = %d.", elapsed_time, lf_tag().microstep, in1->value, in2->value); + if (in1->is_present && in2->is_present) { + lf_print_error_and_exit("ERROR: invalid logical simultaneity."); + } + lf_set(out, in1->value); =} } diff --git a/test/C/src/federated/failing/DistributedDoublePortLooped2.lf b/test/C/src/federated/failing/DistributedDoublePortLooped2.lf index 5910d73533..0d63e4fb7c 100644 --- a/test/C/src/federated/failing/DistributedDoublePortLooped2.lf +++ b/test/C/src/federated/failing/DistributedDoublePortLooped2.lf @@ -17,8 +17,8 @@ reactor Count { timer t(0, 1 msec) reaction(t) -> out {= - lf_print("Count sends %d.", self->count); - lf_set(out, self->count++); + lf_print("Count sends %d.", self->count); + lf_set(out, self->count++); =} reaction(in) {= lf_print("Count received %d.", in->value); =} @@ -42,21 +42,21 @@ reactor Print { timer t(0, 2 msec) reaction(in, in2) -> out {= - interval_t elapsed_time = lf_time_logical_elapsed(); - if (in->is_present) { - lf_print("At tag (%lld, %u), received in = %d.", elapsed_time, lf_tag().microstep, in->value); - } - if (in2->is_present) { - lf_print("At tag (%lld, %u), received in2 = %d.", elapsed_time, lf_tag().microstep, in2->value); - } - if (in->is_present && in2->is_present) { - lf_print_error_and_exit("ERROR: invalid logical simultaneity."); - } - lf_set(out, in->value); + interval_t elapsed_time = lf_time_logical_elapsed(); + if (in->is_present) { + lf_print("At tag (%lld, %u), received in = %d.", elapsed_time, lf_tag().microstep, in->value); + } + if (in2->is_present) { + lf_print("At tag (%lld, %u), received in2 = %d.", elapsed_time, lf_tag().microstep, in2->value); + } + if (in->is_present && in2->is_present) { + lf_print_error_and_exit("ERROR: invalid logical simultaneity."); + } + lf_set(out, in->value); =} reaction(t) {= - // Do nothing + // Do nothing =} reaction(shutdown) {= lf_print("SUCCESS: messages were at least one microstep apart."); =} diff --git a/test/C/src/federated/failing/DistributedNetworkOrderDecentralized.lf b/test/C/src/federated/failing/DistributedNetworkOrderDecentralized.lf index 34f861dc4d..e73fa92f83 100644 --- a/test/C/src/federated/failing/DistributedNetworkOrderDecentralized.lf +++ b/test/C/src/federated/failing/DistributedNetworkOrderDecentralized.lf @@ -16,15 +16,15 @@ reactor Sender { timer t(0, 1 msec) reaction(t) {= - int payload = 1; - if (lf_time_logical_elapsed() == 0LL) { - send_timed_message(MSEC(10), MSG_TYPE_P2P_TAGGED_MESSAGE, 0, 1, "federate 1", sizeof(int), - (unsigned char*)&payload); - } else if (lf_time_logical_elapsed() == MSEC(5)) { - payload = 2; - send_timed_message(MSEC(5), MSG_TYPE_P2P_TAGGED_MESSAGE, 0, 1, "federate 1", sizeof(int), - (unsigned char*)&payload); - } + int payload = 1; + if (lf_time_logical_elapsed() == 0LL) { + send_timed_message(MSEC(10), MSG_TYPE_P2P_TAGGED_MESSAGE, 0, 1, "federate 1", sizeof(int), + (unsigned char*)&payload); + } else if (lf_time_logical_elapsed() == MSEC(5)) { + payload = 2; + send_timed_message(MSEC(5), MSG_TYPE_P2P_TAGGED_MESSAGE, 0, 1, "federate 1", sizeof(int), + (unsigned char*)&payload); + } =} } @@ -33,28 +33,28 @@ reactor Receiver { state success: int = 0 reaction(in) {= - tag_t current_tag = lf_tag(); - if (current_tag.time == (lf_time_start() + MSEC(10))) { - if (current_tag.microstep == 0 && in->value == 1) { - self->success++; - } else if (current_tag.microstep == 1 && in->value == 2) { - self->success++; - } + tag_t current_tag = lf_tag(); + if (current_tag.time == (lf_time_start() + MSEC(10))) { + if (current_tag.microstep == 0 && in->value == 1) { + self->success++; + } else if (current_tag.microstep == 1 && in->value == 2) { + self->success++; } - printf("Received %d at tag (%lld, %u) with intended tag (%lld, %u).\n", - in->value, - lf_time_logical_elapsed(), - lf_tag().microstep, - in->intended_tag.time - lf_time_start(), - in->intended_tag.microstep); + } + printf("Received %d at tag (%lld, %u) with intended tag (%lld, %u).\n", + in->value, + lf_time_logical_elapsed(), + lf_tag().microstep, + in->intended_tag.time - lf_time_start(), + in->intended_tag.microstep); =} reaction(shutdown) {= - if (self->success != 2) { - fprintf(stderr, "ERROR: Failed to receive messages.\n"); - exit(1); - } - printf("SUCCESS.\n"); + if (self->success != 2) { + fprintf(stderr, "ERROR: Failed to receive messages.\n"); + exit(1); + } + printf("SUCCESS.\n"); =} } diff --git a/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedence.lf b/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedence.lf index 0a19f9b962..82f394f2bc 100644 --- a/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedence.lf +++ b/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedence.lf @@ -19,41 +19,41 @@ reactor Looper(incr: int = 1, delay: time = 0 msec, stp_offset: time = 0) { timer t(0, 1 sec) reaction(t) -> out {= - lf_set(out, self->count); - self->count += self->incr; + lf_set(out, self->count); + self->count += self->incr; =} reaction(in) {= - instant_t time_lag = lf_time_physical() - lf_time_logical(); - char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 - lf_readable_time(time_buffer, time_lag); - lf_print("Received %d. Logical time is behind physical time by %s.", in->value, time_buffer); - self->received_count = self->count; + instant_t time_lag = lf_time_physical() - lf_time_logical(); + char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + lf_readable_time(time_buffer, time_lag); + lf_print("Received %d. Logical time is behind physical time by %s.", in->value, time_buffer); + self->received_count = self->count; =} STP(stp_offset) {= - instant_t time_lag = lf_time_physical() - lf_time_logical(); - char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 - lf_readable_time(time_buffer, time_lag); - lf_print("STP offset was violated. Received %d. Logical time is behind physical time by %s.", in->value, time_buffer); - self->received_count = self->count; + instant_t time_lag = lf_time_physical() - lf_time_logical(); + char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + lf_readable_time(time_buffer, time_lag); + lf_print("STP offset was violated. Received %d. Logical time is behind physical time by %s.", in->value, time_buffer); + self->received_count = self->count; =} deadline(10 msec) {= - instant_t time_lag = lf_time_physical() - lf_time_logical(); - char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 - lf_readable_time(time_buffer, time_lag); - lf_print("Deadline miss. Received %d. Logical time is behind physical time by %s.", in->value, time_buffer); - self->received_count = self->count; + instant_t time_lag = lf_time_physical() - lf_time_logical(); + char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + lf_readable_time(time_buffer, time_lag); + lf_print("Deadline miss. Received %d. Logical time is behind physical time by %s.", in->value, time_buffer); + self->received_count = self->count; =} reaction(t) {= - if (self->received_count != self->count) { - lf_print_error_and_exit("reaction(t) was invoked before reaction(in). Precedence order was not kept."); - } + if (self->received_count != self->count) { + lf_print_error_and_exit("reaction(t) was invoked before reaction(in). Precedence order was not kept."); + } =} reaction(shutdown) {= - lf_print("******* Shutdown invoked."); - if (self->count != 5 * self->incr) { - lf_print_error_and_exit("Failed to receive all five expected inputs."); - } + lf_print("******* Shutdown invoked."); + if (self->count != 5 * self->incr) { + lf_print_error_and_exit("Failed to receive all five expected inputs."); + } =} } diff --git a/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedenceHierarchy.lf b/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedenceHierarchy.lf index 5db194a582..46b98b5ed8 100644 --- a/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedenceHierarchy.lf +++ b/test/C/src/federated/failing/LoopDistributedDecentralizedPrecedenceHierarchy.lf @@ -23,32 +23,32 @@ reactor Looper(incr: int = 1, delay: time = 0 msec, stp_offset: time = 0) { in -> c.in reaction(t) -> out {= - lf_set(out, self->count); - self->count += self->incr; + lf_set(out, self->count); + self->count += self->incr; =} reaction(in) {= - instant_t time_lag = lf_time_physical() - lf_time_logical(); - char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 - lf_readable_time(time_buffer, time_lag); - lf_print("Received %d. Logical time is behind physical time by %s nsec.", in->value, time_buffer); + instant_t time_lag = lf_time_physical() - lf_time_logical(); + char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + lf_readable_time(time_buffer, time_lag); + lf_print("Received %d. Logical time is behind physical time by %s nsec.", in->value, time_buffer); =} STP(stp_offset) {= - instant_t time_lag = lf_time_physical() - lf_time_logical(); - char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 - lf_readable_time(time_buffer, time_lag); - lf_print("STP offset was violated. Received %d. Logical time is behind physical time by %s nsec.", in->value, time_buffer); + instant_t time_lag = lf_time_physical() - lf_time_logical(); + char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + lf_readable_time(time_buffer, time_lag); + lf_print("STP offset was violated. Received %d. Logical time is behind physical time by %s nsec.", in->value, time_buffer); =} deadline(10 msec) {= - instant_t time_lag = lf_time_physical() - lf_time_logical(); - char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 - lf_readable_time(time_buffer, time_lag); - lf_print("Deadline miss. Received %d. Logical time is behind physical time by %s nsec.", in->value, time_buffer); + instant_t time_lag = lf_time_physical() - lf_time_logical(); + char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + lf_readable_time(time_buffer, time_lag); + lf_print("Deadline miss. Received %d. Logical time is behind physical time by %s nsec.", in->value, time_buffer); =} reaction(shutdown) {= - lf_print("******* Shutdown invoked."); - if (self->count != 5 * self->incr) { - lf_print_error_and_exit("Failed to receive all five expected inputs."); - } + lf_print("******* Shutdown invoked."); + if (self->count != 5 * self->incr) { + lf_print_error_and_exit("Failed to receive all five expected inputs."); + } =} } diff --git a/test/C/src/federated/failing/SpuriousDependency.lf b/test/C/src/federated/failing/SpuriousDependency.lf index a022c3abf4..b509a4acae 100644 --- a/test/C/src/federated/failing/SpuriousDependency.lf +++ b/test/C/src/federated/failing/SpuriousDependency.lf @@ -6,47 +6,47 @@ * resolved the ambiguity in a way that does appear to result in deadlock. */ target C { - timeout: 2 sec + timeout: 2 sec } reactor Passthrough { - input in: int - output out: int + input in: int + output out: int - reaction(in) -> out {= - lf_print("Hello from passthrough"); - lf_set(out, in->value); - =} + reaction(in) -> out {= + lf_print("Hello from passthrough"); + lf_set(out, in->value); + =} } reactor Twisty { - input in0: int - input in1: int - output out0: int - output out1: int - p0 = new Passthrough() - p1 = new Passthrough() - in0 -> p0.in - p0.out -> out0 - in1 -> p1.in - p1.out -> out1 + input in0: int + input in1: int + output out0: int + output out1: int + p0 = new Passthrough() + p1 = new Passthrough() + in0 -> p0.in + p0.out -> out0 + in1 -> p1.in + p1.out -> out1 } federated reactor { - t0 = new Twisty() - t1 = new Twisty() - t0.out1 -> t1.in0 - t1.out1 -> t0.in0 - state count: int = 0 + t0 = new Twisty() + t1 = new Twisty() + t0.out1 -> t1.in0 + t1.out1 -> t0.in0 + state count: int = 0 - reaction(startup) -> t0.in1 {= lf_set(t0.in1, 0); =} + reaction(startup) -> t0.in1 {= lf_set(t0.in1, 0); =} - reaction(t1.out0) {= self->count++; =} + reaction(t1.out0) {= self->count++; =} - reaction(shutdown) {= - lf_print("******* Shutdown invoked."); - if (self->count != 1) { - lf_print_error_and_exit("Failed to receive expected input."); - } - =} + reaction(shutdown) {= + lf_print("******* Shutdown invoked."); + if (self->count != 1) { + lf_print_error_and_exit("Failed to receive expected input."); + } + =} } diff --git a/test/C/src/generics/TypeCheck.lf b/test/C/src/generics/TypeCheck.lf index 168430bbf6..db3524798e 100644 --- a/test/C/src/generics/TypeCheck.lf +++ b/test/C/src/generics/TypeCheck.lf @@ -20,7 +20,7 @@ reactor TestCount(start: int = 1, num_inputs: int = 1) { reaction(in) {= lf_print("Received %d.", in->value); if (in->value != self->count) { - lf_print_error_and_exit("Expected %d.", self->count); + lf_print_error_and_exit("Expected %d.", self->count); } self->count++; self->inputs_received++; @@ -29,16 +29,16 @@ reactor TestCount(start: int = 1, num_inputs: int = 1) { reaction(shutdown) {= lf_print("Shutdown invoked."); if (self->inputs_received != self->num_inputs) { - lf_print_error_and_exit("Expected to receive %d inputs, but got %d.", - self->num_inputs, - self->inputs_received - ); + lf_print_error_and_exit("Expected to receive %d inputs, but got %d.", + self->num_inputs, + self->inputs_received + ); } =} } main reactor { count = new Count() - testcount = new TestCount(num_inputs = 4) + testcount = new TestCount(num_inputs=4) count.out -> testcount.in } diff --git a/test/C/src/lib/ImportedAgain.lf b/test/C/src/lib/ImportedAgain.lf index dbde5e9fb0..6870526b95 100644 --- a/test/C/src/lib/ImportedAgain.lf +++ b/test/C/src/lib/ImportedAgain.lf @@ -8,8 +8,8 @@ reactor ImportedAgain { reaction(x) {= printf("Received: %d.\n", x->value); if (x->value != 42) { - printf("ERROR: Expected input to be 42. Got: %d.\n", x->value); - exit(1); + printf("ERROR: Expected input to be 42. Got: %d.\n", x->value); + exit(1); } =} } diff --git a/test/C/src/lib/LoopedActionSender.lf b/test/C/src/lib/LoopedActionSender.lf index e4f52c75c3..cabe53607b 100644 --- a/test/C/src/lib/LoopedActionSender.lf +++ b/test/C/src/lib/LoopedActionSender.lf @@ -18,18 +18,18 @@ reactor Sender(take_a_break_after: int = 10, break_interval: time = 400 msec) { reaction(startup, act) -> act, out {= // Send a message on out /* printf("At tag (%lld, %u) sending value %d.\n", - lf_time_logical_elapsed(), - lf_tag().microstep, - self->sent_messages + lf_time_logical_elapsed(), + lf_tag().microstep, + self->sent_messages ); */ lf_set(out, self->sent_messages); self->sent_messages++; if (self->sent_messages < self->take_a_break_after) { - lf_schedule(act, 0); + lf_schedule(act, 0); } else { - // Take a break - self->sent_messages=0; - lf_schedule(act, self->break_interval); + // Take a break + self->sent_messages=0; + lf_schedule(act, self->break_interval); } =} } diff --git a/test/C/src/lib/Test.lf b/test/C/src/lib/Test.lf index 6feab88015..69e4f79b2c 100644 --- a/test/C/src/lib/Test.lf +++ b/test/C/src/lib/Test.lf @@ -7,8 +7,8 @@ reactor TestDouble(expected: double[] = {1.0, 1.0, 1.0, 1.0}) { reaction(in) {= printf("Received: %f\n", in->value); if (in->value != self->expected[self->count]) { - printf("ERROR: Expected %f.\n", self->expected[self->count]); - exit(1); + printf("ERROR: Expected %f.\n", self->expected[self->count]); + exit(1); } self->count++; =} diff --git a/test/C/src/lib/TestCount.lf b/test/C/src/lib/TestCount.lf index 570cc7fe3e..e4fbb82b02 100644 --- a/test/C/src/lib/TestCount.lf +++ b/test/C/src/lib/TestCount.lf @@ -16,7 +16,7 @@ reactor TestCount(start: int = 1, stride: int = 1, num_inputs: int = 1) { reaction(in) {= lf_print("Received %d.", in->value); if (in->value != self->count) { - lf_print_error_and_exit("Expected %d.", self->count); + lf_print_error_and_exit("Expected %d.", self->count); } self->count += self->stride; self->inputs_received++; @@ -25,10 +25,10 @@ reactor TestCount(start: int = 1, stride: int = 1, num_inputs: int = 1) { reaction(shutdown) {= lf_print("Shutdown invoked."); if (self->inputs_received != self->num_inputs) { - lf_print_error_and_exit("Expected to receive %d inputs, but got %d.", - self->num_inputs, - self->inputs_received - ); + lf_print_error_and_exit("Expected to receive %d inputs, but got %d.", + self->num_inputs, + self->inputs_received + ); } =} } diff --git a/test/C/src/lib/TestCountMultiport.lf b/test/C/src/lib/TestCountMultiport.lf index 69ec75adec..a0b0db294d 100644 --- a/test/C/src/lib/TestCountMultiport.lf +++ b/test/C/src/lib/TestCountMultiport.lf @@ -17,14 +17,14 @@ reactor TestCountMultiport(start: int = 1, stride: int = 1, num_inputs: int = 1, reaction(in) {= for (int i = 0; i < in_width; i++) { - if (!in[i]->is_present) { - lf_print_error_and_exit("No input on channel %d.", i); - } - lf_print("Received %d on channel %d.", in[i]->value, i); - if (in[i]->value != self->count) { - lf_print_error_and_exit("Expected %d.", self->count); - } - self->count += self->stride; + if (!in[i]->is_present) { + lf_print_error_and_exit("No input on channel %d.", i); + } + lf_print("Received %d on channel %d.", in[i]->value, i); + if (in[i]->value != self->count) { + lf_print_error_and_exit("Expected %d.", self->count); + } + self->count += self->stride; } self->inputs_received++; =} @@ -32,10 +32,10 @@ reactor TestCountMultiport(start: int = 1, stride: int = 1, num_inputs: int = 1, reaction(shutdown) {= lf_print("Shutdown invoked."); if (self->inputs_received != self->num_inputs) { - lf_print_error_and_exit("Expected to receive %d inputs, but only got %d.", - self->num_inputs, - self->inputs_received - ); + lf_print_error_and_exit("Expected to receive %d inputs, but only got %d.", + self->num_inputs, + self->inputs_received + ); } =} } diff --git a/test/C/src/modal_models/BanksCount3ModesComplex.lf b/test/C/src/modal_models/BanksCount3ModesComplex.lf index 220f63c949..e548d28cef 100644 --- a/test/C/src/modal_models/BanksCount3ModesComplex.lf +++ b/test/C/src/modal_models/BanksCount3ModesComplex.lf @@ -50,30 +50,30 @@ main reactor { timer stepper(0, 250 msec) counters = new[2] MetaCounter() test = new TraceTesting( // keep-format - events_size = 16, - trace_size = 429, - trace = { - 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 250000000,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 250000000,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 250000000,1,1,1,1,1,1,1,1,0,3,0,3,0,3,0,3,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, - 250000000,1,2,1,2,1,2,1,2,0,3,0,3,0,3,0,3,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0, - 250000000,1,3,1,3,1,3,1,3,1,1,1,1,1,1,1,1,0,2,0,2,0,2,0,2,0,0,0,0,0,0,0,0, - 250000000,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, - 250000000,1,2,1,2,1,2,1,2,0,1,0,1,0,1,0,1,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0, - 250000000,1,3,1,3,1,3,1,3,1,2,1,2,1,2,1,2,0,2,0,2,0,2,0,2,0,0,0,0,0,0,0,0, - 250000000,1,1,1,1,1,1,1,1,0,2,0,2,0,2,0,2,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, - 250000000,1,2,1,2,1,2,1,2,0,2,0,2,0,2,0,2,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0, - 250000000,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,0,2,0,2,0,2,0,2,0,0,0,0,0,0,0,0, - 250000000,1,1,1,1,1,1,1,1,0,3,0,3,0,3,0,3,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0 - }, training = false) + events_size = 16, + trace_size = 429, + trace = { + 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 250000000,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 250000000,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 250000000,1,1,1,1,1,1,1,1,0,3,0,3,0,3,0,3,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, + 250000000,1,2,1,2,1,2,1,2,0,3,0,3,0,3,0,3,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0, + 250000000,1,3,1,3,1,3,1,3,1,1,1,1,1,1,1,1,0,2,0,2,0,2,0,2,0,0,0,0,0,0,0,0, + 250000000,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, + 250000000,1,2,1,2,1,2,1,2,0,1,0,1,0,1,0,1,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0, + 250000000,1,3,1,3,1,3,1,3,1,2,1,2,1,2,1,2,0,2,0,2,0,2,0,2,0,0,0,0,0,0,0,0, + 250000000,1,1,1,1,1,1,1,1,0,2,0,2,0,2,0,2,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, + 250000000,1,2,1,2,1,2,1,2,0,2,0,2,0,2,0,2,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0, + 250000000,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,0,2,0,2,0,2,0,2,0,0,0,0,0,0,0,0, + 250000000,1,1,1,1,1,1,1,1,0,3,0,3,0,3,0,3,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0 + }, training = false) counters.always, counters.mode1, counters.mode2, counters.never -> test.events // Trigger reaction(stepper) -> counters.next {= for(int i = 0; i < 2; i++) { - lf_set(counters[i].next, true); + lf_set(counters[i].next, true); } =} } diff --git a/test/C/src/modal_models/BanksCount3ModesSimple.lf b/test/C/src/modal_models/BanksCount3ModesSimple.lf index e4f9ea6ec6..be676898ab 100644 --- a/test/C/src/modal_models/BanksCount3ModesSimple.lf +++ b/test/C/src/modal_models/BanksCount3ModesSimple.lf @@ -11,15 +11,15 @@ main reactor { timer stepper(0, 250 msec) counters = new[3] CounterCycle() test = new TraceTesting(events_size = 3, trace_size = 63, trace = { // keep-format - 0,1,1,1,1,1,1, - 250000000,1,2,1,2,1,2, - 250000000,1,3,1,3,1,3, - 250000000,1,1,1,1,1,1, - 250000000,1,2,1,2,1,2, - 250000000,1,3,1,3,1,3, - 250000000,1,1,1,1,1,1, - 250000000,1,2,1,2,1,2, - 250000000,1,3,1,3,1,3 + 0,1,1,1,1,1,1, + 250000000,1,2,1,2,1,2, + 250000000,1,3,1,3,1,3, + 250000000,1,1,1,1,1,1, + 250000000,1,2,1,2,1,2, + 250000000,1,3,1,3,1,3, + 250000000,1,1,1,1,1,1, + 250000000,1,2,1,2,1,2, + 250000000,1,3,1,3,1,3 }, training = false) counters.count -> test.events @@ -27,7 +27,7 @@ main reactor { // Trigger reaction(stepper) -> counters.next {= for(int i = 0; i < 3; i++) { - lf_set(counters[i].next, true); + lf_set(counters[i].next, true); } =} } diff --git a/test/C/src/modal_models/BanksModalStateReset.lf b/test/C/src/modal_models/BanksModalStateReset.lf index 90d7eaf932..83c4af89fb 100644 --- a/test/C/src/modal_models/BanksModalStateReset.lf +++ b/test/C/src/modal_models/BanksModalStateReset.lf @@ -14,25 +14,25 @@ main reactor { reset1 = new[2] ResetReaction() reset2 = new[2] AutoReset() test = new TraceTesting(events_size = 16, trace_size = 627, trace = { // keep-format - 0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, - 250000000,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0, 0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0, - 250000000,0,0,0,0,0,0,0,0,1,2,1,2,0,0,0,0, 0,0,0,0,0,0,0,0,1,2,1,2,0,0,0,0, - 250000000,0,0,0,0,0,0,0,0,1,3,1,3,0,0,0,0, 0,0,0,0,0,0,0,0,1,3,1,3,0,0,0,0, - 250000000,1,1,1,1,1,0,1,0,1,4,1,4,0,0,0,0, 1,1,1,1,1,0,1,0,1,4,1,4,0,0,0,0, - 0,0,1,0,1,0,0,0,0,0,4,0,4,1,-2,1,-2, 0,1,0,1,0,0,0,0,0,4,0,4,1,-2,1,-2, - 250000000,0,1,0,1,0,0,0,0,0,4,0,4,1,-1,1,-1, 0,1,0,1,0,0,0,0,0,4,0,4,1,-1,1,-1, - 250000000,0,1,0,1,0,0,0,0,0,4,0,4,1,0,1,0, 0,1,0,1,0,0,0,0,0,4,0,4,1,0,1,0, - 250000000,0,1,0,1,0,0,0,0,0,4,0,4,1,1,1,1, 0,1,0,1,0,0,0,0,0,4,0,4,1,1,1,1, - 250000000,1,1,1,1,1,1,1,1,0,4,0,4,1,2,1,2, 1,1,1,1,1,1,1,1,0,4,0,4,1,2,1,2, - 250000000,0,1,0,1,0,1,0,1,1,5,1,5,0,2,0,2, 0,1,0,1,0,1,0,1,1,5,1,5,0,2,0,2, - 250000000,0,1,0,1,0,1,0,1,1,6,1,6,0,2,0,2, 0,1,0,1,0,1,0,1,1,6,1,6,0,2,0,2, - 250000000,0,1,0,1,0,1,0,1,1,7,1,7,0,2,0,2, 0,1,0,1,0,1,0,1,1,7,1,7,0,2,0,2, - 250000000,1,1,1,1,1,2,1,2,1,8,1,8,0,2,0,2, 1,1,1,1,1,2,1,2,1,8,1,8,0,2,0,2, - 0,0,1,0,1,0,2,0,2,0,8,0,8,1,-2,1,-2, 0,1,0,1,0,2,0,2,0,8,0,8,1,-2,1,-2, - 250000000,0,1,0,1,0,2,0,2,0,8,0,8,1,-1,1,-1, 0,1,0,1,0,2,0,2,0,8,0,8,1,-1,1,-1, - 250000000,0,1,0,1,0,2,0,2,0,8,0,8,1,0,1,0, 0,1,0,1,0,2,0,2,0,8,0,8,1,0,1,0, - 250000000,0,1,0,1,0,2,0,2,0,8,0,8,1,1,1,1, 0,1,0,1,0,2,0,2,0,8,0,8,1,1,1,1, - 250000000,1,1,1,1,1,3,1,3,0,8,0,8,1,2,1,2, 1,1,1,1,1,3,1,3,0,8,0,8,1,2,1,2 + 0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, + 250000000,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0, 0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0, + 250000000,0,0,0,0,0,0,0,0,1,2,1,2,0,0,0,0, 0,0,0,0,0,0,0,0,1,2,1,2,0,0,0,0, + 250000000,0,0,0,0,0,0,0,0,1,3,1,3,0,0,0,0, 0,0,0,0,0,0,0,0,1,3,1,3,0,0,0,0, + 250000000,1,1,1,1,1,0,1,0,1,4,1,4,0,0,0,0, 1,1,1,1,1,0,1,0,1,4,1,4,0,0,0,0, + 0,0,1,0,1,0,0,0,0,0,4,0,4,1,-2,1,-2, 0,1,0,1,0,0,0,0,0,4,0,4,1,-2,1,-2, + 250000000,0,1,0,1,0,0,0,0,0,4,0,4,1,-1,1,-1, 0,1,0,1,0,0,0,0,0,4,0,4,1,-1,1,-1, + 250000000,0,1,0,1,0,0,0,0,0,4,0,4,1,0,1,0, 0,1,0,1,0,0,0,0,0,4,0,4,1,0,1,0, + 250000000,0,1,0,1,0,0,0,0,0,4,0,4,1,1,1,1, 0,1,0,1,0,0,0,0,0,4,0,4,1,1,1,1, + 250000000,1,1,1,1,1,1,1,1,0,4,0,4,1,2,1,2, 1,1,1,1,1,1,1,1,0,4,0,4,1,2,1,2, + 250000000,0,1,0,1,0,1,0,1,1,5,1,5,0,2,0,2, 0,1,0,1,0,1,0,1,1,5,1,5,0,2,0,2, + 250000000,0,1,0,1,0,1,0,1,1,6,1,6,0,2,0,2, 0,1,0,1,0,1,0,1,1,6,1,6,0,2,0,2, + 250000000,0,1,0,1,0,1,0,1,1,7,1,7,0,2,0,2, 0,1,0,1,0,1,0,1,1,7,1,7,0,2,0,2, + 250000000,1,1,1,1,1,2,1,2,1,8,1,8,0,2,0,2, 1,1,1,1,1,2,1,2,1,8,1,8,0,2,0,2, + 0,0,1,0,1,0,2,0,2,0,8,0,8,1,-2,1,-2, 0,1,0,1,0,2,0,2,0,8,0,8,1,-2,1,-2, + 250000000,0,1,0,1,0,2,0,2,0,8,0,8,1,-1,1,-1, 0,1,0,1,0,2,0,2,0,8,0,8,1,-1,1,-1, + 250000000,0,1,0,1,0,2,0,2,0,8,0,8,1,0,1,0, 0,1,0,1,0,2,0,2,0,8,0,8,1,0,1,0, + 250000000,0,1,0,1,0,2,0,2,0,8,0,8,1,1,1,1, 0,1,0,1,0,2,0,2,0,8,0,8,1,1,1,1, + 250000000,1,1,1,1,1,3,1,3,0,8,0,8,1,2,1,2, 1,1,1,1,1,3,1,3,0,8,0,8,1,2,1,2 }, training = false) reset1.mode_switch, @@ -47,13 +47,13 @@ main reactor { // Trigger mode change (separately because of #1278) reaction(stepper) -> reset1.next {= for(int i = 0; i < reset1_width; i++) { - lf_set(reset1[i].next, true); + lf_set(reset1[i].next, true); } =} reaction(stepper) -> reset2.next {= for(int i = 0; i < reset2_width; i++) { - lf_set(reset2[i].next, true); + lf_set(reset2[i].next, true); } =} } diff --git a/test/C/src/modal_models/ConvertCaseTest.lf b/test/C/src/modal_models/ConvertCaseTest.lf index 400c40e9ad..09cb159f2d 100644 --- a/test/C/src/modal_models/ConvertCaseTest.lf +++ b/test/C/src/modal_models/ConvertCaseTest.lf @@ -52,12 +52,12 @@ reactor Converter { reaction(raw) -> converted, reset(Lower) {= char c = raw->value; if (c >= 'a' && c <= 'z') { - lf_set(converted, c - 32); + lf_set(converted, c - 32); } else { - lf_set(converted, c); + lf_set(converted, c); } if (c == ' ') { - lf_set_mode(Lower); + lf_set_mode(Lower); } =} } @@ -66,12 +66,12 @@ reactor Converter { reaction(raw) -> converted, reset(Upper) {= char c = raw->value; if (c >= 'A' && c <= 'Z') { - lf_set(converted, c + 32); + lf_set(converted, c + 32); } else { - lf_set(converted, c); + lf_set(converted, c); } if (c == ' ') { - lf_set_mode(Upper); + lf_set_mode(Upper); } =} } @@ -89,8 +89,8 @@ reactor InputFeeder(message: string = "") { reaction(t) -> character {= if (self->idx < strlen(self->message)) { - lf_set(character, *(self->message + self->idx)); - self->idx++; + lf_set(character, *(self->message + self->idx)); + self->idx++; } =} } @@ -106,18 +106,18 @@ main reactor { feeder.character -> history_processor.character test = new TraceTesting(events_size = 2, trace_size = 60, trace = { // keep-format - 0,1,72,1,72, - 250000000,1,69,1,69, - 250000000,1,76,1,76, - 250000000,1,95,1,95, - 250000000,1,79,1,79, - 250000000,1,32,1,32, - 250000000,1,119,1,119, - 250000000,1,95,1,95, - 250000000,1,82,1,114, - 250000000,1,76,1,108, - 250000000,1,68,1,100, - 250000000,1,95,1,95 + 0,1,72,1,72, + 250000000,1,69,1,69, + 250000000,1,76,1,76, + 250000000,1,95,1,95, + 250000000,1,79,1,79, + 250000000,1,32,1,32, + 250000000,1,119,1,119, + 250000000,1,95,1,95, + 250000000,1,82,1,114, + 250000000,1,76,1,108, + 250000000,1,68,1,100, + 250000000,1,95,1,95 }, training = false) reset_processor.converted, history_processor.converted -> test.events diff --git a/test/C/src/modal_models/Count3Modes.lf b/test/C/src/modal_models/Count3Modes.lf index dc4063d865..3c2b419a00 100644 --- a/test/C/src/modal_models/Count3Modes.lf +++ b/test/C/src/modal_models/Count3Modes.lf @@ -43,17 +43,17 @@ main reactor { printf("%d\n", counter.count->value); if (!counter.count->is_present) { - printf("ERROR: Missing mode change.\n"); - exit(1); + printf("ERROR: Missing mode change.\n"); + exit(1); } else if (counter.count->value != self->expected_value) { - printf("ERROR: Wrong mode.\n"); - exit(2); + printf("ERROR: Wrong mode.\n"); + exit(2); } if (self->expected_value == 3) { - self->expected_value = 1; + self->expected_value = 1; } else { - self->expected_value++; + self->expected_value++; } =} } diff --git a/test/C/src/modal_models/MixedReactions.lf b/test/C/src/modal_models/MixedReactions.lf index 274cf77573..ed9ae422f3 100644 --- a/test/C/src/modal_models/MixedReactions.lf +++ b/test/C/src/modal_models/MixedReactions.lf @@ -34,13 +34,13 @@ main reactor { printf("%d\n", self->x); if (self->first) { if (self->x != 1234) { - printf("ERROR: Wrong reaction order.\n"); - exit(1); + printf("ERROR: Wrong reaction order.\n"); + exit(1); } self->first = false; } else if (self->x != 12341245) { - printf("ERROR: Wrong reaction order.\n"); - exit(2); + printf("ERROR: Wrong reaction order.\n"); + exit(2); } =} } diff --git a/test/C/src/modal_models/ModalActions.lf b/test/C/src/modal_models/ModalActions.lf index 449119d315..cf473cd125 100644 --- a/test/C/src/modal_models/ModalActions.lf +++ b/test/C/src/modal_models/ModalActions.lf @@ -66,21 +66,21 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 5, trace_size = 165, trace = { // keep-format - 0,0,0,1,1,0,0,0,0,0,0, - 500000000,0,0,0,1,1,1,0,0,0,0, - 250000000,0,0,1,1,0,1,0,0,0,0, - 250000000,1,1,0,1,0,1,0,0,0,0, - 0,0,1,0,1,0,1,1,1,0,0, - 500000000,0,1,0,1,0,1,0,1,1,1, - 250000000,0,1,0,1,0,1,1,1,0,1, - 250000000,1,1,0,1,0,1,0,1,0,1, - 250000000,0,1,0,1,1,1,0,1,0,1, - 250000000,0,1,1,1,0,1,0,1,0,1, - 500000000,1,1,0,1,1,1,0,1,0,1, - 0,0,1,0,1,0,1,1,1,0,1, - 500000000,0,1,0,1,0,1,0,1,1,1, - 250000000,0,1,0,1,0,1,1,1,0,1, - 250000000,1,1,0,1,0,1,0,1,0,1 + 0,0,0,1,1,0,0,0,0,0,0, + 500000000,0,0,0,1,1,1,0,0,0,0, + 250000000,0,0,1,1,0,1,0,0,0,0, + 250000000,1,1,0,1,0,1,0,0,0,0, + 0,0,1,0,1,0,1,1,1,0,0, + 500000000,0,1,0,1,0,1,0,1,1,1, + 250000000,0,1,0,1,0,1,1,1,0,1, + 250000000,1,1,0,1,0,1,0,1,0,1, + 250000000,0,1,0,1,1,1,0,1,0,1, + 250000000,0,1,1,1,0,1,0,1,0,1, + 500000000,1,1,0,1,1,1,0,1,0,1, + 0,0,1,0,1,0,1,1,1,0,1, + 500000000,0,1,0,1,0,1,0,1,1,1, + 250000000,0,1,0,1,0,1,1,1,0,1, + 250000000,1,1,0,1,0,1,0,1,0,1 }, training = false) modal.mode_switch, diff --git a/test/C/src/modal_models/ModalAfter.lf b/test/C/src/modal_models/ModalAfter.lf index f0ddd8ea6e..0b0c7251fc 100644 --- a/test/C/src/modal_models/ModalAfter.lf +++ b/test/C/src/modal_models/ModalAfter.lf @@ -19,8 +19,8 @@ reactor Modal { output consumed2: int initial mode One { - producer1 = new Producer(mode_id = 1) - consumer1 = new Consumer(mode_id = 1) + producer1 = new Producer(mode_id=1) + consumer1 = new Consumer(mode_id=1) producer1.product -> produced1 producer1.product -> consumer1.product after 500 msec consumer1.report -> consumed1 @@ -32,8 +32,8 @@ reactor Modal { } mode Two { - producer2 = new Producer(mode_id = 2) - consumer2 = new Consumer(mode_id = 2) + producer2 = new Producer(mode_id=2) + consumer2 = new Consumer(mode_id=2) producer2.product -> produced2 producer2.product -> consumer2.product after 500 msec consumer2.report -> consumed2 @@ -71,21 +71,21 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 5, trace_size = 165, trace = { // keep-format - 0,0,0,1,1,0,0,0,0,0,0, - 500000000,0,0,0,1,1,1,0,0,0,0, - 250000000,0,0,1,1,0,1,0,0,0,0, - 250000000,1,1,0,1,0,1,0,0,0,0, - 0,0,1,0,1,0,1,1,1,0,0, - 500000000,0,1,0,1,0,1,0,1,1,1, - 250000000,0,1,0,1,0,1,1,1,0,1, - 250000000,1,1,0,1,0,1,0,1,0,1, - 250000000,0,1,0,1,1,1,0,1,0,1, - 250000000,0,1,1,1,0,1,0,1,0,1, - 500000000,1,1,0,1,1,1,0,1,0,1, - 0,0,1,0,1,0,1,1,1,0,1, - 500000000,0,1,0,1,0,1,0,1,1,1, - 250000000,0,1,0,1,0,1,1,1,0,1, - 250000000,1,1,0,1,0,1,0,1,0,1 + 0,0,0,1,1,0,0,0,0,0,0, + 500000000,0,0,0,1,1,1,0,0,0,0, + 250000000,0,0,1,1,0,1,0,0,0,0, + 250000000,1,1,0,1,0,1,0,0,0,0, + 0,0,1,0,1,0,1,1,1,0,0, + 500000000,0,1,0,1,0,1,0,1,1,1, + 250000000,0,1,0,1,0,1,1,1,0,1, + 250000000,1,1,0,1,0,1,0,1,0,1, + 250000000,0,1,0,1,1,1,0,1,0,1, + 250000000,0,1,1,1,0,1,0,1,0,1, + 500000000,1,1,0,1,1,1,0,1,0,1, + 0,0,1,0,1,0,1,1,1,0,1, + 500000000,0,1,0,1,0,1,0,1,1,1, + 250000000,0,1,0,1,0,1,1,1,0,1, + 250000000,1,1,0,1,0,1,0,1,0,1 }, training = false) modal.mode_switch, modal.produced1, modal.consumed1, modal.produced2, modal.consumed2 diff --git a/test/C/src/modal_models/ModalCycleBreaker.lf b/test/C/src/modal_models/ModalCycleBreaker.lf index 4ac9f509a7..428555e165 100644 --- a/test/C/src/modal_models/ModalCycleBreaker.lf +++ b/test/C/src/modal_models/ModalCycleBreaker.lf @@ -34,8 +34,8 @@ reactor Modal { reaction(in1) -> reset(Two) {= if (in1->value % 5 == 4) { - lf_set_mode(Two); - printf("Switching to mode Two\n"); + lf_set_mode(Two); + printf("Switching to mode Two\n"); } =} } @@ -54,15 +54,15 @@ main reactor { counter = new Counter(period = 100 msec) modal = new Modal() test = new TraceTesting(events_size = 1, trace_size = 27, trace = { // keep-format - 0,1,0, - 100000000,1,1, - 100000000,1,2, - 100000000,1,3, - 100000000,1,4, - 200000000,1,6, - 100000000,1,7, - 100000000,1,8, - 100000000,1,9 + 0,1,0, + 100000000,1,1, + 100000000,1,2, + 100000000,1,3, + 100000000,1,4, + 200000000,1,6, + 100000000,1,7, + 100000000,1,8, + 100000000,1,9 }, training = false) counter.value -> modal.in1 diff --git a/test/C/src/modal_models/ModalNestedReactions.lf b/test/C/src/modal_models/ModalNestedReactions.lf index be7d19fe7c..e796c3df31 100644 --- a/test/C/src/modal_models/ModalNestedReactions.lf +++ b/test/C/src/modal_models/ModalNestedReactions.lf @@ -51,14 +51,14 @@ main reactor { printf("%d\n", counter.count->value); if (!counter.count->is_present) { - printf("ERROR: Missing mode change.\n"); - exit(1); + printf("ERROR: Missing mode change.\n"); + exit(1); } else if (counter.only_in_two->is_present && counter.count->value != 2) { - printf("ERROR: Indirectly nested reaction was not properly deactivated.\n"); - exit(2); + printf("ERROR: Indirectly nested reaction was not properly deactivated.\n"); + exit(2); } else if (!counter.only_in_two->is_present && counter.count->value == 2) { - printf("ERROR: Missing output from indirectly nested reaction.\n"); - exit(3); + printf("ERROR: Missing output from indirectly nested reaction.\n"); + exit(3); } =} diff --git a/test/C/src/modal_models/ModalStartupShutdown.lf b/test/C/src/modal_models/ModalStartupShutdown.lf index 3de03e3ab5..d26a743ec7 100644 --- a/test/C/src/modal_models/ModalStartupShutdown.lf +++ b/test/C/src/modal_models/ModalStartupShutdown.lf @@ -112,17 +112,17 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 11, trace_size = 253, trace = { // keep-format - 0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 500000000,1,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,2,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 500000000,1,3,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 500000000,1,4,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,4,0,1,0,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0, - 500000000,1,4,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0, - 0,0,4,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0, - 500000000,1,4,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0, - 0,0,4,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0, - 500000000,1,4,0,1,0,1,1,1,1,1,0,1,0,1,1,1,0,0,0,0,0,0 + 0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 500000000,1,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,2,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 500000000,1,3,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 500000000,1,4,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,4,0,1,0,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0, + 500000000,1,4,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0, + 0,0,4,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0, + 500000000,1,4,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0, + 0,0,4,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0, + 500000000,1,4,0,1,0,1,1,1,1,1,0,1,0,1,1,1,0,0,0,0,0,0 }, training = false) modal.mode_switch, diff --git a/test/C/src/modal_models/ModalStateReset.lf b/test/C/src/modal_models/ModalStateReset.lf index 46f94958cd..181a8b1189 100644 --- a/test/C/src/modal_models/ModalStateReset.lf +++ b/test/C/src/modal_models/ModalStateReset.lf @@ -61,25 +61,25 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 4, trace_size = 171, trace = { // keep-format - 0,0,0,0,0,1,0,0,0, - 250000000,0,0,0,0,1,1,0,0, - 250000000,0,0,0,0,1,2,0,0, - 250000000,0,0,0,0,1,3,0,0, - 250000000,1,1,1,0,1,4,0,0, - 0,0,1,0,0,0,4,1,-2, - 250000000,0,1,0,0,0,4,1,-1, - 250000000,0,1,0,0,0,4,1,0, - 250000000,0,1,0,0,0,4,1,1, - 250000000,1,1,1,1,0,4,1,2, - 250000000,0,1,0,1,1,5,0,2, - 250000000,0,1,0,1,1,6,0,2, - 250000000,0,1,0,1,1,7,0,2, - 250000000,1,1,1,2,1,8,0,2, - 0,0,1,0,2,0,8,1,-2, - 250000000,0,1,0,2,0,8,1,-1, - 250000000,0,1,0,2,0,8,1,0, - 250000000,0,1,0,2,0,8,1,1, - 250000000,1,1,1,3,0,8,1,2 + 0,0,0,0,0,1,0,0,0, + 250000000,0,0,0,0,1,1,0,0, + 250000000,0,0,0,0,1,2,0,0, + 250000000,0,0,0,0,1,3,0,0, + 250000000,1,1,1,0,1,4,0,0, + 0,0,1,0,0,0,4,1,-2, + 250000000,0,1,0,0,0,4,1,-1, + 250000000,0,1,0,0,0,4,1,0, + 250000000,0,1,0,0,0,4,1,1, + 250000000,1,1,1,1,0,4,1,2, + 250000000,0,1,0,1,1,5,0,2, + 250000000,0,1,0,1,1,6,0,2, + 250000000,0,1,0,1,1,7,0,2, + 250000000,1,1,1,2,1,8,0,2, + 0,0,1,0,2,0,8,1,-2, + 250000000,0,1,0,2,0,8,1,-1, + 250000000,0,1,0,2,0,8,1,0, + 250000000,0,1,0,2,0,8,1,1, + 250000000,1,1,1,3,0,8,1,2 }, training = false) modal.mode_switch, modal.count0, modal.count1, modal.count2 -> test.events diff --git a/test/C/src/modal_models/ModalStateResetAuto.lf b/test/C/src/modal_models/ModalStateResetAuto.lf index be13d7b58e..82832da72d 100644 --- a/test/C/src/modal_models/ModalStateResetAuto.lf +++ b/test/C/src/modal_models/ModalStateResetAuto.lf @@ -57,25 +57,25 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 4, trace_size = 171, trace = { // keep-format - 0,0,0,0,0,1,0,0,0, - 250000000,0,0,0,0,1,1,0,0, - 250000000,0,0,0,0,1,2,0,0, - 250000000,0,0,0,0,1,3,0,0, - 250000000,1,1,1,0,1,4,0,0, - 0,0,1,0,0,0,4,1,-2, - 250000000,0,1,0,0,0,4,1,-1, - 250000000,0,1,0,0,0,4,1,0, - 250000000,0,1,0,0,0,4,1,1, - 250000000,1,1,1,1,0,4,1,2, - 250000000,0,1,0,1,1,5,0,2, - 250000000,0,1,0,1,1,6,0,2, - 250000000,0,1,0,1,1,7,0,2, - 250000000,1,1,1,2,1,8,0,2, - 0,0,1,0,2,0,8,1,-2, - 250000000,0,1,0,2,0,8,1,-1, - 250000000,0,1,0,2,0,8,1,0, - 250000000,0,1,0,2,0,8,1,1, - 250000000,1,1,1,3,0,8,1,2 + 0,0,0,0,0,1,0,0,0, + 250000000,0,0,0,0,1,1,0,0, + 250000000,0,0,0,0,1,2,0,0, + 250000000,0,0,0,0,1,3,0,0, + 250000000,1,1,1,0,1,4,0,0, + 0,0,1,0,0,0,4,1,-2, + 250000000,0,1,0,0,0,4,1,-1, + 250000000,0,1,0,0,0,4,1,0, + 250000000,0,1,0,0,0,4,1,1, + 250000000,1,1,1,1,0,4,1,2, + 250000000,0,1,0,1,1,5,0,2, + 250000000,0,1,0,1,1,6,0,2, + 250000000,0,1,0,1,1,7,0,2, + 250000000,1,1,1,2,1,8,0,2, + 0,0,1,0,2,0,8,1,-2, + 250000000,0,1,0,2,0,8,1,-1, + 250000000,0,1,0,2,0,8,1,0, + 250000000,0,1,0,2,0,8,1,1, + 250000000,1,1,1,3,0,8,1,2 }, training = false) modal.mode_switch, modal.count0, modal.count1, modal.count2 -> test.events diff --git a/test/C/src/modal_models/ModalTimers.lf b/test/C/src/modal_models/ModalTimers.lf index 0ceaddd3a6..8e67b6aa75 100644 --- a/test/C/src/modal_models/ModalTimers.lf +++ b/test/C/src/modal_models/ModalTimers.lf @@ -47,17 +47,17 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 3, trace_size = 77, trace = { // keep-format - 0,0,0,1,1,0,0, - 750000000,0,0,1,1,0,0, - 250000000,1,1,0,1,0,0, - 0,0,1,0,1,1,1, - 750000000,0,1,0,1,1,1, - 250000000,1,1,0,1,0,1, - 500000000,0,1,1,1,0,1, - 500000000,1,1,0,1,0,1, - 0,0,1,0,1,1,1, - 750000000,0,1,0,1,1,1, - 250000000,1,1,0,1,0,1 + 0,0,0,1,1,0,0, + 750000000,0,0,1,1,0,0, + 250000000,1,1,0,1,0,0, + 0,0,1,0,1,1,1, + 750000000,0,1,0,1,1,1, + 250000000,1,1,0,1,0,1, + 500000000,0,1,1,1,0,1, + 500000000,1,1,0,1,0,1, + 0,0,1,0,1,1,1, + 750000000,0,1,0,1,1,1, + 250000000,1,1,0,1,0,1 }, training = false) modal.mode_switch, modal.timer1, modal.timer2 -> test.events diff --git a/test/C/src/modal_models/MultipleOutputFeeder_2Connections.lf b/test/C/src/modal_models/MultipleOutputFeeder_2Connections.lf index 198ba0fd37..637f546498 100644 --- a/test/C/src/modal_models/MultipleOutputFeeder_2Connections.lf +++ b/test/C/src/modal_models/MultipleOutputFeeder_2Connections.lf @@ -42,23 +42,23 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 1, trace_size = 51, trace = { // keep-format - 0,1,0, - 250000000,1,1, - 250000000,1,2, - 0,1,0, - 100000000,1,1, - 100000000,1,2, - 100000000,1,3, - 100000000,1,4, - 100000000,1,5, - 250000000,1,3, - 250000000,1,4, - 0,1,0, - 100000000,1,1, - 100000000,1,2, - 100000000,1,3, - 100000000,1,4, - 100000000,1,5 + 0,1,0, + 250000000,1,1, + 250000000,1,2, + 0,1,0, + 100000000,1,1, + 100000000,1,2, + 100000000,1,3, + 100000000,1,4, + 100000000,1,5, + 250000000,1,3, + 250000000,1,4, + 0,1,0, + 100000000,1,1, + 100000000,1,2, + 100000000,1,3, + 100000000,1,4, + 100000000,1,5 }, training = false) modal.count -> test.events diff --git a/test/C/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf b/test/C/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf index fe3c4dde17..1281b3f490 100644 --- a/test/C/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf +++ b/test/C/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf @@ -43,23 +43,23 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 1, trace_size = 51, trace = { // keep-format - 0,1,0, - 250000000,1,1, - 250000000,1,2, - 0,1,0, - 100000000,1,10, - 100000000,1,20, - 100000000,1,30, - 100000000,1,40, - 100000000,1,50, - 250000000,1,3, - 250000000,1,4, - 0,1,0, - 100000000,1,10, - 100000000,1,20, - 100000000,1,30, - 100000000,1,40, - 100000000,1,50 + 0,1,0, + 250000000,1,1, + 250000000,1,2, + 0,1,0, + 100000000,1,10, + 100000000,1,20, + 100000000,1,30, + 100000000,1,40, + 100000000,1,50, + 250000000,1,3, + 250000000,1,4, + 0,1,0, + 100000000,1,10, + 100000000,1,20, + 100000000,1,30, + 100000000,1,40, + 100000000,1,50 }, training = false) modal.count -> test.events diff --git a/test/C/src/modal_models/util/TraceTesting.lf b/test/C/src/modal_models/util/TraceTesting.lf index 38b78b4173..86908ad2e5 100644 --- a/test/C/src/modal_models/util/TraceTesting.lf +++ b/test/C/src/modal_models/util/TraceTesting.lf @@ -2,11 +2,10 @@ target C reactor TraceTesting( - events_size: int = 0, - trace_size: int = 0, - trace: int[] = 0, - training: bool = false -) { + events_size: int = 0, + trace_size: int = 0, + trace: int[] = 0, + training: bool = false) { input[events_size] events: int state last_reaction_time: int = 0 @@ -21,43 +20,43 @@ reactor TraceTesting( int curr_reaction_delay = lf_time_logical() - self->last_reaction_time; if (self->training) { - // Save time - self->recorded_events = (int*) realloc(self->recorded_events, sizeof(int) * (self->recorded_events_next + 1 + 2 * self->events_size)); - self->recorded_events[self->recorded_events_next++] = curr_reaction_delay; + // Save time + self->recorded_events = (int*) realloc(self->recorded_events, sizeof(int) * (self->recorded_events_next + 1 + 2 * self->events_size)); + self->recorded_events[self->recorded_events_next++] = curr_reaction_delay; } else { - if (self->trace_idx >= self->trace_size) { - printf("ERROR: Trace Error: Current execution exceeds given trace.\n"); - exit(1); - } + if (self->trace_idx >= self->trace_size) { + printf("ERROR: Trace Error: Current execution exceeds given trace.\n"); + exit(1); + } - int trace_reaction_delay = self->trace[self->trace_idx++]; + int trace_reaction_delay = self->trace[self->trace_idx++]; - if (curr_reaction_delay != trace_reaction_delay) { - printf("ERROR: Trace Mismatch: Unexpected reaction timing. (delay: %d, expected: %d)\n", curr_reaction_delay, trace_reaction_delay); - exit(2); - } + if (curr_reaction_delay != trace_reaction_delay) { + printf("ERROR: Trace Mismatch: Unexpected reaction timing. (delay: %d, expected: %d)\n", curr_reaction_delay, trace_reaction_delay); + exit(2); + } } for (int i = 0; i < self->events_size; i++) { - int curr_present = events[i]->is_present; - int curr_value = events[i]->value; + int curr_present = events[i]->is_present; + int curr_value = events[i]->value; - if (self->training) { - // Save event - self->recorded_events[self->recorded_events_next++] = curr_present; - self->recorded_events[self->recorded_events_next++] = curr_value; - } else { - int trace_present = self->trace[self->trace_idx++]; - int trace_value = self->trace[self->trace_idx++]; + if (self->training) { + // Save event + self->recorded_events[self->recorded_events_next++] = curr_present; + self->recorded_events[self->recorded_events_next++] = curr_value; + } else { + int trace_present = self->trace[self->trace_idx++]; + int trace_value = self->trace[self->trace_idx++]; - if (trace_present != curr_present) { - printf("ERROR: Trace Mismatch: Unexpected event presence. (event: %d, presence: %d, expected: %d)\n", i, curr_present, trace_present); - exit(3); - } else if (curr_present && trace_value != curr_value) { - printf("ERROR: Trace Mismatch: Unexpected event value. (event: %d, presence: %d, expected: %d)\n", i, curr_value, trace_value); - exit(4); - } + if (trace_present != curr_present) { + printf("ERROR: Trace Mismatch: Unexpected event presence. (event: %d, presence: %d, expected: %d)\n", i, curr_present, trace_present); + exit(3); + } else if (curr_present && trace_value != curr_value) { + printf("ERROR: Trace Mismatch: Unexpected event value. (event: %d, presence: %d, expected: %d)\n", i, curr_value, trace_value); + exit(4); } + } } self->last_reaction_time = lf_time_logical(); @@ -65,16 +64,16 @@ reactor TraceTesting( reaction(shutdown) {= if (self->training) { - printf("Recorded event trace (%d): (", self->recorded_events_next); - for (int i = 0; i < self->recorded_events_next; i++) { - printf("%d", self->recorded_events[i]); - if (i < self->recorded_events_next - 1) { - printf(","); - } + printf("Recorded event trace (%d): (", self->recorded_events_next); + for (int i = 0; i < self->recorded_events_next; i++) { + printf("%d", self->recorded_events[i]); + if (i < self->recorded_events_next - 1) { + printf(","); } - printf(")\n"); + } + printf(")\n"); - free(self->recorded_events); + free(self->recorded_events); } =} } diff --git a/test/C/src/multiport/BankIndexInitializer.lf b/test/C/src/multiport/BankIndexInitializer.lf index 4c24c2d92b..434e59104a 100644 --- a/test/C/src/multiport/BankIndexInitializer.lf +++ b/test/C/src/multiport/BankIndexInitializer.lf @@ -17,25 +17,25 @@ reactor Sink(width: int = 4) { reaction(in) {= for (int idx = 0; idx < in_width; idx++) { - if (in[idx]->is_present) { - printf("Received on channel %d: %d\n", idx, in[idx]->value); - self->received = true; - if (in[idx]->value != 4 - idx) { - lf_print_error_and_exit("Expected %d.", 4 - idx); - } + if (in[idx]->is_present) { + printf("Received on channel %d: %d\n", idx, in[idx]->value); + self->received = true; + if (in[idx]->value != 4 - idx) { + lf_print_error_and_exit("Expected %d.", 4 - idx); } + } } =} reaction(shutdown) {= if (!self->received) { - lf_print_error_and_exit("Sink received no data."); + lf_print_error_and_exit("Sink received no data."); } =} } main reactor(width: int = 4) { source = new[width] Source(value = {= table[bank_index] =}) - sink = new Sink(width = width) + sink = new Sink(width=width) source.out -> sink.in } diff --git a/test/C/src/multiport/BankMulticast.lf b/test/C/src/multiport/BankMulticast.lf index 312a073464..4c675d7c92 100644 --- a/test/C/src/multiport/BankMulticast.lf +++ b/test/C/src/multiport/BankMulticast.lf @@ -17,7 +17,7 @@ reactor Foo { c = new Count() c.out -> out - d = new TestCount(num_inputs = 4) + d = new TestCount(num_inputs=4) in -> d.in } @@ -33,6 +33,6 @@ reactor Bar { main reactor { bar = new Bar() - d = new[4] TestCount(num_inputs = 4) + d = new[4] TestCount(num_inputs=4) bar.out -> d.in } diff --git a/test/C/src/multiport/BankMultiportToReaction.lf b/test/C/src/multiport/BankMultiportToReaction.lf index c5923c7073..6998862887 100644 --- a/test/C/src/multiport/BankMultiportToReaction.lf +++ b/test/C/src/multiport/BankMultiportToReaction.lf @@ -20,22 +20,22 @@ main reactor { reaction(s.out) {= for (int i = 0; i < s_width; i++) { - for (int j = 0; j < s[0].out_width; j++) { - if (s[i].out[j]->is_present) { - lf_print("Received %d.", s[i].out[j]->value); - if (self->count != s[i].out[j]->value) { - lf_print_error_and_exit("Expected %d.", self->count); - } - self->received = true; - } + for (int j = 0; j < s[0].out_width; j++) { + if (s[i].out[j]->is_present) { + lf_print("Received %d.", s[i].out[j]->value); + if (self->count != s[i].out[j]->value) { + lf_print_error_and_exit("Expected %d.", self->count); + } + self->received = true; } + } } self->count++; =} reaction(shutdown) {= if (!self->received) { - lf_print_error_and_exit("No inputs present."); + lf_print_error_and_exit("No inputs present."); } =} } diff --git a/test/C/src/multiport/BankReactionsInContainer.lf b/test/C/src/multiport/BankReactionsInContainer.lf index 71d566ac4b..88d3a71918 100644 --- a/test/C/src/multiport/BankReactionsInContainer.lf +++ b/test/C/src/multiport/BankReactionsInContainer.lf @@ -10,30 +10,30 @@ reactor R(bank_index: int = 0) { reaction(startup) -> out {= for (int i = 0; i < out_width; i++) { - int value = self->bank_index * 2 + i; - lf_set(out[i], value); - lf_print("Inner sending %d to bank %d channel %d.", - value, self->bank_index, i - ); + int value = self->bank_index * 2 + i; + lf_set(out[i], value); + lf_print("Inner sending %d to bank %d channel %d.", + value, self->bank_index, i + ); } =} reaction(in) {= for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) { - lf_print("Inner received %d in bank %d, channel %d", in[i]->value, self->bank_index, i); - self->received = true; - if (in[i]->value != self->bank_index * 2 + i) { - lf_print_error_and_exit("Expected %d.", self->bank_index * 2 + i); - } + if (in[i]->is_present) { + lf_print("Inner received %d in bank %d, channel %d", in[i]->value, self->bank_index, i); + self->received = true; + if (in[i]->value != self->bank_index * 2 + i) { + lf_print_error_and_exit("Expected %d.", self->bank_index * 2 + i); } + } } =} reaction(shutdown) {= lf_print("Inner shutdown invoked."); if (!self->received) { - lf_print_error_and_exit("Received no input."); + lf_print_error_and_exit("Received no input."); } =} } @@ -45,31 +45,31 @@ main reactor { reaction(startup) -> s.in {= int count = 0; for (int i = 0; i < s_width; i++) { - for (int j = 0; j < s[i].in_width; j++) { - lf_print("Sending %d to bank %d channel %d.", count, i, j); - lf_set(s[i].in[j], count++); - } + for (int j = 0; j < s[i].in_width; j++) { + lf_print("Sending %d to bank %d channel %d.", count, i, j); + lf_set(s[i].in[j], count++); + } } =} reaction(s.out) {= for (int j = 0; j < s_width; j++) { - for (int i = 0; i < s[j].out_width; i++) { - if (s[j].out[i]->is_present) { - lf_print("Outer received %d on bank %d channel %d.", s[j].out[i]->value, j, i); - self->received = true; - if (s[j].out[i]->value != j * 2 + i) { - lf_print_error_and_exit("Expected %d.", j * 2 + i); - } - } + for (int i = 0; i < s[j].out_width; i++) { + if (s[j].out[i]->is_present) { + lf_print("Outer received %d on bank %d channel %d.", s[j].out[i]->value, j, i); + self->received = true; + if (s[j].out[i]->value != j * 2 + i) { + lf_print_error_and_exit("Expected %d.", j * 2 + i); + } } + } } =} reaction(shutdown) {= lf_print("Outer shutdown invoked."); if (!self->received) { - lf_print_error_and_exit("Received no input."); + lf_print_error_and_exit("Received no input."); } =} } diff --git a/test/C/src/multiport/BankSelfBroadcast.lf b/test/C/src/multiport/BankSelfBroadcast.lf index 52b7a678f2..f9a52af044 100644 --- a/test/C/src/multiport/BankSelfBroadcast.lf +++ b/test/C/src/multiport/BankSelfBroadcast.lf @@ -16,28 +16,28 @@ reactor A(bank_index: int = 0) { reaction(in) {= for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) { - lf_print( - "Reactor %d received %d on channel %d.", - self->bank_index, in[i]->value, i - ); - if (in[i]->value != i) { - lf_print_error_and_exit("Expected %d.", i); - } - self->received = true; - } else { - lf_print( - "Reactor %d channel %d is absent.", - self->bank_index, i - ); - lf_print_error_and_exit("Expected %d.", i); + if (in[i]->is_present) { + lf_print( + "Reactor %d received %d on channel %d.", + self->bank_index, in[i]->value, i + ); + if (in[i]->value != i) { + lf_print_error_and_exit("Expected %d.", i); } + self->received = true; + } else { + lf_print( + "Reactor %d channel %d is absent.", + self->bank_index, i + ); + lf_print_error_and_exit("Expected %d.", i); + } } =} reaction(shutdown) {= if (!self->received) { - lf_print_error_and_exit("No inputs received."); + lf_print_error_and_exit("No inputs received."); } =} } diff --git a/test/C/src/multiport/BankToBank.lf b/test/C/src/multiport/BankToBank.lf index 0b2c2ff5b5..d6d7ae0aa7 100644 --- a/test/C/src/multiport/BankToBank.lf +++ b/test/C/src/multiport/BankToBank.lf @@ -22,16 +22,16 @@ reactor Destination(bank_index: int = 0) { reaction(in) {= printf("Destination %d received: %d.\n", self->bank_index, in->value); if (in->value != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += self->bank_index; =} reaction(shutdown) {= if (self->s == 0 && self->bank_index != 0) { - fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); - exit(1); + fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); + exit(1); } printf("Success.\n"); =} diff --git a/test/C/src/multiport/BankToBankMultiport.lf b/test/C/src/multiport/BankToBankMultiport.lf index 502e5ed064..e0b288d673 100644 --- a/test/C/src/multiport/BankToBankMultiport.lf +++ b/test/C/src/multiport/BankToBankMultiport.lf @@ -11,7 +11,7 @@ reactor Source(width: int = 1) { reaction(t) -> out {= for(int i = 0; i < out_width; i++) { - lf_set(out[i], self->s++); + lf_set(out[i], self->s++); } =} } @@ -23,27 +23,27 @@ reactor Destination(width: int = 1) { reaction(in) {= int sum = 0; for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) sum += in[i]->value; + if (in[i]->is_present) sum += in[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += 16; =} reaction(shutdown) {= if (self->s <= 6) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} } main reactor BankToBankMultiport(bank_width: int = 4) { - a = new[bank_width] Source(width = 4) - b = new[bank_width] Destination(width = 4) + a = new[bank_width] Source(width=4) + b = new[bank_width] Destination(width=4) a.out -> b.in } diff --git a/test/C/src/multiport/BankToBankMultiportAfter.lf b/test/C/src/multiport/BankToBankMultiportAfter.lf index 9338be1f8c..d8b3ff120d 100644 --- a/test/C/src/multiport/BankToBankMultiportAfter.lf +++ b/test/C/src/multiport/BankToBankMultiportAfter.lf @@ -11,7 +11,7 @@ reactor Source(width: int = 1) { reaction(t) -> out {= for(int i = 0; i < out_width; i++) { - lf_set(out[i], self->s++); + lf_set(out[i], self->s++); } =} } @@ -23,27 +23,27 @@ reactor Destination(width: int = 1) { reaction(in) {= int sum = 0; for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) sum += in[i]->value; + if (in[i]->is_present) sum += in[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += 16; =} reaction(shutdown) {= if (self->s <= 6) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} } main reactor(bank_width: int = 4) { - a = new[bank_width] Source(width = 4) - b = new[bank_width] Destination(width = 4) + a = new[bank_width] Source(width=4) + b = new[bank_width] Destination(width=4) a.out -> b.in after 200 msec } diff --git a/test/C/src/multiport/BankToMultiport.lf b/test/C/src/multiport/BankToMultiport.lf index b45d812974..4506cee0c1 100644 --- a/test/C/src/multiport/BankToMultiport.lf +++ b/test/C/src/multiport/BankToMultiport.lf @@ -13,27 +13,27 @@ reactor Sink(width: int = 4) { reaction(in) {= for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) { - printf("Received on channel %d: %d\n", i, in[i]->value); - self->received = true; - if (in[i]->value != i) { - fprintf(stderr, "ERROR: expected %d\n", i); - exit(1); - } + if (in[i]->is_present) { + printf("Received on channel %d: %d\n", i, in[i]->value); + self->received = true; + if (in[i]->value != i) { + fprintf(stderr, "ERROR: expected %d\n", i); + exit(1); } + } } =} reaction(shutdown) {= if (!self->received) { - fprintf(stderr, "ERROR: Sink received no data\n"); - exit(1); + fprintf(stderr, "ERROR: Sink received no data\n"); + exit(1); } =} } main reactor BankToMultiport(width: int = 5) { source = new[width] Source() - sink = new Sink(width = width) + sink = new Sink(width=width) source.out -> sink.in } diff --git a/test/C/src/multiport/BankToReaction.lf b/test/C/src/multiport/BankToReaction.lf index 59c3282a36..4a830eebbf 100644 --- a/test/C/src/multiport/BankToReaction.lf +++ b/test/C/src/multiport/BankToReaction.lf @@ -12,10 +12,10 @@ main reactor { reaction(s.out) {= for (int i = 0; i < s_width; i++) { - lf_print("Received %d.", s[i].out->value); - if (self->count != s[i].out->value) { - lf_print_error_and_exit("Expected %d.", self->count); - } + lf_print("Received %d.", s[i].out->value); + if (self->count != s[i].out->value) { + lf_print_error_and_exit("Expected %d.", self->count); + } } self->count++; =} diff --git a/test/C/src/multiport/Broadcast.lf b/test/C/src/multiport/Broadcast.lf index d2b4b34d48..27092a4366 100644 --- a/test/C/src/multiport/Broadcast.lf +++ b/test/C/src/multiport/Broadcast.lf @@ -16,16 +16,16 @@ reactor Destination(bank_index: int = 0) { reaction(in) {= printf("Destination %d received %d.\n", self->bank_index, in->value); if (in->value != 42) { - printf("ERROR: Expected 42.\n"); - exit(1); + printf("ERROR: Expected 42.\n"); + exit(1); } self->received = true; =} reaction(shutdown) {= if (!self->received) { - fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); - exit(1); + fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); + exit(1); } printf("Success.\n"); =} diff --git a/test/C/src/multiport/BroadcastAfter.lf b/test/C/src/multiport/BroadcastAfter.lf index cb3c9306f6..48b5850b7c 100644 --- a/test/C/src/multiport/BroadcastAfter.lf +++ b/test/C/src/multiport/BroadcastAfter.lf @@ -16,20 +16,20 @@ reactor Destination(bank_index: int = 0) { reaction(in) {= printf("Destination %d received %d.\n", self->bank_index, in->value); if (in->value != 42) { - printf("ERROR: Expected 42.\n"); - exit(1); + printf("ERROR: Expected 42.\n"); + exit(1); } if (lf_time_logical_elapsed() != SEC(1)) { - printf("ERROR: Expected to receive input after one second.\n"); - exit(2); + printf("ERROR: Expected to receive input after one second.\n"); + exit(2); } self->received = true; =} reaction(shutdown) {= if (!self->received) { - fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); - exit(3); + fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); + exit(3); } printf("Success.\n"); =} diff --git a/test/C/src/multiport/BroadcastMultipleAfter.lf b/test/C/src/multiport/BroadcastMultipleAfter.lf index 6304f27492..809c03448c 100644 --- a/test/C/src/multiport/BroadcastMultipleAfter.lf +++ b/test/C/src/multiport/BroadcastMultipleAfter.lf @@ -17,29 +17,29 @@ reactor Destination(bank_index: int = 0) { printf("Destination %d received %d.\n", self->bank_index, in->value); int expected = (self->bank_index % 3) + 1; if (in->value != expected) { - printf("ERROR: Expected %d.\n", expected); - exit(1); + printf("ERROR: Expected %d.\n", expected); + exit(1); } if (lf_time_logical_elapsed() != SEC(1)) { - printf("ERROR: Expected to receive input after one second.\n"); - exit(2); + printf("ERROR: Expected to receive input after one second.\n"); + exit(2); } self->received = true; =} reaction(shutdown) {= if (!self->received) { - fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); - exit(3); + fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); + exit(3); } printf("Success.\n"); =} } main reactor { - a1 = new Source(value = 1) - a2 = new Source(value = 2) - a3 = new Source(value = 3) + a1 = new Source(value=1) + a2 = new Source(value=2) + a3 = new Source(value=3) b = new[9] Destination() (a1.out, a2.out, a3.out)+ -> b.in after 1 sec } diff --git a/test/C/src/multiport/DualBanks.lf b/test/C/src/multiport/DualBanks.lf index f674626dc8..571fd2399e 100644 --- a/test/C/src/multiport/DualBanks.lf +++ b/test/C/src/multiport/DualBanks.lf @@ -6,9 +6,9 @@ reactor Base(bank_index: int = 0) { reaction(shutdown) {= if(!self->received) { - lf_print_error_and_exit("Bank member %d received no input.", - self->bank_index - ); + lf_print_error_and_exit("Bank member %d received no input.", + self->bank_index + ); } =} } @@ -33,10 +33,10 @@ main reactor { reaction(startup) -> hellos.I, worlds.I {= for(int i = 0; i < hellos_width; i++) { - lf_set(hellos[i].I, true); + lf_set(hellos[i].I, true); } for(int i = 0; i < worlds_width; i++) { - lf_set(worlds[i].I, true); + lf_set(worlds[i].I, true); } =} } diff --git a/test/C/src/multiport/DualBanksMultiport.lf b/test/C/src/multiport/DualBanksMultiport.lf index d1975b6789..078b394f1e 100644 --- a/test/C/src/multiport/DualBanksMultiport.lf +++ b/test/C/src/multiport/DualBanksMultiport.lf @@ -6,9 +6,9 @@ reactor Base(bank_index: int = 0) { reaction(shutdown) {= if(!self->received) { - lf_print_error_and_exit("Bank member %d did not receive all inputs.", - self->bank_index - ); + lf_print_error_and_exit("Bank member %d did not receive all inputs.", + self->bank_index + ); } =} } @@ -16,8 +16,8 @@ reactor Base(bank_index: int = 0) { reactor Hello extends Base { reaction(I) {= if (I[0]->is_present && I[1]->is_present) { - printf("Hello %d\n", self->bank_index); - self->received = true; + printf("Hello %d\n", self->bank_index); + self->received = true; } =} } @@ -25,8 +25,8 @@ reactor Hello extends Base { reactor World extends Base { reaction(I) {= if (I[0]->is_present && I[1]->is_present) { - printf("World %d\n", self->bank_index); - self->received = true; + printf("World %d\n", self->bank_index); + self->received = true; } =} } @@ -37,12 +37,12 @@ main reactor { reaction(startup) -> hellos.I, worlds.I {= for(int i = 0; i < hellos_width; i++) { - lf_set(hellos[i].I[0], true); - lf_set(hellos[i].I[1], true); + lf_set(hellos[i].I[0], true); + lf_set(hellos[i].I[1], true); } for(int i = 0; i < worlds_width; i++) { - lf_set(worlds[i].I[0], true); - lf_set(worlds[i].I[1], true); + lf_set(worlds[i].I[0], true); + lf_set(worlds[i].I[1], true); } =} } diff --git a/test/C/src/multiport/FullyConnected.lf b/test/C/src/multiport/FullyConnected.lf index d65b64f18f..3f39e2ae02 100644 --- a/test/C/src/multiport/FullyConnected.lf +++ b/test/C/src/multiport/FullyConnected.lf @@ -16,26 +16,26 @@ reactor Node(num_nodes: size_t = 4, bank_index: int = 0) { printf("Node %d received messages from ", self->bank_index); size_t count = 0; for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) { - self->received = true; - count++; - printf("%d, ", in[i]->value); - } + if (in[i]->is_present) { + self->received = true; + count++; + printf("%d, ", in[i]->value); + } } printf("\n"); if (count != self->num_nodes) { - lf_print_error_and_exit("Received fewer messages than expected!"); + lf_print_error_and_exit("Received fewer messages than expected!"); } =} reaction(shutdown) {= if (!self->received) { - lf_print_error_and_exit("Received no input!"); + lf_print_error_and_exit("Received no input!"); } =} } main reactor(num_nodes: size_t = 4) { - nodes = new[num_nodes] Node(num_nodes = num_nodes) + nodes = new[num_nodes] Node(num_nodes=num_nodes) (nodes.out)+ -> nodes.in } diff --git a/test/C/src/multiport/FullyConnectedAddressable.lf b/test/C/src/multiport/FullyConnectedAddressable.lf index a5c764764e..59e8adacb0 100644 --- a/test/C/src/multiport/FullyConnectedAddressable.lf +++ b/test/C/src/multiport/FullyConnectedAddressable.lf @@ -11,7 +11,7 @@ reactor Node(num_nodes: size_t = 4, bank_index: int = 0) { reaction(startup) -> out {= int outChannel = (self->bank_index + 1) % self->num_nodes; lf_print("Node %d sending %d out on channel %d.", - self->bank_index, self->bank_index, outChannel + self->bank_index, self->bank_index, outChannel ); // broadcast my ID to everyone lf_set(out[outChannel], self->bank_index); @@ -22,33 +22,33 @@ reactor Node(num_nodes: size_t = 4, bank_index: int = 0) { printf("Node %d received messages from ", self->bank_index); size_t count = 0; for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) { - count++; - printf("%d, ", in[i]->value); - self->received = in[i]->value; - } + if (in[i]->is_present) { + count++; + printf("%d, ", in[i]->value); + self->received = in[i]->value; + } } printf("\n"); int expected = self->bank_index == 0 ? self->num_nodes - 1 : self->bank_index - 1; if (count != 1) { - lf_print_error_and_exit("Received %d messages, but expecting only one!"); + lf_print_error_and_exit("Received %d messages, but expecting only one!"); } if (self->received != expected) { - lf_print_error_and_exit("Received %d, but expected %d!", self->received, expected); + lf_print_error_and_exit("Received %d, but expected %d!", self->received, expected); } =} reaction(shutdown) {= if (!self->triggered) { - lf_print_error_and_exit("Received no input!"); + lf_print_error_and_exit("Received no input!"); } =} } main reactor(num_nodes: size_t = 4) { - nodes1 = new[num_nodes] Node(num_nodes = num_nodes) + nodes1 = new[num_nodes] Node(num_nodes=num_nodes) nodes1.out -> interleaved(nodes1.in) - nodes2 = new[num_nodes] Node(num_nodes = num_nodes) + nodes2 = new[num_nodes] Node(num_nodes=num_nodes) interleaved(nodes2.out) -> nodes2.in } diff --git a/test/C/src/multiport/FullyConnectedAddressableAfter.lf b/test/C/src/multiport/FullyConnectedAddressableAfter.lf index 5828d12659..08d7a31420 100644 --- a/test/C/src/multiport/FullyConnectedAddressableAfter.lf +++ b/test/C/src/multiport/FullyConnectedAddressableAfter.lf @@ -4,9 +4,9 @@ target C import Node from "FullyConnectedAddressable.lf" main reactor(num_nodes: size_t = 4) { - nodes1 = new[num_nodes] Node(num_nodes = num_nodes) + nodes1 = new[num_nodes] Node(num_nodes=num_nodes) nodes1.out -> interleaved(nodes1.in) after 200 msec - nodes2 = new[num_nodes] Node(num_nodes = num_nodes) + nodes2 = new[num_nodes] Node(num_nodes=num_nodes) interleaved(nodes2.out) -> nodes2.in after 400 msec } diff --git a/test/C/src/multiport/MultiportFromBank.lf b/test/C/src/multiport/MultiportFromBank.lf index 2bdb344cf0..3969da111d 100644 --- a/test/C/src/multiport/MultiportFromBank.lf +++ b/test/C/src/multiport/MultiportFromBank.lf @@ -17,26 +17,26 @@ reactor Destination(port_width: int = 3) { reaction(in) {= for (int i = 0; i < in_width; i++) { - printf("Destination channel %d received %d.\n", i, in[i]->value); - if (i != in[i]->value) { - printf("ERROR: Expected %d.\n", i); - exit(1); - } + printf("Destination channel %d received %d.\n", i, in[i]->value); + if (i != in[i]->value) { + printf("ERROR: Expected %d.\n", i); + exit(1); + } } self->received = true; =} reaction(shutdown) {= if (!self->received) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} } main reactor MultiportFromBank(width: int = 4) { - a = new[width] Source(check_override = 1) - b = new Destination(port_width = width) + a = new[width] Source(check_override=1) + b = new Destination(port_width=width) a.out -> b.in } diff --git a/test/C/src/multiport/MultiportFromBankHierarchy.lf b/test/C/src/multiport/MultiportFromBankHierarchy.lf index 073f76ad7a..6ceea0b3bb 100644 --- a/test/C/src/multiport/MultiportFromBankHierarchy.lf +++ b/test/C/src/multiport/MultiportFromBankHierarchy.lf @@ -9,12 +9,12 @@ import Source, Destination from "MultiportFromBank.lf" reactor Container(port_width: int = 3) { output[port_width] out: int - s = new[port_width] Source(check_override = 1) + s = new[port_width] Source(check_override=1) s.out -> out } main reactor(width: int = 4) { - a = new Container(port_width = width) - b = new Destination(port_width = width) + a = new Container(port_width=width) + b = new Destination(port_width=width) a.out -> b.in } diff --git a/test/C/src/multiport/MultiportFromBankHierarchyAfter.lf b/test/C/src/multiport/MultiportFromBankHierarchyAfter.lf index dab31049a8..cedcbeff41 100644 --- a/test/C/src/multiport/MultiportFromBankHierarchyAfter.lf +++ b/test/C/src/multiport/MultiportFromBankHierarchyAfter.lf @@ -9,7 +9,7 @@ import Destination from "MultiportFromBank.lf" import Container from "MultiportFromBankHierarchy.lf" main reactor MultiportFromBankHierarchyAfter { - a = new Container(port_width = 4) - b = new Destination(port_width = 4) + a = new Container(port_width=4) + b = new Destination(port_width=4) a.out -> b.in after 1 sec } diff --git a/test/C/src/multiport/MultiportFromHierarchy.lf b/test/C/src/multiport/MultiportFromHierarchy.lf index c7a6b36277..9d33986305 100644 --- a/test/C/src/multiport/MultiportFromHierarchy.lf +++ b/test/C/src/multiport/MultiportFromHierarchy.lf @@ -11,7 +11,7 @@ reactor Source(width: int = 3) { reaction(t) -> out {= for(int i = 0; i < out_width; i++) { - lf_set(out[i], self->s++); + lf_set(out[i], self->s++); } =} } @@ -23,20 +23,20 @@ reactor Destination(width: int = 3) { reaction(in) {= int sum = 0; for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) sum += in[i]->value; + if (in[i]->is_present) sum += in[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += 16; =} reaction(shutdown) {= if (self->s <= 6) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} @@ -44,18 +44,18 @@ reactor Destination(width: int = 3) { reactor Container(width: int = 3) { output[width] out: int - src = new InsideContainer(width = width) + src = new InsideContainer(width=width) src.out -> out } reactor InsideContainer(width: int = 3) { output[width] out: int - src = new Source(width = width) + src = new Source(width=width) src.out -> out } main reactor MultiportFromHierarchy(width: int = 4) { - a = new Container(width = width) - b = new Destination(width = width) + a = new Container(width=width) + b = new Destination(width=width) a.out -> b.in } diff --git a/test/C/src/multiport/MultiportFromReaction.lf b/test/C/src/multiport/MultiportFromReaction.lf index 0b0b83aa71..f6813999de 100644 --- a/test/C/src/multiport/MultiportFromReaction.lf +++ b/test/C/src/multiport/MultiportFromReaction.lf @@ -11,20 +11,20 @@ reactor Destination(width: int = 1) { reaction(in) {= int sum = 0; for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) sum += in[i]->value; + if (in[i]->is_present) sum += in[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += 16; =} reaction(shutdown) {= if (self->s <= 6) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} @@ -33,14 +33,14 @@ reactor Destination(width: int = 1) { main reactor MultiportFromReaction(width: int = 4) { timer t(0, 200 msec) state s: int = 0 - b = new Destination(width = width) + b = new Destination(width=width) reaction(t) -> b.in {= for(int i = 0; i < b.in_width; i++) { - printf("Before lf_set, b.in[%d]->is_present has value %d\n", i, b.in[i]->is_present); - lf_set(b.in[i], self->s++); - printf("AFTER set, b.in[%d]->is_present has value %d\n", i, b.in[i]->is_present); - printf("AFTER set, b.in[%d]->value has value %d\n", i, b.in[i]->value); + printf("Before lf_set, b.in[%d]->is_present has value %d\n", i, b.in[i]->is_present); + lf_set(b.in[i], self->s++); + printf("AFTER set, b.in[%d]->is_present has value %d\n", i, b.in[i]->is_present); + printf("AFTER set, b.in[%d]->value has value %d\n", i, b.in[i]->value); } =} } diff --git a/test/C/src/multiport/MultiportIn.lf b/test/C/src/multiport/MultiportIn.lf index cba7094684..caea737d76 100644 --- a/test/C/src/multiport/MultiportIn.lf +++ b/test/C/src/multiport/MultiportIn.lf @@ -30,20 +30,20 @@ reactor Destination { reaction(in) {= int sum = 0; for (int i = 0; i < in_width; i++) { - sum += in[i]->value; + sum += in[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += 4; =} reaction(shutdown) {= if (self->s == 0) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} diff --git a/test/C/src/multiport/MultiportInParameterized.lf b/test/C/src/multiport/MultiportInParameterized.lf index d2026c8aca..fbf1b4b6f1 100644 --- a/test/C/src/multiport/MultiportInParameterized.lf +++ b/test/C/src/multiport/MultiportInParameterized.lf @@ -30,20 +30,20 @@ reactor Destination(width: int = 1) { reaction(in) {= int sum = 0; for (int i = 0; i < in_width; i++) { - sum += in[i]->value; + sum += in[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += 4; =} reaction(shutdown) {= if (self->s == 0) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} @@ -55,7 +55,7 @@ main reactor { t2 = new Computation() t3 = new Computation() t4 = new Computation() - b = new Destination(width = 4) + b = new Destination(width=4) a.out -> t1.in a.out -> t2.in a.out -> t3.in diff --git a/test/C/src/multiport/MultiportMutableInput.lf b/test/C/src/multiport/MultiportMutableInput.lf index 50de03cc4d..a114bc40d3 100644 --- a/test/C/src/multiport/MultiportMutableInput.lf +++ b/test/C/src/multiport/MultiportMutableInput.lf @@ -18,11 +18,11 @@ reactor Print(scale: int = 1) { reaction(in) {= int expected = 42; for(int j = 0; j < 2; j++) { - lf_print("Received on channel %d: %d", j, in[j]->value); - if (in[j]->value != expected) { - lf_print_error_and_exit("ERROR: Expected %d!\n", expected); - } - expected *=2; + lf_print("Received on channel %d: %d", j, in[j]->value); + if (in[j]->value != expected) { + lf_print_error_and_exit("ERROR: Expected %d!\n", expected); + } + expected *=2; } =} } @@ -33,9 +33,9 @@ reactor Scale(scale: int = 2) { reaction(in) -> out {= for(int j = 0; j < 2; j++) { - // Modify the input, allowed because mutable. - in[j]->value *= self->scale; - lf_set(out[j], in[j]->value); + // Modify the input, allowed because mutable. + in[j]->value *= self->scale; + lf_set(out[j], in[j]->value); } =} } @@ -43,7 +43,7 @@ reactor Scale(scale: int = 2) { main reactor { s = new Source() c = new Scale() - p = new Print(scale = 2) + p = new Print(scale=2) s.out -> c.in c.out -> p.in } diff --git a/test/C/src/multiport/MultiportMutableInputArray.lf b/test/C/src/multiport/MultiportMutableInputArray.lf index f38eb78af1..4cd9569b8e 100644 --- a/test/C/src/multiport/MultiportMutableInputArray.lf +++ b/test/C/src/multiport/MultiportMutableInputArray.lf @@ -30,24 +30,24 @@ reactor Print(scale: int = 1) { input[2] in: int[] reaction(in) {= - int count = 0; // For testing. + int count = 0; // For testing. bool failed = false; // For testing. for(int j = 0; j < 2; j++) { - printf("Received on channel %d: [", j); - for (int i = 0; i < in[j]->length; i++) { - if (i > 0) printf(", "); - printf("%d", in[j]->value[i]); - // For testing, check whether values match expectation. - if (in[j]->value[i] != self->scale * count) { - failed = true; - } - count++; // For testing. + printf("Received on channel %d: [", j); + for (int i = 0; i < in[j]->length; i++) { + if (i > 0) printf(", "); + printf("%d", in[j]->value[i]); + // For testing, check whether values match expectation. + if (in[j]->value[i] != self->scale * count) { + failed = true; } - printf("]\n"); + count++; // For testing. + } + printf("]\n"); } if (failed) { - printf("ERROR: Value received by Print does not match expectation!\n"); - exit(1); + printf("ERROR: Value received by Print does not match expectation!\n"); + exit(1); } =} } @@ -58,12 +58,12 @@ reactor Scale(scale: int = 2) { reaction(in) -> out {= for(int j = 0; j < in_width; j++) { - for(int i = 0; i < in[j]->length; i++) { - if (in[j]->is_present) { - in[j]->value[i] *= self->scale; - } + for(int i = 0; i < in[j]->length; i++) { + if (in[j]->is_present) { + in[j]->value[i] *= self->scale; } - lf_set_token(out[j], in[j]->token); + } + lf_set_token(out[j], in[j]->token); } =} } @@ -71,7 +71,7 @@ reactor Scale(scale: int = 2) { main reactor { s = new Source() c = new Scale() - p = new Print(scale = 2) + p = new Print(scale=2) s.out -> c.in c.out -> p.in } diff --git a/test/C/src/multiport/MultiportOut.lf b/test/C/src/multiport/MultiportOut.lf index bb756937e5..3049208b3d 100644 --- a/test/C/src/multiport/MultiportOut.lf +++ b/test/C/src/multiport/MultiportOut.lf @@ -11,7 +11,7 @@ reactor Source { reaction(t) -> out {= for(int i = 0; i < 4; i++) { - lf_set(out[i], self->s); + lf_set(out[i], self->s); } self->s++; =} @@ -37,20 +37,20 @@ reactor Destination { reaction(in) {= int sum = 0; for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) sum += in[i]->value; + if (in[i]->is_present) sum += in[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += 4; =} reaction(shutdown) {= if (self->s == 0) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} diff --git a/test/C/src/multiport/MultiportToBank.lf b/test/C/src/multiport/MultiportToBank.lf index 3249f3f61e..90a11f5e00 100644 --- a/test/C/src/multiport/MultiportToBank.lf +++ b/test/C/src/multiport/MultiportToBank.lf @@ -10,7 +10,7 @@ reactor Source(width: int = 2) { reaction(startup) -> out {= for(int i = 0; i < out_width; i++) { - lf_set(out[i], i); + lf_set(out[i], i); } =} @@ -20,7 +20,7 @@ reactor Source(width: int = 2) { // Contents of the reactions does not matter (either could be empty) out {= for(int i = 0; i < out_width; i++) { - lf_set(out[i], i); + lf_set(out[i], i); } =} } @@ -32,23 +32,23 @@ reactor Destination(bank_index: int = 0) { reaction(in) {= printf("Destination %d received %d.\n", self->bank_index, in->value); if (self->bank_index != in->value) { - printf("ERROR: Expected %d.\n", self->bank_index); - exit(1); + printf("ERROR: Expected %d.\n", self->bank_index); + exit(1); } self->received = true; =} reaction(shutdown) {= if (!self->received) { - fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); - exit(1); + fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); + exit(1); } printf("Success.\n"); =} } main reactor MultiportToBank(width: int = 3) { - a = new Source(width = width) + a = new Source(width=width) b = new[width] Destination() a.out -> b.in } diff --git a/test/C/src/multiport/MultiportToBankAfter.lf b/test/C/src/multiport/MultiportToBankAfter.lf index 52945d1c67..7bc4b87679 100644 --- a/test/C/src/multiport/MultiportToBankAfter.lf +++ b/test/C/src/multiport/MultiportToBankAfter.lf @@ -9,7 +9,7 @@ reactor Source(width: int = 2) { reaction(startup) -> out {= for(int i = 0; i < out_width; i++) { - lf_set(out[i], i); + lf_set(out[i], i); } =} } @@ -21,27 +21,27 @@ reactor Destination(bank_index: int = 0) { reaction(in) {= printf("Destination %d received %d.\n", self->bank_index, in->value); if (self->bank_index != in->value) { - printf("ERROR: Expected %d.\n", self->bank_index); - exit(1); + printf("ERROR: Expected %d.\n", self->bank_index); + exit(1); } if (lf_time_logical_elapsed() != SEC(1)) { - printf("ERROR: Expected to receive input after one second.\n"); - exit(2); + printf("ERROR: Expected to receive input after one second.\n"); + exit(2); } self->received = true; =} reaction(shutdown) {= if (!self->received) { - fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); - exit(3); + fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); + exit(3); } printf("Success.\n"); =} } main reactor(width: int = 3) { - a = new Source(width = width) + a = new Source(width=width) b = new[width] Destination() a.out -> b.in after 1 sec // Width of the bank of delays will be inferred. } diff --git a/test/C/src/multiport/MultiportToBankDouble.lf b/test/C/src/multiport/MultiportToBankDouble.lf index 0fd905379d..83882d9115 100644 --- a/test/C/src/multiport/MultiportToBankDouble.lf +++ b/test/C/src/multiport/MultiportToBankDouble.lf @@ -10,7 +10,7 @@ reactor Source { reaction(startup) -> out {= for(int i = 0; i < out_width; i++) { - lf_set(out[i], i); + lf_set(out[i], i); } =} @@ -20,7 +20,7 @@ reactor Source { // Contents of the reactions does not matter (either could be empty) out {= for(int i = 0; i < out_width; i++) { - lf_set(out[i], i * 2); + lf_set(out[i], i * 2); } =} } @@ -32,16 +32,16 @@ reactor Destination(bank_index: int = 0) { reaction(in) {= printf("Destination %d received %d.\n", self->bank_index, in->value); if (self->bank_index * 2 != in->value) { - printf("ERROR: Expected %d.\n", self->bank_index * 2); - exit(1); + printf("ERROR: Expected %d.\n", self->bank_index * 2); + exit(1); } self->received = true; =} reaction(shutdown) {= if (!self->received) { - fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); - exit(1); + fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); + exit(1); } printf("Success.\n"); =} diff --git a/test/C/src/multiport/MultiportToBankHierarchy.lf b/test/C/src/multiport/MultiportToBankHierarchy.lf index dcb3b41811..722e5d4349 100644 --- a/test/C/src/multiport/MultiportToBankHierarchy.lf +++ b/test/C/src/multiport/MultiportToBankHierarchy.lf @@ -10,7 +10,7 @@ reactor Source(width: int = 2) { reaction(startup) -> out {= for(int i = 0; i < out_width; i++) { - lf_set(out[i], i); + lf_set(out[i], i); } =} } @@ -22,16 +22,16 @@ reactor Destination(bank_index: int = 0) { reaction(in) {= printf("Destination %d received %d.\n", self->bank_index, in->value); if (self->bank_index != in->value) { - printf("ERROR: Expected %d.\n", self->bank_index); - exit(1); + printf("ERROR: Expected %d.\n", self->bank_index); + exit(1); } self->received = true; =} reaction(shutdown) {= if (!self->received) { - fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); - exit(1); + fprintf(stderr, "ERROR: Destination %d received no input!\n", self->bank_index); + exit(1); } printf("Success.\n"); =} @@ -44,7 +44,7 @@ reactor Container(width: int = 2) { } main reactor MultiportToBankHierarchy(width: int = 3) { - a = new Source(width = width) - b = new Container(width = width) + a = new Source(width=width) + b = new Container(width=width) a.out -> b.in } diff --git a/test/C/src/multiport/MultiportToHierarchy.lf b/test/C/src/multiport/MultiportToHierarchy.lf index 2abaca76eb..0a21f36aaa 100644 --- a/test/C/src/multiport/MultiportToHierarchy.lf +++ b/test/C/src/multiport/MultiportToHierarchy.lf @@ -12,7 +12,7 @@ reactor Source(width: int = 2) { reaction(t) -> out {= for(int i = 0; i < 4; i++) { - lf_set(out[i], self->s++); + lf_set(out[i], self->s++); } =} } @@ -24,20 +24,20 @@ reactor Destination(width: int = 4) { reaction(in) {= int sum = 0; for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) sum += in[i]->value; + if (in[i]->is_present) sum += in[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += 16; =} reaction(shutdown) {= if (self->s <= 6) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} @@ -50,7 +50,7 @@ reactor Container(width: int = 4) { } main reactor MultiportToHierarchy(width: int = 4) { - a = new Source(width = width) - b = new Container(width = width) + a = new Source(width=width) + b = new Container(width=width) a.out -> b.in } diff --git a/test/C/src/multiport/MultiportToMultiport.lf b/test/C/src/multiport/MultiportToMultiport.lf index c24b8b59de..af437ab670 100644 --- a/test/C/src/multiport/MultiportToMultiport.lf +++ b/test/C/src/multiport/MultiportToMultiport.lf @@ -11,10 +11,10 @@ reactor Source(width: int = 1) { reaction(t) -> out {= for(int i = 0; i < out_width; i++) { - printf("Before lf_set, out[%d]->is_present has value %d\n", i, out[i]->is_present); - lf_set(out[i], self->s++); - printf("AFTER set, out[%d]->is_present has value %d\n", i, out[i]->is_present); - printf("AFTER set, out[%d]->value has value %d\n", i, out[i]->value); + printf("Before lf_set, out[%d]->is_present has value %d\n", i, out[i]->is_present); + lf_set(out[i], self->s++); + printf("AFTER set, out[%d]->is_present has value %d\n", i, out[i]->is_present); + printf("AFTER set, out[%d]->value has value %d\n", i, out[i]->value); } =} } @@ -26,27 +26,27 @@ reactor Destination(width: int = 1) { reaction(in) {= int sum = 0; for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) sum += in[i]->value; + if (in[i]->is_present) sum += in[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += 16; =} reaction(shutdown) {= if (self->s <= 6) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} } main reactor MultiportToMultiport(width: int = 4) { - a = new Source(width = width) - b = new Destination(width = width) + a = new Source(width=width) + b = new Destination(width=width) a.out -> b.in } diff --git a/test/C/src/multiport/MultiportToMultiport2.lf b/test/C/src/multiport/MultiportToMultiport2.lf index 4247995caa..a63a95c048 100644 --- a/test/C/src/multiport/MultiportToMultiport2.lf +++ b/test/C/src/multiport/MultiportToMultiport2.lf @@ -6,7 +6,7 @@ reactor Source(width: int = 2) { reaction(startup) -> out {= for (int i = 0; i < out_width; i++) { - lf_set(out[i], i); + lf_set(out[i], i); } =} } @@ -16,22 +16,22 @@ reactor Destination(width: int = 2) { reaction(in) {= for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) { - printf("Received on channel %d: %d\n", i, in[i]->value); - // NOTE: For testing purposes, this assumes the specific - // widths instantiated below. - if (in[i]->value != i % 3) { - fprintf(stderr, "ERROR: expected %d!\n", i % 3); - exit(1); - } + if (in[i]->is_present) { + printf("Received on channel %d: %d\n", i, in[i]->value); + // NOTE: For testing purposes, this assumes the specific + // widths instantiated below. + if (in[i]->value != i % 3) { + fprintf(stderr, "ERROR: expected %d!\n", i % 3); + exit(1); } + } } =} } main reactor MultiportToMultiport2(width1: int = 3, width2: int = 2, width3: int = 5) { - a1 = new Source(width = width1) - a2 = new Source(width = width2) - b = new Destination(width = width3) + a1 = new Source(width=width1) + a2 = new Source(width=width2) + b = new Destination(width=width3) a1.out, a2.out -> b.in } diff --git a/test/C/src/multiport/MultiportToMultiport2After.lf b/test/C/src/multiport/MultiportToMultiport2After.lf index 2d626610cf..e570d65f10 100644 --- a/test/C/src/multiport/MultiportToMultiport2After.lf +++ b/test/C/src/multiport/MultiportToMultiport2After.lf @@ -6,7 +6,7 @@ reactor Source(width: int = 2) { reaction(startup) -> out {= for (int i = 0; i < out_width; i++) { - lf_set(out[i], i); + lf_set(out[i], i); } =} } @@ -16,26 +16,26 @@ reactor Destination(width: int = 2) { reaction(in) {= for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) { - printf("Received on channel %d: %d\n", i, in[i]->value); - // NOTE: For testing purposes, this assumes the specific - // widths instantiated below. - if (in[i]->value != i % 3) { - fprintf(stderr, "ERROR: expected %d!\n", i % 3); - exit(1); - } + if (in[i]->is_present) { + printf("Received on channel %d: %d\n", i, in[i]->value); + // NOTE: For testing purposes, this assumes the specific + // widths instantiated below. + if (in[i]->value != i % 3) { + fprintf(stderr, "ERROR: expected %d!\n", i % 3); + exit(1); } + } } if (lf_time_logical_elapsed() != SEC(1)) { - printf("ERROR: Expected to receive input after one second.\n"); - exit(2); + printf("ERROR: Expected to receive input after one second.\n"); + exit(2); } =} } main reactor MultiportToMultiport2After { - a1 = new Source(width = 3) - a2 = new Source(width = 2) - b = new Destination(width = 5) + a1 = new Source(width=3) + a2 = new Source(width=2) + b = new Destination(width=5) a1.out, a2.out -> b.in after 1 sec } diff --git a/test/C/src/multiport/MultiportToMultiportArray.lf b/test/C/src/multiport/MultiportToMultiportArray.lf index 203e4fb04f..31f0bf2944 100644 --- a/test/C/src/multiport/MultiportToMultiportArray.lf +++ b/test/C/src/multiport/MultiportToMultiportArray.lf @@ -11,13 +11,13 @@ reactor Source { reaction(t) -> out {= for(int i = 0; i < 2; i++) { - // Dynamically allocate an output array of length 3. - SET_NEW_ARRAY(out[i], 3); + // Dynamically allocate an output array of length 3. + SET_NEW_ARRAY(out[i], 3); - // Above allocates the array, which then must be populated. - out[i]->value[0] = self->s++; - out[i]->value[1] = self->s++; - out[i]->value[2] = self->s++; + // Above allocates the array, which then must be populated. + out[i]->value[0] = self->s++; + out[i]->value[1] = self->s++; + out[i]->value[2] = self->s++; } =} } @@ -29,24 +29,24 @@ reactor Destination { reaction(in) {= int sum = 0; for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) { - for (int j = 0; j < in[i]->length; j++) { - sum += in[i]->value[j]; - } + if (in[i]->is_present) { + for (int j = 0; j < in[i]->length; j++) { + sum += in[i]->value[j]; } + } } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += 36; =} reaction(shutdown) {= if (self->s <= 15) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} diff --git a/test/C/src/multiport/MultiportToMultiportParameter.lf b/test/C/src/multiport/MultiportToMultiportParameter.lf index fe311cd7fa..2c73f21426 100644 --- a/test/C/src/multiport/MultiportToMultiportParameter.lf +++ b/test/C/src/multiport/MultiportToMultiportParameter.lf @@ -11,10 +11,10 @@ reactor Source(width: int = 1) { reaction(t) -> out {= for(int i = 0; i < out_width; i++) { - printf("Before lf_set, out[%d]->is_present has value %d\n", i, out[i]->is_present); - lf_set(out[i], self->s++); - printf("AFTER set, out[%d]->is_present has value %d\n", i, out[i]->is_present); - printf("AFTER set, out[%d]->value has value %d\n", i, out[i]->value); + printf("Before lf_set, out[%d]->is_present has value %d\n", i, out[i]->is_present); + lf_set(out[i], self->s++); + printf("AFTER set, out[%d]->is_present has value %d\n", i, out[i]->is_present); + printf("AFTER set, out[%d]->value has value %d\n", i, out[i]->value); } =} } @@ -26,27 +26,27 @@ reactor Destination(width: int = 1) { reaction(in) {= int sum = 0; for (int i = 0; i < in_width; i++) { - if (in[i]->is_present) sum += in[i]->value; + if (in[i]->is_present) sum += in[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += 16; =} reaction(shutdown) {= if (self->s <= 6) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} } main reactor(width: int = 4) { - a = new Source(width = width) - b = new Destination(width = width) + a = new Source(width=width) + b = new Destination(width=width) a.out -> b.in } diff --git a/test/C/src/multiport/MultiportToPort.lf b/test/C/src/multiport/MultiportToPort.lf index 60523029cf..3121f03d7b 100644 --- a/test/C/src/multiport/MultiportToPort.lf +++ b/test/C/src/multiport/MultiportToPort.lf @@ -9,8 +9,8 @@ reactor Source { reaction(startup) -> out {= for(int i = 0; i < out_width; i++) { - printf("Source sending %d.\n", i); - lf_set(out[i], i); + printf("Source sending %d.\n", i); + lf_set(out[i], i); } =} } @@ -23,15 +23,15 @@ reactor Destination(expected: int = 0) { printf("Received: %d.\n", in->value); self->received = true; if (in->value != self->expected) { - printf("ERROR: Expected %d.\n", self->expected); - exit(1); + printf("ERROR: Expected %d.\n", self->expected); + exit(1); } =} reaction(shutdown) {= if (!self->received) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} @@ -40,6 +40,6 @@ reactor Destination(expected: int = 0) { main reactor MultiportToPort { a = new Source() b1 = new Destination() - b2 = new Destination(expected = 1) + b2 = new Destination(expected=1) a.out -> b1.in, b2.in } diff --git a/test/C/src/multiport/MultiportToReaction.lf b/test/C/src/multiport/MultiportToReaction.lf index 77eba059f3..3d3560f478 100644 --- a/test/C/src/multiport/MultiportToReaction.lf +++ b/test/C/src/multiport/MultiportToReaction.lf @@ -12,32 +12,32 @@ reactor Source(width: int = 1) { reaction(t) -> out {= printf("Sending.\n"); for(int i = 0; i < out_width; i++) { - lf_set(out[i], self->s++); + lf_set(out[i], self->s++); } =} } main reactor MultiportToReaction { state s: int = 6 - b = new Source(width = 4) + b = new Source(width=4) reaction(b.out) {= int sum = 0; for (int i = 0; i < b.out_width; i++) { - if (b.out[i]->is_present) sum += b.out[i]->value; + if (b.out[i]->is_present) sum += b.out[i]->value; } printf("Sum of received: %d.\n", sum); if (sum != self->s) { - printf("ERROR: Expected %d.\n", self->s); - exit(1); + printf("ERROR: Expected %d.\n", self->s); + exit(1); } self->s += 16; =} reaction(shutdown) {= if (self->s <= 6) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} diff --git a/test/C/src/multiport/NestedBanks.lf b/test/C/src/multiport/NestedBanks.lf index 5c2953c2a4..0254c1c59a 100644 --- a/test/C/src/multiport/NestedBanks.lf +++ b/test/C/src/multiport/NestedBanks.lf @@ -15,7 +15,7 @@ main reactor { reactor A(bank_index: int = 0) { output[4] x: int - b = new[2] B(a_bank_index = bank_index) + b = new[2] B(a_bank_index=bank_index) b.y -> x } @@ -31,8 +31,8 @@ reactor B(a_bank_index: int = 0, bank_index: int = 0) { reactor C(bank_index: int = 0) { input[2] z: int - f = new F(c_bank_index = bank_index) - g = new G(c_bank_index = bank_index) + f = new F(c_bank_index=bank_index) + g = new G(c_bank_index=bank_index) z -> f.w, g.s } @@ -41,10 +41,10 @@ reactor D { reaction(u) {= for (int i = 0; i < u_width; i++) { - lf_print("d.u[%d] received %d.", i, u[i]->value); - if (u[i]->value != 6 + i) { - lf_print_error_and_exit("Expected %d but received %d.", 6 + i, u[i]->value); - } + lf_print("d.u[%d] received %d.", i, u[i]->value); + if (u[i]->value != 6 + i) { + lf_print_error_and_exit("Expected %d but received %d.", 6 + i, u[i]->value); + } } =} } @@ -54,7 +54,7 @@ reactor E { reaction(t) {= for (int i = 0; i < t_width; i++) { - lf_print("e.t[%d] received %d.", i, t[i]->value); + lf_print("e.t[%d] received %d.", i, t[i]->value); } =} } @@ -65,7 +65,7 @@ reactor F(c_bank_index: int = 0) { reaction(w) {= lf_print("c[%d].f.w received %d.", self->c_bank_index, w->value); if (w->value != self->c_bank_index * 2) { - lf_print_error_and_exit("Expected %d but received %d.", self->c_bank_index * 2, w->value); + lf_print_error_and_exit("Expected %d but received %d.", self->c_bank_index * 2, w->value); } =} } @@ -76,7 +76,7 @@ reactor G(c_bank_index: int = 0) { reaction(s) {= lf_print("c[%d].g.s received %d.", self->c_bank_index, s->value); if (s->value != self->c_bank_index * 2 + 1) { - lf_print_error_and_exit("Expected %d but received %d.", self->c_bank_index * 2 + 1, s->value); + lf_print_error_and_exit("Expected %d but received %d.", self->c_bank_index * 2 + 1, s->value); } =} } diff --git a/test/C/src/multiport/NestedInterleavedBanks.lf b/test/C/src/multiport/NestedInterleavedBanks.lf index b453473223..889ea904d7 100644 --- a/test/C/src/multiport/NestedInterleavedBanks.lf +++ b/test/C/src/multiport/NestedInterleavedBanks.lf @@ -9,15 +9,15 @@ reactor A(bank_index: int = 0, outer_bank_index: int = 0) { reaction(startup) -> p {= for (int i = 0; i < p_width; i++) { - lf_set(p[i], self->outer_bank_index * 4 + self->bank_index * 2 + i + 1); - lf_print("A sending %d.", p[i]->value); + lf_set(p[i], self->outer_bank_index * 4 + self->bank_index * 2 + i + 1); + lf_print("A sending %d.", p[i]->value); } =} } reactor B(bank_index: int = 0) { output[4] q: int - a = new[2] A(outer_bank_index = bank_index) + a = new[2] A(outer_bank_index=bank_index) interleaved(a.p) -> q } @@ -27,10 +27,10 @@ reactor C { reaction(i) {= int expected[] = {1, 3, 2, 4, 5, 7, 6, 8}; for(int j = 0; j < i_width; j++) { - lf_print("C received %d.", i[j]->value); - if (i[j]->value != expected[j]) { - lf_print_error_and_exit("Expected %d.", expected[j]); - } + lf_print("C received %d.", i[j]->value); + if (i[j]->value != expected[j]) { + lf_print_error_and_exit("Expected %d.", expected[j]); + } } =} } diff --git a/test/C/src/multiport/PipelineAfter.lf b/test/C/src/multiport/PipelineAfter.lf index e3256c5cb8..bbcbaebc49 100644 --- a/test/C/src/multiport/PipelineAfter.lf +++ b/test/C/src/multiport/PipelineAfter.lf @@ -19,12 +19,12 @@ reactor Sink { reaction(in) {= printf("Received %d\n", in->value); if (in->value != 42) { - printf("ERROR: expected 42!\n"); - exit(1); + printf("ERROR: expected 42!\n"); + exit(1); } if (lf_time_logical_elapsed() != SEC(1)) { - printf("ERROR: Expected to receive input after one second.\n"); - exit(2); + printf("ERROR: Expected to receive input after one second.\n"); + exit(2); } =} } diff --git a/test/C/src/multiport/ReactionToContainedBank.lf b/test/C/src/multiport/ReactionToContainedBank.lf index e448913d79..e7ecfb29f6 100644 --- a/test/C/src/multiport/ReactionToContainedBank.lf +++ b/test/C/src/multiport/ReactionToContainedBank.lf @@ -10,11 +10,11 @@ main reactor ReactionToContainedBank(width: int = 2) { timer t(0, 100 msec) state count: int = 1 - test = new[width] TestCount(num_inputs = 11) + test = new[width] TestCount(num_inputs=11) reaction(t) -> test.in {= for (int i = 0; i < self->width; i++) { - lf_set(test[i].in, self->count); + lf_set(test[i].in, self->count); } self->count++; =} diff --git a/test/C/src/multiport/ReactionToContainedBank2.lf b/test/C/src/multiport/ReactionToContainedBank2.lf index a36e575b21..d77112fd39 100644 --- a/test/C/src/multiport/ReactionToContainedBank2.lf +++ b/test/C/src/multiport/ReactionToContainedBank2.lf @@ -10,17 +10,17 @@ reactor ReactionToContainedBank(width: int = 2) { timer t(0, 100 msec) state count: int = 1 - test = new[width] TestCount(num_inputs = 11) + test = new[width] TestCount(num_inputs=11) reaction(t) -> test.in {= for (int i = 0; i < self->width; i++) { - lf_set(test[i].in, self->count); + lf_set(test[i].in, self->count); } self->count++; =} } main reactor(width: int = 2) { - a = new ReactionToContainedBank(width = width) - b = new ReactionToContainedBank(width = 4) + a = new ReactionToContainedBank(width=width) + b = new ReactionToContainedBank(width=4) } diff --git a/test/C/src/multiport/ReactionToContainedBankMultiport.lf b/test/C/src/multiport/ReactionToContainedBankMultiport.lf index e778f125c9..df269cd0f1 100644 --- a/test/C/src/multiport/ReactionToContainedBankMultiport.lf +++ b/test/C/src/multiport/ReactionToContainedBankMultiport.lf @@ -10,14 +10,14 @@ main reactor(width: int = 2) { timer t(0, 100 msec) state count: int = 1 - test = new[width] TestCountMultiport(num_inputs = 11, width = width) + test = new[width] TestCountMultiport(num_inputs=11, width=width) reaction(t) -> test.in {= for (int i = 0; i < self->width; i++) { - for (int j = 0; j < self->width; j++) { - lf_set(test[j].in[i], self->count); - } - self->count++; + for (int j = 0; j < self->width; j++) { + lf_set(test[j].in[i], self->count); + } + self->count++; } =} } diff --git a/test/C/src/multiport/ReactionsToNested.lf b/test/C/src/multiport/ReactionsToNested.lf index 71a76444b6..2b07e948de 100644 --- a/test/C/src/multiport/ReactionsToNested.lf +++ b/test/C/src/multiport/ReactionsToNested.lf @@ -11,21 +11,21 @@ reactor T(expected: int = 0) { lf_print("T received %d", z->value); self->received = true; if (z->value != self->expected) { - lf_print_error_and_exit("Expected %d", self->expected); + lf_print_error_and_exit("Expected %d", self->expected); } =} reaction(shutdown) {= if (!self->received) { - lf_print_error_and_exit("No input received"); + lf_print_error_and_exit("No input received"); } =} } reactor D { input[2] y: int - t1 = new T(expected = 42) - t2 = new T(expected = 43) + t1 = new T(expected=42) + t2 = new T(expected=43) y -> t1.z, t2.z } diff --git a/test/C/src/multiport/Sparse.lf b/test/C/src/multiport/Sparse.lf index 3ebda275b1..619afe92eb 100644 --- a/test/C/src/multiport/Sparse.lf +++ b/test/C/src/multiport/Sparse.lf @@ -11,7 +11,7 @@ reactor SparseSource(width: int = 20) { reaction(t) -> out {= int next_count = self->count + 1; if (next_count >= self->width) { - next_count = 0; + next_count = 0; } lf_set(out[next_count], next_count); lf_set(out[self->count], self->count); @@ -29,22 +29,22 @@ reactor SparseSink(width: int = 20) { int previous = -1; int channel = lf_multiport_next(&i); while(channel >= 0) { - lf_print("Received %d on channel %d", in[channel]->value, channel); - // The value of the input should equal the channel number. - if (in[channel]->value != channel) { - lf_print_error_and_exit("Expected %d", channel); - } - if (channel <= previous) { - lf_print_error_and_exit("Input channels not read in order."); - } - previous = channel; - channel = lf_multiport_next(&i); + lf_print("Received %d on channel %d", in[channel]->value, channel); + // The value of the input should equal the channel number. + if (in[channel]->value != channel) { + lf_print_error_and_exit("Expected %d", channel); + } + if (channel <= previous) { + lf_print_error_and_exit("Input channels not read in order."); + } + previous = channel; + channel = lf_multiport_next(&i); } =} } main reactor(width: int = 20) { - s = new SparseSource(width = width) - d = new SparseSink(width = width) + s = new SparseSource(width=width) + d = new SparseSink(width=width) s.out -> d.in } diff --git a/test/C/src/multiport/SparseFallback.lf b/test/C/src/multiport/SparseFallback.lf index a5a0bf4284..e2ad9b1ecc 100644 --- a/test/C/src/multiport/SparseFallback.lf +++ b/test/C/src/multiport/SparseFallback.lf @@ -14,7 +14,7 @@ reactor SparseSource(width: int = 20) { reaction(t) -> out {= int next_count = self->count + 1; if (next_count >= self->width) { - next_count = 0; + next_count = 0; } lf_set(out[self->count], self->count); lf_set(out[next_count], next_count); @@ -32,22 +32,22 @@ reactor SparseSink(width: int = 20) { int previous = -1; int channel = lf_multiport_next(&i); while(channel >= 0) { - lf_print("Received %d on channel %d", in[channel]->value, channel); - // The value of the input should equal the channel number. - if (in[channel]->value != channel) { - lf_print_error_and_exit("Expected %d", channel); - } - if (channel <= previous) { - lf_print_error_and_exit("Input channels not read in order."); - } - previous = channel; - channel = lf_multiport_next(&i); + lf_print("Received %d on channel %d", in[channel]->value, channel); + // The value of the input should equal the channel number. + if (in[channel]->value != channel) { + lf_print_error_and_exit("Expected %d", channel); + } + if (channel <= previous) { + lf_print_error_and_exit("Input channels not read in order."); + } + previous = channel; + channel = lf_multiport_next(&i); } =} } main reactor(width: int = 10) { - s = new SparseSource(width = width) - d = new SparseSink(width = width) + s = new SparseSource(width=width) + d = new SparseSink(width=width) s.out -> d.in } diff --git a/test/C/src/multiport/TriggerDownstreamOnlyIfPresent.lf b/test/C/src/multiport/TriggerDownstreamOnlyIfPresent.lf index 9acf39c95c..f1a0a3b81e 100644 --- a/test/C/src/multiport/TriggerDownstreamOnlyIfPresent.lf +++ b/test/C/src/multiport/TriggerDownstreamOnlyIfPresent.lf @@ -12,9 +12,9 @@ reactor Source { reaction(t) -> a, b {= if (self->count++ % 2 == 0) { - lf_set(a, self->count); + lf_set(a, self->count); } else { - lf_set(b, self->count); + lf_set(b, self->count); } =} } @@ -25,15 +25,15 @@ reactor Destination { reaction(a) {= if (!a->is_present) { - fprintf(stderr, "Reaction to a triggered even though all inputs are absent!\n"); - exit(1); + fprintf(stderr, "Reaction to a triggered even though all inputs are absent!\n"); + exit(1); } =} reaction(b) {= if (!b->is_present) { - fprintf(stderr, "Reaction to b triggered even though all inputs are absent!\n"); - exit(2); + fprintf(stderr, "Reaction to b triggered even though all inputs are absent!\n"); + exit(2); } =} } diff --git a/test/C/src/no_inlining/BankMultiportToReactionNoInlining.lf b/test/C/src/no_inlining/BankMultiportToReactionNoInlining.lf index fe725a359a..a84a694a82 100644 --- a/test/C/src/no_inlining/BankMultiportToReactionNoInlining.lf +++ b/test/C/src/no_inlining/BankMultiportToReactionNoInlining.lf @@ -24,7 +24,7 @@ main reactor { reaction(shutdown) {= if (!self->received) { - lf_print_error_and_exit("No inputs present."); + lf_print_error_and_exit("No inputs present."); } =} } diff --git a/test/C/src/no_inlining/CountHierarchy.lf b/test/C/src/no_inlining/CountHierarchy.lf index ab59d38386..42d7eb2bd7 100644 --- a/test/C/src/no_inlining/CountHierarchy.lf +++ b/test/C/src/no_inlining/CountHierarchy.lf @@ -11,7 +11,7 @@ reactor Timer(m: time = 0, n: time = 0) { } main reactor { - t = new Timer(m = 0, n = 1 msec) + t = new Timer(m=0, n = 1 msec) state count: int diff --git a/test/C/src/no_inlining/MultiportToReactionNoInlining.lf b/test/C/src/no_inlining/MultiportToReactionNoInlining.lf index 0730b8acc1..579a74fae1 100644 --- a/test/C/src/no_inlining/MultiportToReactionNoInlining.lf +++ b/test/C/src/no_inlining/MultiportToReactionNoInlining.lf @@ -14,21 +14,21 @@ reactor Source(width: int = 1) { reaction(t) -> out {= printf("Sending.\n"); for(int i = 0; i < out_width; i++) { - lf_set(out[i], self->s++); + lf_set(out[i], self->s++); } =} } main reactor { state s: int = 6 - b = new Source(width = 4) + b = new Source(width=4) reaction check(b.out) reaction(shutdown) {= if (self->s <= 6) { - fprintf(stderr, "ERROR: Destination received no input!\n"); - exit(1); + fprintf(stderr, "ERROR: Destination received no input!\n"); + exit(1); } printf("Success.\n"); =} diff --git a/test/C/src/serialization/PersonProtocolBuffers.lf b/test/C/src/serialization/PersonProtocolBuffers.lf index ffc346db3d..193de9193a 100644 --- a/test/C/src/serialization/PersonProtocolBuffers.lf +++ b/test/C/src/serialization/PersonProtocolBuffers.lf @@ -24,8 +24,8 @@ target C { main reactor { reaction(startup) {= Person person = PERSON__INIT; // Macro to create the protocol buffer - uint8_t* buffer; // Buffer to store the serialized data - unsigned len; // Length of the packed message + uint8_t* buffer; // Buffer to store the serialized data + unsigned len; // Length of the packed message person.name = "Lingua Franca"; person.id = 1; @@ -41,6 +41,6 @@ main reactor { // Extract and print the unpacked message. printf("Name: %s\n", unpacked->name); - free(buffer); // Free the allocated serialized buffer + free(buffer); // Free the allocated serialized buffer =} } diff --git a/test/C/src/serialization/ROSBuiltInSerialization.lf b/test/C/src/serialization/ROSBuiltInSerialization.lf index 6054a50fa2..26dddca2fb 100644 --- a/test/C/src/serialization/ROSBuiltInSerialization.lf +++ b/test/C/src/serialization/ROSBuiltInSerialization.lf @@ -48,11 +48,11 @@ reactor Receiver { reaction(in) {= // Print the ROS2 message data lf_print( - "Serialized integer after deserialization: %d", - in->value.data + "Serialized integer after deserialization: %d", + in->value.data ); if (in->value.data != self->count) { - lf_print_error_and_exit("Expected %d.", self->count); + lf_print_error_and_exit("Expected %d.", self->count); } self->count++; =} diff --git a/test/C/src/serialization/ROSBuiltInSerializationSharedPtr.lf b/test/C/src/serialization/ROSBuiltInSerializationSharedPtr.lf index e407f18bb9..2355d33f58 100644 --- a/test/C/src/serialization/ROSBuiltInSerializationSharedPtr.lf +++ b/test/C/src/serialization/ROSBuiltInSerializationSharedPtr.lf @@ -48,11 +48,11 @@ reactor Receiver { reaction(in) {= // Print the ROS2 message data lf_print( - "Serialized integer after deserialization: %d", - in->value->data + "Serialized integer after deserialization: %d", + in->value->data ); if (in->value->data != self->count) { - lf_print_error_and_exit("Expected %d.", self->count); + lf_print_error_and_exit("Expected %d.", self->count); } self->count++; =} diff --git a/test/C/src/target/CMakeInclude.lf b/test/C/src/target/CMakeInclude.lf index e1215fa85e..8b79c987bb 100644 --- a/test/C/src/target/CMakeInclude.lf +++ b/test/C/src/target/CMakeInclude.lf @@ -3,9 +3,8 @@ */ target C { cmake-include: [ - "../include/mlib-cmake-extension.cmake", - "../include/foo-cmake-compile-definition.txt" - ], + "../include/mlib-cmake-extension.cmake", + "../include/foo-cmake-compile-definition.txt"], timeout: 0 sec } diff --git a/test/C/src/target/HelloWorldCCPP.lf b/test/C/src/target/HelloWorldCCPP.lf index 1b3a9b023f..cef02c9440 100644 --- a/test/C/src/target/HelloWorldCCPP.lf +++ b/test/C/src/target/HelloWorldCCPP.lf @@ -21,8 +21,8 @@ reactor HelloWorld { reaction(shutdown) {= printf("Shutdown invoked.\n"); if (!self->success) { - fprintf(stderr, "ERROR: startup reaction not executed.\n"); - exit(1); + fprintf(stderr, "ERROR: startup reaction not executed.\n"); + exit(1); } =} } diff --git a/test/C/src/token/TokenContainedPrint.lf b/test/C/src/token/TokenContainedPrint.lf index 586e7283a2..ef1eb7c94e 100644 --- a/test/C/src/token/TokenContainedPrint.lf +++ b/test/C/src/token/TokenContainedPrint.lf @@ -22,7 +22,7 @@ main reactor { reaction(t) -> p.in {= int_array_t* array = int_array_constructor(3); for (size_t i = 0; i < array->length; i++) { - array->data[i] = self->count++; + array->data[i] = self->count++; } lf_set(p.in, array); =} diff --git a/test/C/src/token/TokenContainedPrintBank.lf b/test/C/src/token/TokenContainedPrintBank.lf index 69ae534b20..659f1d13a1 100644 --- a/test/C/src/token/TokenContainedPrintBank.lf +++ b/test/C/src/token/TokenContainedPrintBank.lf @@ -15,21 +15,21 @@ main reactor { reaction(startup) -> p.in {= for (int j = 0; j < p_width; j++) { - lf_set_destructor(p[j].in, int_array_destructor); - lf_set_copy_constructor(p[j].in, int_array_copy_constructor); + lf_set_destructor(p[j].in, int_array_destructor); + lf_set_copy_constructor(p[j].in, int_array_copy_constructor); } =} reaction(t) -> p.in {= int_array_t* array = int_array_constructor(3); for (size_t i = 0; i < array->length; i++) { - array->data[i] = self->count++; + array->data[i] = self->count++; } // Sending the array to more than one destination, so we need // to wrap it in a token. lf_token_t* token = lf_new_token(p[0].in, array, 1); for (int j = 0; j < p_width; j++) { - lf_set_token(p[j].in, token); + lf_set_token(p[j].in, token); } =} } diff --git a/test/C/src/token/TokenContainedSource.lf b/test/C/src/token/TokenContainedSource.lf index 72fd079032..fb61376351 100644 --- a/test/C/src/token/TokenContainedSource.lf +++ b/test/C/src/token/TokenContainedSource.lf @@ -20,24 +20,24 @@ main reactor(scale: int = 1) { bool failed = false; // For testing. printf("Received: ["); for (int i = 0; i < s.out->value->length; i++) { - if (i > 0) printf(", "); - printf("%d", s.out->value->data[i]); - // For testing, check whether values match expectation. - if (s.out->value->data[i] != self->scale * self->count) { - failed = true; - } - self->count++; + if (i > 0) printf(", "); + printf("%d", s.out->value->data[i]); + // For testing, check whether values match expectation. + if (s.out->value->data[i] != self->scale * self->count) { + failed = true; + } + self->count++; } printf("]\n"); if (failed) { - printf("ERROR: Value received does not match expectation!\n"); - exit(1); + printf("ERROR: Value received does not match expectation!\n"); + exit(1); } =} reaction(shutdown) {= if (!self->input_received) { - lf_print_error_and_exit("TokenPrint: No result received!"); + lf_print_error_and_exit("TokenPrint: No result received!"); } =} } diff --git a/test/C/src/token/TokenContainedSourceBank.lf b/test/C/src/token/TokenContainedSourceBank.lf index 0a0b4383c7..14085eef8d 100644 --- a/test/C/src/token/TokenContainedSourceBank.lf +++ b/test/C/src/token/TokenContainedSourceBank.lf @@ -19,28 +19,28 @@ main reactor(scale: int = 1) { self->input_received = true; bool failed = false; // For testing. for (int j = 0; j < s_width; j++) { - printf("Received from %d: [", j); - if (j > 0) self->count -= s[j].out->value->length; - for (int i = 0; i < s[j].out->value->length; i++) { - if (i > 0) printf(", "); - printf("%d", s[j].out->value->data[i]); - // For testing, check whether values match expectation. - if (s[j].out->value->data[i] != self->scale * self->count) { - failed = true; - } - self->count++; + printf("Received from %d: [", j); + if (j > 0) self->count -= s[j].out->value->length; + for (int i = 0; i < s[j].out->value->length; i++) { + if (i > 0) printf(", "); + printf("%d", s[j].out->value->data[i]); + // For testing, check whether values match expectation. + if (s[j].out->value->data[i] != self->scale * self->count) { + failed = true; } - printf("]\n"); + self->count++; + } + printf("]\n"); } if (failed) { - printf("ERROR: Value received does not match expectation!\n"); - exit(1); + printf("ERROR: Value received does not match expectation!\n"); + exit(1); } =} reaction(shutdown) {= if (!self->input_received) { - lf_print_error_and_exit("TokenPrint: No result received!"); + lf_print_error_and_exit("TokenPrint: No result received!"); } =} } diff --git a/test/C/src/token/TokenMutable.lf b/test/C/src/token/TokenMutable.lf index 7169f421c8..dce7db38e8 100644 --- a/test/C/src/token/TokenMutable.lf +++ b/test/C/src/token/TokenMutable.lf @@ -12,10 +12,10 @@ import TokenSource, TokenPrint, TokenScale from "lib/Token.lf" main reactor { s = new TokenSource() - g2 = new TokenScale(scale = 2) - g3 = new TokenScale(scale = 3) - p2 = new TokenPrint(scale = 2) - p3 = new TokenPrint(scale = 3) + g2 = new TokenScale(scale=2) + g3 = new TokenScale(scale=3) + p2 = new TokenPrint(scale=2) + p3 = new TokenPrint(scale=3) s.out -> g2.in s.out -> g3.in g2.out -> p2.in diff --git a/test/C/src/token/TokenSourceScalePrint.lf b/test/C/src/token/TokenSourceScalePrint.lf index 01d57936ff..dbfdf18c4d 100644 --- a/test/C/src/token/TokenSourceScalePrint.lf +++ b/test/C/src/token/TokenSourceScalePrint.lf @@ -12,8 +12,8 @@ import TokenSource, TokenPrint, TokenScale from "lib/Token.lf" main reactor { s = new TokenSource() - g2 = new TokenScale(scale = 2) - p2 = new TokenPrint(scale = 2) + g2 = new TokenScale(scale=2) + p2 = new TokenPrint(scale=2) s.out -> g2.in g2.out -> p2.in } diff --git a/test/C/src/token/lib/Token.lf b/test/C/src/token/lib/Token.lf index f5f0bc5d27..3bfabd9b1c 100644 --- a/test/C/src/token/lib/Token.lf +++ b/test/C/src/token/lib/Token.lf @@ -30,7 +30,7 @@ reactor TokenSource { reaction(t) -> out {= int_array_t* array = int_array_constructor(3); for (size_t i = 0; i < array->length; i++) { - array->data[i] = self->count++; + array->data[i] = self->count++; } lf_set(out, array); =} @@ -51,24 +51,24 @@ reactor TokenPrint(scale: int = 1) { bool failed = false; // For testing. printf("TokenPrint received: ["); for (int i = 0; i < in->value->length; i++) { - if (i > 0) printf(", "); - printf("%d", in->value->data[i]); - // For testing, check whether values match expectation. - if (in->value->data[i] != self->scale * self->count) { - failed = true; - } - self->count++; + if (i > 0) printf(", "); + printf("%d", in->value->data[i]); + // For testing, check whether values match expectation. + if (in->value->data[i] != self->scale * self->count) { + failed = true; + } + self->count++; } printf("]\n"); if (failed) { - printf("ERROR: Value received by Print does not match expectation!\n"); - exit(1); + printf("ERROR: Value received by Print does not match expectation!\n"); + exit(1); } =} reaction(shutdown) {= if (!self->input_received) { - lf_print_error_and_exit("TokenPrint: No input received!"); + lf_print_error_and_exit("TokenPrint: No input received!"); } =} } @@ -83,7 +83,7 @@ reactor TokenScale(scale: int = 2) { reaction(in) -> out {= for (int i = 0; i < in->value->length; i++) { - in->value->data[i] *= self->scale; + in->value->data[i] *= self->scale; } lf_set_token(out, in->token); =} diff --git a/test/C/src/zephyr/threaded/UserThreads.lf b/test/C/src/zephyr/threaded/UserThreads.lf index 5c19ce6d75..36f6e5b27a 100644 --- a/test/C/src/zephyr/threaded/UserThreads.lf +++ b/test/C/src/zephyr/threaded/UserThreads.lf @@ -13,7 +13,7 @@ main reactor { preamble {= #include "platform.h" void func(void* arg) { - lf_print("Hello from user thread"); + lf_print("Hello from user thread"); } lf_thread_t thread_ids[4]; @@ -23,17 +23,17 @@ main reactor { int res; for (int i = 0; i < 3; i++) { - res = lf_thread_create(&thread_ids[i], &func, NULL); - if (res != 0) { - lf_print_error_and_exit("Could not create thread"); - } + res = lf_thread_create(&thread_ids[i], &func, NULL); + if (res != 0) { + lf_print_error_and_exit("Could not create thread"); + } } res = lf_thread_create(&thread_ids[3], &func, NULL); if (res == 0) { - lf_print_error_and_exit("Could create more threads than specified."); + lf_print_error_and_exit("Could create more threads than specified."); } else { - printf("SUCCESS: Created exactly three user threads.\n"); + printf("SUCCESS: Created exactly three user threads.\n"); } =} } diff --git a/test/Cpp/src/ActionDelay.lf b/test/Cpp/src/ActionDelay.lf index 03b6b8beb9..98cbd11790 100644 --- a/test/Cpp/src/ActionDelay.lf +++ b/test/Cpp/src/ActionDelay.lf @@ -32,10 +32,10 @@ reactor Sink { std::cout << "physical time: " << physical << '\n'; std::cout << "elapsed logical time: " << elapsed_logical << '\n'; if (elapsed_logical != 100ms) { - std::cerr << "ERROR: Expected 100 msecs but got " << elapsed_logical << '\n'; - exit(1); + std::cerr << "ERROR: Expected 100 msecs but got " << elapsed_logical << '\n'; + exit(1); } else { - std::cout << "SUCCESS. Elapsed logical time is 100 msec.\n"; + std::cout << "SUCCESS. Elapsed logical time is 100 msec.\n"; } =} } diff --git a/test/Cpp/src/ActionIsPresent.lf b/test/Cpp/src/ActionIsPresent.lf index 4a75c262c7..db87343fac 100644 --- a/test/Cpp/src/ActionIsPresent.lf +++ b/test/Cpp/src/ActionIsPresent.lf @@ -8,22 +8,22 @@ main reactor ActionIsPresent(offset: time = 1 nsec, period: time(500 msec)) { reaction(startup, a) -> a {= if (!a.is_present()) { - if (offset == zero) { - std::cout << "Hello World!" << '\n'; - success = true; - } else { - a.schedule(offset); - } - } else { - std::cout << "Hello World 2!" << '\n'; + if (offset == zero) { + std::cout << "Hello World!" << '\n'; success = true; + } else { + a.schedule(offset); + } + } else { + std::cout << "Hello World 2!" << '\n'; + success = true; } =} reaction(shutdown) {= if (!success) { - std::cerr << "Failed to print 'Hello World!'" << '\n'; - exit(1); + std::cerr << "Failed to print 'Hello World!'" << '\n'; + exit(1); } =} } diff --git a/test/Cpp/src/ActionValues.lf b/test/Cpp/src/ActionValues.lf index 6e40e2d526..7c9b85aaff 100644 --- a/test/Cpp/src/ActionValues.lf +++ b/test/Cpp/src/ActionValues.lf @@ -7,7 +7,7 @@ main reactor ActionValues { logical action act(100 msec): int reaction(startup) -> act {= - act.schedule(100); // scheduled in 100 ms + act.schedule(100); // scheduled in 100 ms std::chrono::milliseconds delay(50); act.schedule(-100, delay); // scheduled in 150 ms, value is overwritten =} @@ -20,28 +20,28 @@ main reactor ActionValues { std::cout << "]\n"; if (elapsed == 100ms) { - if (*act.get() != 100) { - std::cerr << "ERROR: Expected action value to be 100\n"; - exit(1); - } - r1done = true; + if (*act.get() != 100) { + std::cerr << "ERROR: Expected action value to be 100\n"; + exit(1); + } + r1done = true; } else { - if (elapsed != 150ms) { - std::cerr << "ERROR: Unexpected reaction invocation at " << elapsed << '\n'; - exit(1); - } - if (*act.get() != -100) { - std::cerr << "ERROR: Expected action value to be -100\n"; - exit(1); - } - r2done = true; + if (elapsed != 150ms) { + std::cerr << "ERROR: Unexpected reaction invocation at " << elapsed << '\n'; + exit(1); + } + if (*act.get() != -100) { + std::cerr << "ERROR: Expected action value to be -100\n"; + exit(1); + } + r2done = true; } =} reaction(shutdown) {= if (!r1done || !r2done) { - std::cerr << "ERROR: Expected 2 reaction invocations\n"; - exit(1); + std::cerr << "ERROR: Expected 2 reaction invocations\n"; + exit(1); } =} } diff --git a/test/Cpp/src/After.lf b/test/Cpp/src/After.lf index 30405a258b..49ef7fbe6e 100644 --- a/test/Cpp/src/After.lf +++ b/test/Cpp/src/After.lf @@ -21,22 +21,22 @@ reactor print { auto elapsed_time = get_elapsed_logical_time(); std::cout << "Result is " << *x.get() << '\n'; if (*x.get() != 84) { - std::cerr << "ERROR: Expected result to be 84.\n"; - exit(1); + std::cerr << "ERROR: Expected result to be 84.\n"; + exit(1); } std::cout << "Current logical time is: " << elapsed_time << '\n'; std::cout << "Current physical time is: " << get_elapsed_physical_time() << '\n'; if (elapsed_time != expected_time) { - std::cerr << "ERROR: Expected logical time to be " << expected_time << '\n'; - exit(2); + std::cerr << "ERROR: Expected logical time to be " << expected_time << '\n'; + exit(2); } expected_time += 1s; =} reaction(shutdown) {= if (i == 0) { - std::cerr << "ERROR: Final reactor received no data.\n"; - exit(3); + std::cerr << "ERROR: Final reactor received no data.\n"; + exit(3); } =} } diff --git a/test/Cpp/src/AfterOverlapped.lf b/test/Cpp/src/AfterOverlapped.lf index 0ef3c57da5..c8f22bdf40 100644 --- a/test/Cpp/src/AfterOverlapped.lf +++ b/test/Cpp/src/AfterOverlapped.lf @@ -14,8 +14,8 @@ reactor Test { std::cout << "Received " << *c.get() << '\n'; i++; if (*c.get() != i) { - std::cerr << "ERROR: Expected " << i << " but got " << *c.get() << '\n'; - exit(1); + std::cerr << "ERROR: Expected " << i << " but got " << *c.get() << '\n'; + exit(1); } auto elapsed_time = get_elapsed_logical_time(); @@ -23,15 +23,15 @@ reactor Test { auto expected = 2s + ((*c.get() - 1) * 1s); if (elapsed_time != expected) { - std::cerr << "ERROR: Expected logical time to be " << expected << '\n'; - exit(1); + std::cerr << "ERROR: Expected logical time to be " << expected << '\n'; + exit(1); } =} reaction(shutdown) {= if (i == 0) { - std::cerr << "ERROR: Final reactor received no data.\n"; - exit(3); + std::cerr << "ERROR: Final reactor received no data.\n"; + exit(3); } =} } diff --git a/test/Cpp/src/AfterZero.lf b/test/Cpp/src/AfterZero.lf index a52ce7cedb..ce3c6dd5c7 100644 --- a/test/Cpp/src/AfterZero.lf +++ b/test/Cpp/src/AfterZero.lf @@ -21,27 +21,27 @@ reactor print { auto elapsed_time = get_elapsed_logical_time(); std::cout << "Result is " << *x.get() << '\n'; if (*x.get() != 84) { - std::cerr << "ERROR: Expected result to be 84.\n"; - exit(1); + std::cerr << "ERROR: Expected result to be 84.\n"; + exit(1); } std::cout << "Current logical time is: " << elapsed_time << '\n'; std::cout << "Current microstep is: " << get_microstep() << '\n'; std::cout << "Current physical time is: " << get_elapsed_physical_time() << '\n'; if (elapsed_time != expected_time) { - std::cerr << "ERROR: Expected logical time to be " << expected_time << '\n'; - exit(2); + std::cerr << "ERROR: Expected logical time to be " << expected_time << '\n'; + exit(2); } if (get_microstep() != 1) { - std::cerr << "Expected microstrp to be 1\n"; - exit(3); + std::cerr << "Expected microstrp to be 1\n"; + exit(3); } expected_time += 1s; =} reaction(shutdown) {= if (i == 0) { - std::cerr << "ERROR: Final reactor received no data.\n"; - exit(3); + std::cerr << "ERROR: Final reactor received no data.\n"; + exit(3); } =} } diff --git a/test/Cpp/src/Alignment.lf b/test/Cpp/src/Alignment.lf index 674c29c34c..00f4ce0936 100644 --- a/test/Cpp/src/Alignment.lf +++ b/test/Cpp/src/Alignment.lf @@ -33,12 +33,12 @@ reactor Sieve { reaction(in) -> out {= // Reject out of bounds inputs if(*in.get() <= 0 || *in.get() > 10000) { - reactor::log::Warn() << "Sieve: Input value out of range: " << *in.get(); + reactor::log::Warn() << "Sieve: Input value out of range: " << *in.get(); } // Primes 1 and 2 are not on the list. if (*in.get() == 1 || *in.get() == 2) { - out.set(true); - return; + out.set(true); + return; } // If the input is greater than the last found prime, then // we have to expand the list of primes before checking to @@ -46,20 +46,20 @@ reactor Sieve { int candidate = primes.back(); reactor::log::Info() << "Sieve: Checking prime: " << candidate; while (*in.get() > primes.back()) { - candidate += 2; - bool prime = true; - for (auto i : primes) { - if(candidate % i == 0) { - // Candidate is not prime. Break and add 2 by starting the loop again - prime = false; - break; - } - } - // If the candidate is not divisible by any prime in the list, it is prime - if (prime) { - primes.push_back(candidate); - reactor::log::Info() << "Sieve: Found prime: " << candidate; + candidate += 2; + bool prime = true; + for (auto i : primes) { + if(candidate % i == 0) { + // Candidate is not prime. Break and add 2 by starting the loop again + prime = false; + break; } + } + // If the candidate is not divisible by any prime in the list, it is prime + if (prime) { + primes.push_back(candidate); + reactor::log::Info() << "Sieve: Found prime: " << candidate; + } } // We are now assured that the input is less than or @@ -67,10 +67,10 @@ reactor Sieve { // See whether the input is an already found prime. // Search the primes from the end, where they are sparser. for (auto i = primes.rbegin(); i != primes.rend(); ++i) { - if(*i == *in.get()) { - out.set(true); - return; - } + if(*i == *in.get()) { + out.set(true); + return; + } } =} } @@ -82,12 +82,12 @@ reactor Destination { reaction(ok, in) {= if (ok.is_present() && in.is_present()) { - reactor::log::Info() << "Destination: Input " << *in.get() << " is a prime at logical time ( " - << get_elapsed_logical_time() << " )"; + reactor::log::Info() << "Destination: Input " << *in.get() << " is a prime at logical time ( " + << get_elapsed_logical_time() << " )"; } if( get_logical_time() <= last_invoked) { - reactor::log::Error() << "Invoked at logical time (" << get_logical_time() << ") " - << "but previously invoked at logical time (" << get_elapsed_logical_time() << ")"; + reactor::log::Error() << "Invoked at logical time (" << get_logical_time() << ") " + << "but previously invoked at logical time (" << get_elapsed_logical_time() << ")"; } last_invoked = get_logical_time(); diff --git a/test/Cpp/src/ArrayAsParameter.lf b/test/Cpp/src/ArrayAsParameter.lf index d2bf3c5ef9..511e19da12 100644 --- a/test/Cpp/src/ArrayAsParameter.lf +++ b/test/Cpp/src/ArrayAsParameter.lf @@ -10,7 +10,7 @@ reactor Source(sequence: std::vector = {0, 1, 2}) { out.set(sequence[count]); count++; if (count < sequence.size()) { - next.schedule(); + next.schedule(); } =} } @@ -22,16 +22,16 @@ reactor Print { reaction(in) {= std::cout << "Received: " << *in.get() << '\n'; if (*in.get() != count) { - std::cerr << "ERROR: Expected " << count << '\n'; - exit(1); + std::cerr << "ERROR: Expected " << count << '\n'; + exit(1); } count++; =} reaction(shutdown) {= if (count == 1) { - std::cerr << "ERROR: Final reactor received no data.\n"; - exit(3); + std::cerr << "ERROR: Final reactor received no data.\n"; + exit(3); } =} } diff --git a/test/Cpp/src/ArrayAsType.lf b/test/Cpp/src/ArrayAsType.lf index 0c7ba0f16b..8661b7bd87 100644 --- a/test/Cpp/src/ArrayAsType.lf +++ b/test/Cpp/src/ArrayAsType.lf @@ -25,21 +25,21 @@ reactor Print { std::cout << "Received: ["; for (int i = 0; i < 3; i++) { - std::cout << result[i]; - if (i < 2) { - std::cout << ", "; - } - - // check whether values match expectation. - if (result[i] != expected) { - failed = true; - } - expected++; + std::cout << result[i]; + if (i < 2) { + std::cout << ", "; + } + + // check whether values match expectation. + if (result[i] != expected) { + failed = true; + } + expected++; } std::cout << "]\n"; if (failed) { - printf("ERROR: Value received by Print does not match expectation!\n"); - exit(1); + printf("ERROR: Value received by Print does not match expectation!\n"); + exit(1); } =} } diff --git a/test/Cpp/src/ArrayParallel.lf b/test/Cpp/src/ArrayParallel.lf index 739614442c..a2ad6e8233 100644 --- a/test/Cpp/src/ArrayParallel.lf +++ b/test/Cpp/src/ArrayParallel.lf @@ -9,9 +9,9 @@ import Source, Print from "ArrayPrint.lf" main reactor ArrayParallel { s = new Source() c1 = new Scale() - c2 = new Scale(scale = 3) - p1 = new Print(scale = 2) - p2 = new Print(scale = 3) + c2 = new Scale(scale=3) + p1 = new Print(scale=2) + p2 = new Print(scale=3) s.out -> c1.in s.out -> c2.in c1.out -> p1.in diff --git a/test/Cpp/src/ArrayPrint.lf b/test/Cpp/src/ArrayPrint.lf index c0cbcff6fc..2fe5f448ca 100644 --- a/test/Cpp/src/ArrayPrint.lf +++ b/test/Cpp/src/ArrayPrint.lf @@ -29,21 +29,21 @@ reactor Print(scale: int = 1) { std::cout << "Received: ["; for (int i = 0; i < 3; i++) { - std::cout << result[i]; - if (i < 2) { - std::cout << ", "; - } - - // check whether values match expectation. - if (result[i] != expected * scale) { - failed = true; - } - expected++; + std::cout << result[i]; + if (i < 2) { + std::cout << ", "; + } + + // check whether values match expectation. + if (result[i] != expected * scale) { + failed = true; + } + expected++; } std::cout << "]\n"; if (failed) { - printf("ERROR: Value received by Print does not match expectation!\n"); - exit(1); + printf("ERROR: Value received by Print does not match expectation!\n"); + exit(1); } =} } diff --git a/test/Cpp/src/ArrayScale.lf b/test/Cpp/src/ArrayScale.lf index 89bdf68ab9..9d0b3cf350 100644 --- a/test/Cpp/src/ArrayScale.lf +++ b/test/Cpp/src/ArrayScale.lf @@ -15,7 +15,7 @@ reactor Scale(scale: int = 2) { // NOTE: Ideally, no copy copy would be made here, as there is only // one recipient for the value, but this is not supported yet by the C++ runtime. for(int i = 0; i < array->size(); i++) { - (*array)[i] = (*array)[i] * scale; + (*array)[i] = (*array)[i] * scale; } out.set(std::move(array)); =} @@ -23,8 +23,8 @@ reactor Scale(scale: int = 2) { main reactor ArrayScale { s = new Source() - c = new Scale(scale = 2) - p = new Print(scale = 2) + c = new Scale(scale=2) + p = new Print(scale=2) s.out -> c.in c.out -> p.in } diff --git a/test/Cpp/src/CharLiteralInitializer.lf b/test/Cpp/src/CharLiteralInitializer.lf index 3a104b2bb3..b845999268 100644 --- a/test/Cpp/src/CharLiteralInitializer.lf +++ b/test/Cpp/src/CharLiteralInitializer.lf @@ -6,8 +6,8 @@ main reactor CharLiteralInitializer { reaction(startup) {= if (c != 'x') { - std::cout << "FAILED: Expected 'x', got " << c << '\n'; - exit(1); + std::cout << "FAILED: Expected 'x', got " << c << '\n'; + exit(1); } =} } diff --git a/test/Cpp/src/Composition.lf b/test/Cpp/src/Composition.lf index 79105666d5..35e62edfa8 100644 --- a/test/Cpp/src/Composition.lf +++ b/test/Cpp/src/Composition.lf @@ -24,15 +24,15 @@ reactor Test { auto value = *x.get(); std::cout << "Received " << value << std::endl; if (value != count) { - std::cerr << "FAILURE: Expected " << count << std::endl; - exit(1); + std::cerr << "FAILURE: Expected " << count << std::endl; + exit(1); } =} reaction(shutdown) {= if (count != 5) { - std::cerr << "ERROR: expected to receive 5 values but got " << count << '\n'; - exit(1); + std::cerr << "ERROR: expected to receive 5 values but got " << count << '\n'; + exit(1); } =} } diff --git a/test/Cpp/src/CompositionAfter.lf b/test/Cpp/src/CompositionAfter.lf index 265cc3b249..230bbd1fb3 100644 --- a/test/Cpp/src/CompositionAfter.lf +++ b/test/Cpp/src/CompositionAfter.lf @@ -24,15 +24,15 @@ reactor Test { auto value = *x.get(); std::cout << "Received " << value << std::endl; if (value != count) { - std::cerr << "FAILURE: Expected " << count << std::endl; - exit(1); + std::cerr << "FAILURE: Expected " << count << std::endl; + exit(1); } =} reaction(shutdown) {= if (count != 3) { - std::cerr << "ERROR: expected to receive 3 values but got " << count << '\n'; - exit(1); + std::cerr << "ERROR: expected to receive 3 values but got " << count << '\n'; + exit(1); } =} } diff --git a/test/Cpp/src/CompositionGain.lf b/test/Cpp/src/CompositionGain.lf index bd4804fcc6..db02a4ad55 100644 --- a/test/Cpp/src/CompositionGain.lf +++ b/test/Cpp/src/CompositionGain.lf @@ -27,8 +27,8 @@ main reactor CompositionGain { reaction(wrapper.y) {= reactor::log::Info() << "Received " << *wrapper.y.get(); if (*wrapper.y.get() != 42*2) { - reactor::log::Error() << "Received value should have been " << 42 * 2; - exit(2); + reactor::log::Error() << "Received value should have been " << 42 * 2; + exit(2); } =} } diff --git a/test/Cpp/src/CountTest.lf b/test/Cpp/src/CountTest.lf index d272ee39ca..1ee6fb5328 100644 --- a/test/Cpp/src/CountTest.lf +++ b/test/Cpp/src/CountTest.lf @@ -12,8 +12,8 @@ reactor Test { reaction(c) {= i++; if (*c.get() != i) { - std::cerr << "ERROR: Expected " << i << " but got " << *c.get() << std::endl; - exit(1); + std::cerr << "ERROR: Expected " << i << " but got " << *c.get() << std::endl; + exit(1); } =} } diff --git a/test/Cpp/src/Deadline.lf b/test/Cpp/src/Deadline.lf index 90f0a70af6..e150d8eb85 100644 --- a/test/Cpp/src/Deadline.lf +++ b/test/Cpp/src/Deadline.lf @@ -14,9 +14,9 @@ reactor Source(period: time = 2 sec) { reaction(t) -> y {= if (count % 2 == 1) { - // The count variable is odd. - // Take time to cause a deadline violation. - std::this_thread::sleep_for(400ms); + // The count variable is odd. + // Take time to cause a deadline violation. + std::this_thread::sleep_for(400ms); } std::cout << "Source sends: " << count << std::endl; y.set(count); @@ -31,21 +31,21 @@ reactor Destination(timeout: time = 1 sec) { reaction(x) {= std::cout << "Destination receives: " << *x.get() << std::endl; if (count % 2 == 1) { - // The count variable is odd, so the deadline should have been - // violated - std::cerr << "ERROR: Failed to detect deadline." << std::endl; - exit(1); + // The count variable is odd, so the deadline should have been + // violated + std::cerr << "ERROR: Failed to detect deadline." << std::endl; + exit(1); } count++; =} deadline(timeout) {= std::cout << "Destination deadline handler receives: " - << *x.get() << std::endl; + << *x.get() << std::endl; if (count % 2 == 0) { - // The count variable is even, so the deadline should not have - // been violated. - std::cerr << "ERROR: Deadline handler invoked without deadline " - << "violation." << std::endl; - exit(2); + // The count variable is even, so the deadline should not have + // been violated. + std::cerr << "ERROR: Deadline handler invoked without deadline " + << "violation." << std::endl; + exit(2); } count++; =} diff --git a/test/Cpp/src/DeadlineHandledAbove.lf b/test/Cpp/src/DeadlineHandledAbove.lf index 17ed373ab0..ed7b0068b2 100644 --- a/test/Cpp/src/DeadlineHandledAbove.lf +++ b/test/Cpp/src/DeadlineHandledAbove.lf @@ -26,17 +26,17 @@ main reactor DeadlineHandledAbove { reaction(d.deadline_violation) {= if (*d.deadline_violation.get()) { - std::cout << "Output successfully produced by deadline miss handler." << std::endl; - violation_detected = true; + std::cout << "Output successfully produced by deadline miss handler." << std::endl; + violation_detected = true; } =} reaction(shutdown) {= if (violation_detected) { - std::cout << "SUCCESS. Test passes." << std::endl; + std::cout << "SUCCESS. Test passes." << std::endl; } else { - std::cerr << "ERROR. Container did not react to deadline violation." << std::endl; - exit(2); + std::cerr << "ERROR. Container did not react to deadline violation." << std::endl; + exit(2); } =} } diff --git a/test/Cpp/src/DelayInt.lf b/test/Cpp/src/DelayInt.lf index d9c2e0afe7..757890db20 100644 --- a/test/Cpp/src/DelayInt.lf +++ b/test/Cpp/src/DelayInt.lf @@ -10,7 +10,7 @@ reactor Delay(delay: time = 100 msec) { reaction(d) -> out {= if (d.is_present()) { - out.set(d.get()); + out.set(d.get()); } =} } @@ -32,14 +32,14 @@ reactor Test { auto elapsed = current_time - start_time; std::cout << "After " << elapsed << " of logical time." << std::endl; if (elapsed != 100ms) { - std::cerr << "ERROR: Expected elapsed time to be 100000000 nsecs. " - << "It was " << elapsed << std::endl; - exit(1); + std::cerr << "ERROR: Expected elapsed time to be 100000000 nsecs. " + << "It was " << elapsed << std::endl; + exit(1); } if (*in.get() != 42) { - std::cerr << "ERROR: Expected input value to be 42. " - << "It was " << *in.get() << std::endl; - exit(2); + std::cerr << "ERROR: Expected input value to be 42. " + << "It was " << *in.get() << std::endl; + exit(2); } =} } diff --git a/test/Cpp/src/DelayedAction.lf b/test/Cpp/src/DelayedAction.lf index d8f908cc73..deb3745a97 100644 --- a/test/Cpp/src/DelayedAction.lf +++ b/test/Cpp/src/DelayedAction.lf @@ -17,9 +17,9 @@ main reactor DelayedAction { auto expected = count * 1s + 100ms; count++; if (elapsed != expected) { - std::cerr << "Expected " << expected << " but got " - << elapsed << std::endl; - exit(1); + std::cerr << "Expected " << expected << " but got " + << elapsed << std::endl; + exit(1); } =} } diff --git a/test/Cpp/src/DelayedReaction.lf b/test/Cpp/src/DelayedReaction.lf index c5e937a8e7..c975246d23 100644 --- a/test/Cpp/src/DelayedReaction.lf +++ b/test/Cpp/src/DelayedReaction.lf @@ -14,8 +14,8 @@ reactor Sink { auto elapsed = get_elapsed_logical_time(); std::cout << "Nanoseconds since start: " << elapsed << '\n'; if (elapsed != 100ms) { - std::cerr << "ERROR: Expected 100000000 nsecs.\n"; - exit(1); + std::cerr << "ERROR: Expected 100000000 nsecs.\n"; + exit(1); } =} } diff --git a/test/Cpp/src/Determinism.lf b/test/Cpp/src/Determinism.lf index 063a25519d..43577397e9 100644 --- a/test/Cpp/src/Determinism.lf +++ b/test/Cpp/src/Determinism.lf @@ -14,15 +14,15 @@ reactor Destination { reaction(x, y) {= int sum = 0; if (x.is_present()) { - sum += *x.get(); + sum += *x.get(); } if (y.is_present()) { - sum += *y.get(); + sum += *y.get(); } std::cout << "Received " << sum << std::endl; if (sum != 2) { - std::cerr << "FAILURE: Expected 2." << std::endl; - exit(4); + std::cerr << "FAILURE: Expected 2." << std::endl; + exit(4); } =} } diff --git a/test/Cpp/src/DoubleInvocation.lf b/test/Cpp/src/DoubleInvocation.lf index 52496dbd9c..bb741aeb21 100644 --- a/test/Cpp/src/DoubleInvocation.lf +++ b/test/Cpp/src/DoubleInvocation.lf @@ -33,11 +33,11 @@ reactor Print { reaction(position, velocity) {= if (position.is_present()) { - reactor::log::Info() << "Position: " << *position.get(); + reactor::log::Info() << "Position: " << *position.get(); } if (*position.get() == previous) { - reactor::log::Error() << "Multiple firings at the same logical time!"; - exit(1); + reactor::log::Error() << "Multiple firings at the same logical time!"; + exit(1); } =} } diff --git a/test/Cpp/src/DoublePort.lf b/test/Cpp/src/DoublePort.lf index 79a385873c..fed174dbe5 100644 --- a/test/Cpp/src/DoublePort.lf +++ b/test/Cpp/src/DoublePort.lf @@ -31,17 +31,17 @@ reactor Print { reaction(in, in2) {= if(in.is_present()){ - reactor::log::Info() << "At tag (" << get_elapsed_logical_time() << ", " << environment()->logical_time().micro_step() - << "), received in = " << *in.get(); + reactor::log::Info() << "At tag (" << get_elapsed_logical_time() << ", " << environment()->logical_time().micro_step() + << "), received in = " << *in.get(); } else if (in2.is_present()){ - reactor::log::Info() << "At tag (" << get_elapsed_logical_time() << ", " << environment()->logical_time().micro_step() - << "), received in2 = " << *in2.get(); + reactor::log::Info() << "At tag (" << get_elapsed_logical_time() << ", " << environment()->logical_time().micro_step() + << "), received in2 = " << *in2.get(); } if ( in.is_present() && in2.is_present()) { - reactor::log::Error() << "ERROR: invalid logical simultaneity."; - exit(1); + reactor::log::Error() << "ERROR: invalid logical simultaneity."; + exit(1); } =} diff --git a/test/Cpp/src/DoubleReaction.lf b/test/Cpp/src/DoubleReaction.lf index f8002be54d..6d783fefe7 100644 --- a/test/Cpp/src/DoubleReaction.lf +++ b/test/Cpp/src/DoubleReaction.lf @@ -24,16 +24,16 @@ reactor Destination { reaction(x, w) {= int sum = 0; if (x.is_present()) { - sum += *x.get(); + sum += *x.get(); } if (w.is_present()) { - sum += *w.get(); + sum += *w.get(); } std::cout << "Sum of inputs is: " << sum << std::endl; if (sum != s) { - std::cerr << "FAILURE: Expected sum to be " << s - << "but it was " << sum << std::endl; - exit(1); + std::cerr << "FAILURE: Expected sum to be " << s + << "but it was " << sum << std::endl; + exit(1); } s += 2; =} diff --git a/test/Cpp/src/DoubleTrigger.lf b/test/Cpp/src/DoubleTrigger.lf index f55ffcfedd..d64d3e35c1 100644 --- a/test/Cpp/src/DoubleTrigger.lf +++ b/test/Cpp/src/DoubleTrigger.lf @@ -9,17 +9,17 @@ main reactor DoubleTrigger { reaction(t1, t2) {= s++; if (s > 1) { - std::cout << "FAILURE: Reaction got triggered twice." << std::endl; - exit(1); + std::cout << "FAILURE: Reaction got triggered twice." << std::endl; + exit(1); } =} reaction(shutdown) {= if (s == 1) { - std::cout << "SUCCESS" << std::endl; + std::cout << "SUCCESS" << std::endl; } else { - std::cerr << "FAILURE: Reaction was never triggered." << std::endl; - exit(1); + std::cerr << "FAILURE: Reaction was never triggered." << std::endl; + exit(1); } =} } diff --git a/test/Cpp/src/FloatLiteral.lf b/test/Cpp/src/FloatLiteral.lf index f66aacbb12..be70ce64c1 100644 --- a/test/Cpp/src/FloatLiteral.lf +++ b/test/Cpp/src/FloatLiteral.lf @@ -10,11 +10,11 @@ main reactor { reaction(startup) {= auto F = - N * charge; if (std::abs(F - expected) < std::abs(minus_epsilon)) { - std::cout << "The Faraday constant is roughly " << F << ".\n"; + std::cout << "The Faraday constant is roughly " << F << ".\n"; } else { - std::cerr << "ERROR: Expected " << expected - << " but computed " << F << ".\n"; - exit(1); + std::cerr << "ERROR: Expected " << expected + << " but computed " << F << ".\n"; + exit(1); } =} } diff --git a/test/Cpp/src/Gain.lf b/test/Cpp/src/Gain.lf index 1a5d6eeedd..6bc9794951 100644 --- a/test/Cpp/src/Gain.lf +++ b/test/Cpp/src/Gain.lf @@ -15,8 +15,8 @@ reactor Test { auto value = *x.get(); std::cout << "Received " << value << std::endl; if (value != 2) { - std::cerr << "Expected 2!" << std::endl; - exit(1); + std::cerr << "Expected 2!" << std::endl; + exit(1); } =} } diff --git a/test/Cpp/src/GetMicroStep.lf b/test/Cpp/src/GetMicroStep.lf index 5bec79df3c..5552d57ef9 100644 --- a/test/Cpp/src/GetMicroStep.lf +++ b/test/Cpp/src/GetMicroStep.lf @@ -11,18 +11,18 @@ main reactor GetMicroStep { reaction(l) -> l {= auto microstep = get_microstep(); if (microstep != s) { - std::cerr << "Error: expected microstep " << s << ", got " << microstep << "instead\n"; - exit(1); + std::cerr << "Error: expected microstep " << s << ", got " << microstep << "instead\n"; + exit(1); } if (s++ < 10) { - l.schedule(); + l.schedule(); } =} reaction(shutdown) {= if (s != 11) { - std::cerr << "Error: unexpected state!\n"; - exit(2); + std::cerr << "Error: unexpected state!\n"; + exit(2); } std::cout << "Success!\n"; =} diff --git a/test/Cpp/src/Hello.lf b/test/Cpp/src/Hello.lf index 0bf2f029da..022b9a7383 100644 --- a/test/Cpp/src/Hello.lf +++ b/test/Cpp/src/Hello.lf @@ -25,18 +25,18 @@ reactor HelloCpp(period: time = 2 sec, message: {= std::string =} = "Hello C++") count++; auto time = get_logical_time(); std::cout << "***** action " << count << " at time " - << time << std::endl; + << time << std::endl; auto diff = time - previous_time; if (diff != 200ms) { - std::cerr << "FAILURE: Expected 200 msecs of logical time to elapse " - << "but got " << diff << std::endl; - exit(1); + std::cerr << "FAILURE: Expected 200 msecs of logical time to elapse " + << "but got " << diff << std::endl; + exit(1); } =} } reactor Inside(period: time = 1 sec, message: std::string = "Composite default message.") { - third_instance = new HelloCpp(period = period, message = message) + third_instance = new HelloCpp(period=period, message=message) } main reactor Hello { diff --git a/test/Cpp/src/Hierarchy.lf b/test/Cpp/src/Hierarchy.lf index d207a20c31..ba92775c1c 100644 --- a/test/Cpp/src/Hierarchy.lf +++ b/test/Cpp/src/Hierarchy.lf @@ -22,8 +22,8 @@ reactor Print { auto value = *in.get(); std::cout << "Received: " << value << std::endl; if (value != 2) { - std::cerr << "Expected 2." << std::endl; - exit(1); + std::cerr << "Expected 2." << std::endl; + exit(1); } =} } diff --git a/test/Cpp/src/Hierarchy2.lf b/test/Cpp/src/Hierarchy2.lf index 478c82db97..e21a966c54 100644 --- a/test/Cpp/src/Hierarchy2.lf +++ b/test/Cpp/src/Hierarchy2.lf @@ -43,8 +43,8 @@ reactor Print { auto value = *in.get(); std::cout << "Received: " << value << std::endl; if (value != expected) { - std::cerr << "Expected " << expected << std::endl; - exit(1); + std::cerr << "Expected " << expected << std::endl; + exit(1); } expected++; =} diff --git a/test/Cpp/src/ImportComposition.lf b/test/Cpp/src/ImportComposition.lf index 88dfdff0a9..390f02bee3 100644 --- a/test/Cpp/src/ImportComposition.lf +++ b/test/Cpp/src/ImportComposition.lf @@ -24,19 +24,19 @@ main reactor ImportComposition { reactor::log::Info() << "Received " << *imp_comp.y.get() << " at time " << receive_time; received = true; if(receive_time != 55ms) { - reactor::log::Error() << "ERROR: Received time should have been: 55,000,000."; - exit(1); + reactor::log::Error() << "ERROR: Received time should have been: 55,000,000."; + exit(1); } if(*imp_comp.y.get() != 42*2*2) { - reactor::log::Error() << "ERROR: Received value should have been: " << 42*2*2 << "."; - exit(2); + reactor::log::Error() << "ERROR: Received value should have been: " << 42*2*2 << "."; + exit(2); } =} reaction(shutdown) {= if(!received){ - reactor::log::Error() << "ERROR: Nothing received."; - exit(3); + reactor::log::Error() << "ERROR: Nothing received."; + exit(3); } =} } diff --git a/test/Cpp/src/ManualDelayedReaction.lf b/test/Cpp/src/ManualDelayedReaction.lf index f1917be62f..e7bb1190ba 100644 --- a/test/Cpp/src/ManualDelayedReaction.lf +++ b/test/Cpp/src/ManualDelayedReaction.lf @@ -27,8 +27,8 @@ reactor Sink { auto elapsed_logical = get_elapsed_logical_time(); std::cout << "Elapsed logical time: " << elapsed_logical << '\n'; if (elapsed_logical != 100ms) { - std::cerr << "ERROR: Expected 100 ms\n"; - exit(1); + std::cerr << "ERROR: Expected 100 ms\n"; + exit(1); } =} } diff --git a/test/Cpp/src/Methods.lf b/test/Cpp/src/Methods.lf index 6b60012640..c39b0dff4d 100644 --- a/test/Cpp/src/Methods.lf +++ b/test/Cpp/src/Methods.lf @@ -10,15 +10,15 @@ main reactor { reaction(startup) {= std::cout << "Foo is initialized to " << getFoo() << '\n'; if (getFoo() != 2) { - std::cerr << "Error: expected 2!\n"; - exit(1); + std::cerr << "Error: expected 2!\n"; + exit(1); } add(40); std::cout << "2 + 40 = " << getFoo() << '\n'; if (getFoo() != 42) { - std::cerr << "Error: expected 42!\n"; - exit(2); + std::cerr << "Error: expected 42!\n"; + exit(2); } =} } diff --git a/test/Cpp/src/Microsteps.lf b/test/Cpp/src/Microsteps.lf index fedf9c145f..51a61e508a 100644 --- a/test/Cpp/src/Microsteps.lf +++ b/test/Cpp/src/Microsteps.lf @@ -8,23 +8,23 @@ reactor Destination { auto elapsed = get_elapsed_logical_time(); std::cout << "Time since start: " << elapsed << std::endl; if (elapsed != reactor::Duration::zero()) { - std::cerr << "Expected elapsed time to be 0, but it was " << - elapsed << std::endl; - exit(1); + std::cerr << "Expected elapsed time to be 0, but it was " << + elapsed << std::endl; + exit(1); } int count{0}; if (x.is_present()) { - std::cout << " x is present." << std::endl; - count++; + std::cout << " x is present." << std::endl; + count++; } if (y.is_present()) { - std::cout << " y is present." << std::endl; - count++; + std::cout << " y is present." << std::endl; + count++; } if (count != 1) { - std::cerr << "Expected exactly one input to be present but got " - << count << std::endl; - exit(1); + std::cerr << "Expected exactly one input to be present but got " + << count << std::endl; + exit(1); } =} } diff --git a/test/Cpp/src/MovingAverage.lf b/test/Cpp/src/MovingAverage.lf index 817c80c920..795d4da681 100644 --- a/test/Cpp/src/MovingAverage.lf +++ b/test/Cpp/src/MovingAverage.lf @@ -27,7 +27,7 @@ reactor MovingAverageImpl { // Calculate the output. double sum = *in.get(); for (int i = 0; i < 3; i++) { - sum += delay_line[i]; + sum += delay_line[i]; } out.set(sum/4.0); @@ -37,7 +37,7 @@ reactor MovingAverageImpl { // Update the index for the next input. index++; if (index >= 3) { - index = 0; + index = 0; } =} } @@ -50,16 +50,16 @@ reactor Print { std::cout << "Received: " << *in.get() << '\n'; constexpr double expected[6] = {0.0, 0.25, 0.75, 1.5, 2.5, 3.5}; if (*in.get() != expected[count]) { - std::cerr << "ERROR: Expected " << expected[count] << '\n'; - exit(1); + std::cerr << "ERROR: Expected " << expected[count] << '\n'; + exit(1); } count++; =} reaction(shutdown) {= if(count != 6) { - std::cerr << "ERROR: Expected 6 values but got " << count << '\n'; - exit(2); + std::cerr << "ERROR: Expected 6 values but got " << count << '\n'; + exit(2); } =} } diff --git a/test/Cpp/src/MultipleContained.lf b/test/Cpp/src/MultipleContained.lf index bfe71c9b02..df168ca394 100644 --- a/test/Cpp/src/MultipleContained.lf +++ b/test/Cpp/src/MultipleContained.lf @@ -11,16 +11,16 @@ reactor Contained { reaction(in1) {= std::cout << "in1 received " << *in1.get() << '\n'; if (*in1.get() != 42) { - std::cerr << "FAILED: Expected 42.\n"; - exit(1); + std::cerr << "FAILED: Expected 42.\n"; + exit(1); } =} reaction(in2) {= std::cout << "in2 received " << *in2.get() << '\n'; if (*in2.get() != 42) { - std::cerr << "FAILED: Expected 42.\n"; - exit(1); + std::cerr << "FAILED: Expected 42.\n"; + exit(1); } =} } diff --git a/test/Cpp/src/NativeListsAndTimes.lf b/test/Cpp/src/NativeListsAndTimes.lf index 7320f5acc5..b6e8550c50 100644 --- a/test/Cpp/src/NativeListsAndTimes.lf +++ b/test/Cpp/src/NativeListsAndTimes.lf @@ -2,14 +2,13 @@ target Cpp // This test passes if it is successfully compiled into valid target code. reactor Foo( - x: int = 0, - y: time = 0, // Units are missing but not required - z = 1 msec, // Type is missing but not required - p: int[]{1, 2, 3, 4}, // List of integers - q: {= std::vector =}{1 msec, 2 msec, 3 msec}, - g: time[]{1 msec, 2 msec}, // List of time values - g2: int[] = {} -) { + x: int = 0, + y: time = 0, // Units are missing but not required + z = 1 msec, // Type is missing but not required + p: int[]{1, 2, 3, 4}, // List of integers + q: {= std::vector =}{1 msec, 2 msec, 3 msec}, + g: time[]{1 msec, 2 msec}, // List of time values + g2: int[] = {}) { state s: time = y // Reference to explicitly typed time parameter state t: time = z // Reference to implicitly typed time parameter state v: bool // Uninitialized boolean state variable diff --git a/test/Cpp/src/NestedTriggeredReactions.lf b/test/Cpp/src/NestedTriggeredReactions.lf index 22ea978545..7cd16fad2e 100644 --- a/test/Cpp/src/NestedTriggeredReactions.lf +++ b/test/Cpp/src/NestedTriggeredReactions.lf @@ -13,8 +13,8 @@ reactor Container { reaction(shutdown) {= if (!triggered) { - reactor::log::Error() << "The Container reaction was not triggered!"; - exit(1); + reactor::log::Error() << "The Container reaction was not triggered!"; + exit(1); } =} } @@ -28,8 +28,8 @@ reactor Contained { reaction(shutdown) {= if (!triggered) { - reactor::log::Error() << "The Contained reaction was not triggered!"; - exit(1); + reactor::log::Error() << "The Contained reaction was not triggered!"; + exit(1); } =} } diff --git a/test/Cpp/src/ParameterHierarchy.lf b/test/Cpp/src/ParameterHierarchy.lf index dcef563d68..e2d1432d10 100644 --- a/test/Cpp/src/ParameterHierarchy.lf +++ b/test/Cpp/src/ParameterHierarchy.lf @@ -10,16 +10,16 @@ target Cpp reactor Deep(p: int = 0) { reaction(startup) {= if(p != 42) { - reactor::log::Error() << "Parameter value is: " << p << ". Should have been 42."; - exit(1); + reactor::log::Error() << "Parameter value is: " << p << ". Should have been 42."; + exit(1); } else { - reactor::log::Info() << "Success."; + reactor::log::Info() << "Success."; } =} } reactor Intermediate(p: int = 10) { - a = new Deep(p = p) + a = new Deep(p=p) } reactor Another(p: int = 20) { @@ -27,5 +27,5 @@ reactor Another(p: int = 20) { } main reactor ParameterHierarchy { - a = new Intermediate(p = 42) + a = new Intermediate(p=42) } diff --git a/test/Cpp/src/ParameterizedState.lf b/test/Cpp/src/ParameterizedState.lf index 9bea16475f..72442afa38 100644 --- a/test/Cpp/src/ParameterizedState.lf +++ b/test/Cpp/src/ParameterizedState.lf @@ -6,11 +6,11 @@ reactor Foo(bar: int = 4) { reaction(startup) {= std::cout << "Baz: " << baz << std::endl; if (baz != 42) { - exit(1); + exit(1); } =} } main reactor ParameterizedState { - a = new Foo(bar = 42) + a = new Foo(bar=42) } diff --git a/test/Cpp/src/ParametersOutOfOrder.lf b/test/Cpp/src/ParametersOutOfOrder.lf index 4fa2a933ba..729a1fd2e5 100644 --- a/test/Cpp/src/ParametersOutOfOrder.lf +++ b/test/Cpp/src/ParametersOutOfOrder.lf @@ -5,12 +5,12 @@ target Cpp reactor Foo(a: int = 0, b: std::string = "", c: float = 0.0) { reaction(startup) {= if (a != 42 || b != "bar" || c < 3.1) { - reactor::log::Error() << "received an unexpected parameter!"; - exit(1); + reactor::log::Error() << "received an unexpected parameter!"; + exit(1); } =} } main reactor { - foo = new Foo(c = 3.14, b = "bar", a = 42) + foo = new Foo(c=3.14, b="bar", a=42) } diff --git a/test/Cpp/src/PeriodicDesugared.lf b/test/Cpp/src/PeriodicDesugared.lf index 23d815b46d..1e5dad1b7d 100644 --- a/test/Cpp/src/PeriodicDesugared.lf +++ b/test/Cpp/src/PeriodicDesugared.lf @@ -20,8 +20,8 @@ main reactor(offset: time = 50 msec, period: time = 500 msec) { auto logical_time = get_elapsed_logical_time(); std::cout << "Elapsed logical time: " << logical_time << '\n'; if (logical_time != expected) { - std::cerr << "ERROR: expected " << expected << '\n'; - exit(1); + std::cerr << "ERROR: expected " << expected << '\n'; + exit(1); } expected += period; recur.schedule(); diff --git a/test/Cpp/src/PhysicalConnection.lf b/test/Cpp/src/PhysicalConnection.lf index c42b827765..7957b5460f 100644 --- a/test/Cpp/src/PhysicalConnection.lf +++ b/test/Cpp/src/PhysicalConnection.lf @@ -16,8 +16,8 @@ reactor Destination { auto time = get_elapsed_logical_time(); reactor::log::Info() << "Received " << *in.get() << " at logical time " << time; if (time == reactor::Duration::zero()) { - reactor::log::Error() << "Logical time should have been greater than zero."; - exit(1); + reactor::log::Error() << "Logical time should have been greater than zero."; + exit(1); } received = true; @@ -25,8 +25,8 @@ reactor Destination { reaction(shutdown) {= if (!received) { - reactor::log::Error() << "Nothing received."; - exit(2); + reactor::log::Error() << "Nothing received."; + exit(2); } =} } diff --git a/test/Cpp/src/Pipeline.lf b/test/Cpp/src/Pipeline.lf index 49cc4dd212..00e9e3f48e 100644 --- a/test/Cpp/src/Pipeline.lf +++ b/test/Cpp/src/Pipeline.lf @@ -11,16 +11,16 @@ reactor Print { reaction(in) {= std::cout << "Received: " << *in.get() << '\n'; if (*in.get() != count) { - std::cerr << "ERROR: Expected " << count << '\n'; - exit(1); + std::cerr << "ERROR: Expected " << count << '\n'; + exit(1); } count++; =} reaction(shutdown) {= if (count == 1) { - std::cerr << "ERROR: Final reactor received no data.\n"; - exit(3); + std::cerr << "ERROR: Final reactor received no data.\n"; + exit(3); } =} } diff --git a/test/Cpp/src/PreambleTest.lf b/test/Cpp/src/PreambleTest.lf index 60a0128b29..b82e393a8e 100644 --- a/test/Cpp/src/PreambleTest.lf +++ b/test/Cpp/src/PreambleTest.lf @@ -5,8 +5,8 @@ main reactor { // in the generated header. This goes to Preamble/Preamble.hh. public preamble {= struct MyStruct { - int foo; - std::string bar; + int foo; + std::string bar; }; =} // this is only used inside reactions and therefore goes to the generated source file This @@ -15,7 +15,7 @@ main reactor { // This goes to Preamble/Preamble.cc private preamble {= int add_42(int i) { - return i + 42; + return i + 42; } =} logical action a: MyStruct diff --git a/test/Cpp/src/ReadOutputOfContainedReactor.lf b/test/Cpp/src/ReadOutputOfContainedReactor.lf index 4e0f17f46e..885fbad734 100644 --- a/test/Cpp/src/ReadOutputOfContainedReactor.lf +++ b/test/Cpp/src/ReadOutputOfContainedReactor.lf @@ -13,39 +13,39 @@ main reactor ReadOutputOfContainedReactor { reaction(startup) c.out {= std::cout << "Startup reaction reading output of contained " - << "reactor: " << *c.out.get() << std::endl; + << "reactor: " << *c.out.get() << std::endl; if (*c.out.get() != 42) { - std::cout << "FAILURE: expected 42" << std::endl; - exit(2); + std::cout << "FAILURE: expected 42" << std::endl; + exit(2); } count++; =} reaction(c.out) {= std::cout << "Reading output of contained reactor: " << *c.out.get() - << std::endl; + << std::endl; if (*c.out.get() != 42) { - std::cout << "FAILURE: expected 42" << std::endl; - exit(2); + std::cout << "FAILURE: expected 42" << std::endl; + exit(2); } count++; =} reaction(startup, c.out) {= std::cout << "Alternate triggering reading output of contained " - << "reactor: " << *c.out.get() << std::endl; + << "reactor: " << *c.out.get() << std::endl; if (*c.out.get() != 42) { - std::cout << "FAILURE: expected 42" << std::endl; - exit(2); + std::cout << "FAILURE: expected 42" << std::endl; + exit(2); } count++; =} reaction(shutdown) {= if (count != 3) { - std::cerr << "ERROR: One of the reactions failed to trigger." - << std::endl; - exit(1); + std::cerr << "ERROR: One of the reactions failed to trigger." + << std::endl; + exit(1); } =} } diff --git a/test/Cpp/src/Schedule.lf b/test/Cpp/src/Schedule.lf index 67de9fb876..c62b1bf701 100644 --- a/test/Cpp/src/Schedule.lf +++ b/test/Cpp/src/Schedule.lf @@ -10,11 +10,11 @@ reactor ScheduleTest { reaction(a) {= auto elapsed_time = get_elapsed_logical_time(); std::cout << "Action triggered at logical time " << elapsed_time.count() - << " after start" << std::endl; + << " after start" << std::endl; if (elapsed_time != 200ms) { - std::cerr << "Expected action time to be 200 msec. It was " - << elapsed_time.count() << "nsec!" << std::endl; - exit(1); + std::cerr << "Expected action time to be 200 msec. It was " + << elapsed_time.count() << "nsec!" << std::endl; + exit(1); } =} } diff --git a/test/Cpp/src/ScheduleLogicalAction.lf b/test/Cpp/src/ScheduleLogicalAction.lf index a64eac9fe7..f8092b3f09 100644 --- a/test/Cpp/src/ScheduleLogicalAction.lf +++ b/test/Cpp/src/ScheduleLogicalAction.lf @@ -35,8 +35,8 @@ reactor print { reactor::log::Info() << "Current logical time is: " << elapsed_time; reactor::log::Info() << "Current physical time is: " << get_elapsed_physical_time().count(); if(elapsed_time != expected_time) { - reactor::log::Error() << "ERROR: Expected logical time to be " << expected_time; - exit(1); + reactor::log::Error() << "ERROR: Expected logical time to be " << expected_time; + exit(1); } expected_time += 500ms; =} diff --git a/test/Cpp/src/SelfLoop.lf b/test/Cpp/src/SelfLoop.lf index 8d3188e937..0fd8fe4d6b 100644 --- a/test/Cpp/src/SelfLoop.lf +++ b/test/Cpp/src/SelfLoop.lf @@ -22,8 +22,8 @@ reactor Self { reaction(x) -> a {= reactor::log::Info() << "x = " << *x.get(); if(*x.get() != expected){ - reactor::log::Error() << "Expected " << expected; - exit(1); + reactor::log::Error() << "Expected " << expected; + exit(1); } expected++; a.schedule(x.get(), 100ms); @@ -33,8 +33,8 @@ reactor Self { reaction(shutdown) {= if(expected <= 43) { - reactor::log::Error() << "Received no data."; - exit(2); + reactor::log::Error() << "Received no data."; + exit(2); } =} } diff --git a/test/Cpp/src/SendingInside.lf b/test/Cpp/src/SendingInside.lf index 42d15f2f68..cd6aa38dd7 100644 --- a/test/Cpp/src/SendingInside.lf +++ b/test/Cpp/src/SendingInside.lf @@ -12,7 +12,7 @@ reactor Printer { reaction(x) {= std::cout << "Inside reactor received: " << *x.get() << std::endl; if (*x.get() != count) { - std::cerr << "FAILURE: Expected " << count << std::endl; + std::cerr << "FAILURE: Expected " << count << std::endl; exit(1); } count++; @@ -26,6 +26,6 @@ main reactor SendingInside { reaction(t) -> p.x {= count++; - p.x.set(count); + p.x.set(count); =} } diff --git a/test/Cpp/src/SendingInside2.lf b/test/Cpp/src/SendingInside2.lf index 29b6da59aa..d2b62982b2 100644 --- a/test/Cpp/src/SendingInside2.lf +++ b/test/Cpp/src/SendingInside2.lf @@ -6,8 +6,8 @@ reactor Printer { reaction(x) {= std::cout << "Inside reactor received: " << *x.get() << std::endl; if (*x.get() != 1) { - std::cerr << "ERROR: Expected 1." << std::endl; - exit(1); + std::cerr << "ERROR: Expected 1." << std::endl; + exit(1); } =} } diff --git a/test/Cpp/src/SimpleDeadline.lf b/test/Cpp/src/SimpleDeadline.lf index 57538f5e9f..91cfc197a7 100644 --- a/test/Cpp/src/SimpleDeadline.lf +++ b/test/Cpp/src/SimpleDeadline.lf @@ -23,8 +23,8 @@ reactor Print { reaction(in) {= if (*in.get()) { - std::cout << "Output successfully produced by deadline handler." - << std::endl; + std::cout << "Output successfully produced by deadline handler." + << std::endl; } =} } diff --git a/test/Cpp/src/SlowingClock.lf b/test/Cpp/src/SlowingClock.lf index 19d475ffe3..913768dada 100644 --- a/test/Cpp/src/SlowingClock.lf +++ b/test/Cpp/src/SlowingClock.lf @@ -23,8 +23,8 @@ main reactor SlowingClock { auto elapsed_logical_time = get_elapsed_logical_time(); reactor::log::Info() << "Logical time since start: " << elapsed_logical_time; if(elapsed_logical_time != expected_time) { - reactor::log::Error() << "Expected time to be: " << expected_time; - exit(1); + reactor::log::Error() << "Expected time to be: " << expected_time; + exit(1); } a.schedule(interval); expected_time += 100ms + interval; @@ -33,10 +33,10 @@ main reactor SlowingClock { reaction(shutdown) {= if(expected_time != 1500ms){ - reactor::log::Error() << "Expected the next expected time to be: 1500000000 nsec."; - reactor::log::Error() << "It was: " << expected_time; + reactor::log::Error() << "Expected the next expected time to be: 1500000000 nsec."; + reactor::log::Error() << "It was: " << expected_time; } else { - reactor::log::Info() << "Test passes."; + reactor::log::Info() << "Test passes."; } =} } diff --git a/test/Cpp/src/SlowingClockPhysical.lf b/test/Cpp/src/SlowingClockPhysical.lf index 2d5529f851..27e15bf7d1 100644 --- a/test/Cpp/src/SlowingClockPhysical.lf +++ b/test/Cpp/src/SlowingClockPhysical.lf @@ -26,8 +26,8 @@ main reactor SlowingClockPhysical { auto elapsed_logical_time{get_elapsed_logical_time()}; reactor::log::Info() << "Logical time since start: " << elapsed_logical_time; if(elapsed_logical_time < expected_time){ - reactor::log::Error() << "Expected logical time to be at least: " << expected_time; - exit(1); + reactor::log::Error() << "Expected logical time to be at least: " << expected_time; + exit(1); } interval += 100ms; expected_time = 100ms + interval; @@ -37,9 +37,9 @@ main reactor SlowingClockPhysical { reaction(shutdown) {= if(expected_time < 500ms){ - reactor::log::Error() << "Expected the next expected time to be at least: 500000000 nsec."; - reactor::log::Error() << "It was: " << expected_time; - exit(2); + reactor::log::Error() << "Expected the next expected time to be at least: 500000000 nsec."; + reactor::log::Error() << "It was: " << expected_time; + exit(2); } =} } diff --git a/test/Cpp/src/StartupOutFromInside.lf b/test/Cpp/src/StartupOutFromInside.lf index b8b43b78b9..0d3502c8c5 100644 --- a/test/Cpp/src/StartupOutFromInside.lf +++ b/test/Cpp/src/StartupOutFromInside.lf @@ -17,8 +17,8 @@ main reactor StartupOutFromInside { reaction(startup) bar.out {= reactor::log::Info() << "Output from bar: " << *bar.out.get(); if(*bar.out.get() != 42) { - reactor::log::Error() << "Expected 42!"; - exit(1); + reactor::log::Error() << "Expected 42!"; + exit(1); } =} } diff --git a/test/Cpp/src/Stride.lf b/test/Cpp/src/Stride.lf index be44540bb4..85b6c1ef0d 100644 --- a/test/Cpp/src/Stride.lf +++ b/test/Cpp/src/Stride.lf @@ -23,7 +23,7 @@ reactor Display { } main reactor Stride { - c = new Count(stride = 2) + c = new Count(stride=2) d = new Display() c.y -> d.x } diff --git a/test/Cpp/src/StructAsState.lf b/test/Cpp/src/StructAsState.lf index f8171a2ec6..342d72d16f 100644 --- a/test/Cpp/src/StructAsState.lf +++ b/test/Cpp/src/StructAsState.lf @@ -11,8 +11,8 @@ main reactor StructAsState { reaction(startup) {= std::cout << "State s.name=" << s.name << ", s.value=" << s.value << '\n'; if (s.value != 42 && s.name != "Earth") { - std::cerr << "ERROR: Expected 42 and Earth!\n"; - exit(1); + std::cerr << "ERROR: Expected 42 and Earth!\n"; + exit(1); } =} } diff --git a/test/Cpp/src/StructParallel.lf b/test/Cpp/src/StructParallel.lf index 375fa41bb2..8d45f3f014 100644 --- a/test/Cpp/src/StructParallel.lf +++ b/test/Cpp/src/StructParallel.lf @@ -13,9 +13,9 @@ public preamble {= main reactor { s = new Source() c1 = new Scale() - c2 = new Scale(scale = 3) - p1 = new Print(expected_value = 84) - p2 = new Print(expected_value = 126) + c2 = new Scale(scale=3) + p1 = new Print(expected_value=84) + p2 = new Print(expected_value=126) s.out -> c1.in s.out -> c2.in c1.out -> p1.in diff --git a/test/Cpp/src/StructPrint.lf b/test/Cpp/src/StructPrint.lf index e59ef45dda..807dba8e85 100644 --- a/test/Cpp/src/StructPrint.lf +++ b/test/Cpp/src/StructPrint.lf @@ -26,8 +26,8 @@ reactor Print(expected_value: int = 42, expected_name: {= std::string =} = "Eart auto& s = *in.get(); std::cout << "Received: name = " << s.name << ", value = " << s.value << '\n'; if (s.value != expected_value || s.name != expected_name) { - std::cerr << "ERROR: Expected name = " << expected_name << ", value = " << expected_value << '\n'; - exit(1); + std::cerr << "ERROR: Expected name = " << expected_name << ", value = " << expected_value << '\n'; + exit(1); } =} } diff --git a/test/Cpp/src/StructScale.lf b/test/Cpp/src/StructScale.lf index de3bef6579..71cdfaf058 100644 --- a/test/Cpp/src/StructScale.lf +++ b/test/Cpp/src/StructScale.lf @@ -23,7 +23,7 @@ reactor Scale(scale: int = 2) { main reactor StructScale { s = new Source() c = new Scale() - p = new Print(expected_value = 84) + p = new Print(expected_value=84) s.out -> c.in c.out -> p.in } diff --git a/test/Cpp/src/TestForPreviousOutput.lf b/test/Cpp/src/TestForPreviousOutput.lf index e181c4d791..6810574fa7 100644 --- a/test/Cpp/src/TestForPreviousOutput.lf +++ b/test/Cpp/src/TestForPreviousOutput.lf @@ -10,16 +10,16 @@ reactor Source { std::srand(std::time(nullptr)); // Randomly produce an output or not. if (std::rand() % 2) { - out.set(21); + out.set(21); } =} reaction(startup) -> out {= if (out.is_present()) { - int previous_output = *out.get(); - out.set(2 * previous_output); + int previous_output = *out.get(); + out.set(2 * previous_output); } else { - out.set(42); + out.set(42); } =} } @@ -30,8 +30,8 @@ reactor Sink { reaction(in) {= std::cout << "Received: " << *in.get() << '\n'; if (*in.get() != 42) { - std::cerr << "FAILED: Expected 42.\n"; - exit(1); + std::cerr << "FAILED: Expected 42.\n"; + exit(1); } =} } diff --git a/test/Cpp/src/TimeLimit.lf b/test/Cpp/src/TimeLimit.lf index a25ebdf07c..0249285e6b 100644 --- a/test/Cpp/src/TimeLimit.lf +++ b/test/Cpp/src/TimeLimit.lf @@ -23,8 +23,8 @@ reactor Destination { reaction(x) {= //std::cout << "Received " << *x.get() << '\n'; if (*x.get() != s) { - std::cerr << "Error: Expected " << s << " and got " << *x.get() << '\n'; - exit(1); + std::cerr << "Error: Expected " << s << " and got " << *x.get() << '\n'; + exit(1); } s++; =} @@ -32,15 +32,15 @@ reactor Destination { reaction(shutdown) {= std::cout << "**** shutdown reaction invoked.\n"; if (s != 12) { - std::cerr << "ERROR: Expected 12 but got " << s << '\n'; - exit(1); + std::cerr << "ERROR: Expected 12 but got " << s << '\n'; + exit(1); } =} } main reactor TimeLimit(period: time = 1 sec) { timer stop(10 sec) - c = new Clock(period = period) + c = new Clock(period=period) d = new Destination() c.y -> d.x diff --git a/test/Cpp/src/Timeout_Test.lf b/test/Cpp/src/Timeout_Test.lf index 95971d113a..aac8a04934 100644 --- a/test/Cpp/src/Timeout_Test.lf +++ b/test/Cpp/src/Timeout_Test.lf @@ -18,27 +18,27 @@ reactor Consumer { reaction(in) {= auto current{get_elapsed_logical_time()}; if(current > 11ms ){ - reactor::log::Error() << "Received at: " << current.count() << ". Failed to enforce timeout."; - exit(1); + reactor::log::Error() << "Received at: " << current.count() << ". Failed to enforce timeout."; + exit(1); } else if(current == 11ms) { - success=true; + success=true; } =} reaction(shutdown) {= reactor::log::Info() << "Shutdown invoked at " << get_elapsed_logical_time(); if((get_elapsed_logical_time() == 11ms ) && (success == true)){ - reactor::log::Info() << "SUCCESS: successfully enforced timeout."; + reactor::log::Info() << "SUCCESS: successfully enforced timeout."; } else { - reactor::log::Error() << "Shutdown invoked at: " << get_elapsed_logical_time() << ". Failed to enforce timeout."; - exit(1); + reactor::log::Error() << "Shutdown invoked at: " << get_elapsed_logical_time() << ". Failed to enforce timeout."; + exit(1); } =} } main reactor Timeout_Test { consumer = new Consumer() - producer = new Sender(take_a_break_after = 10, break_interval = 1 msec) + producer = new Sender(take_a_break_after=10, break_interval = 1 msec) producer.out -> consumer.in } diff --git a/test/Cpp/src/TimerIsPresent.lf b/test/Cpp/src/TimerIsPresent.lf index b87b22281e..9c7ffe77bd 100644 --- a/test/Cpp/src/TimerIsPresent.lf +++ b/test/Cpp/src/TimerIsPresent.lf @@ -8,47 +8,47 @@ main reactor { reaction(startup) t1, t2 {= if (!startup.is_present()) { - reactor::log::Error() << "Startup is not present."; - exit(1); + reactor::log::Error() << "Startup is not present."; + exit(1); } if (!t1.is_present()) { - reactor::log::Error() << "t1 is not present at startup."; - exit(1); + reactor::log::Error() << "t1 is not present at startup."; + exit(1); } if (t2.is_present()) { - reactor::log::Error() << "t2 is present at startup."; - exit(1); + reactor::log::Error() << "t2 is present at startup."; + exit(1); } =} reaction(t1, t2) {= if (t1.is_present() && t2.is_present()) { - reactor::log::Error() << "t1 and t2 are both present."; - exit(1); + reactor::log::Error() << "t1 and t2 are both present."; + exit(1); } if (!t1.is_present() && !t2.is_present()) { - reactor::log::Error() << "Neither t1 nor t2 are both present."; - exit(1); + reactor::log::Error() << "Neither t1 nor t2 are both present."; + exit(1); } =} reaction(shutdown) t1, t2 {= if (!shutdown.is_present()) { - reactor::log::Error() << "Shutdown is not present."; - exit(1); + reactor::log::Error() << "Shutdown is not present."; + exit(1); } if (!t1.is_present()) { - reactor::log::Error() << "t1 is not present at shutdown."; - exit(1); - } - - if (t2.is_present()) { - reactor::log::Error() << "t2 is present at shutdown"; - exit(1); - } + reactor::log::Error() << "t1 is not present at shutdown."; + exit(1); + } + + if (t2.is_present()) { + reactor::log::Error() << "t2 is present at shutdown"; + exit(1); + } =} } diff --git a/test/Cpp/src/ToReactionNested.lf b/test/Cpp/src/ToReactionNested.lf index 6a1997972a..c918e1cdd7 100644 --- a/test/Cpp/src/ToReactionNested.lf +++ b/test/Cpp/src/ToReactionNested.lf @@ -19,19 +19,19 @@ main reactor { reaction(s.out) {= if (s.out.is_present()){ - reactor::log::Info() << "Received " << *s.out.get(); - if(count != *s.out.get()){ - reactor::log::Error() << "Expected " << count; - } - received = true; + reactor::log::Info() << "Received " << *s.out.get(); + if(count != *s.out.get()){ + reactor::log::Error() << "Expected " << count; + } + received = true; } count++; =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "No inputs present."; - exit(1); + reactor::log::Error() << "No inputs present."; + exit(1); } =} } diff --git a/test/Cpp/src/TriggerDownstreamOnlyIfPresent2.lf b/test/Cpp/src/TriggerDownstreamOnlyIfPresent2.lf index 8bac112717..bc50b34711 100644 --- a/test/Cpp/src/TriggerDownstreamOnlyIfPresent2.lf +++ b/test/Cpp/src/TriggerDownstreamOnlyIfPresent2.lf @@ -17,9 +17,9 @@ reactor Source { reaction(t) -> out {= if(count++ % 2 == 0) { - out[0].set(count); + out[0].set(count); } else { - out[1].set(count); + out[1].set(count); } =} } @@ -29,8 +29,8 @@ reactor Destination { reaction(in) {= if(!in.is_present()){ - reactor::log::Error() << "Reaction to input of triggered even though all inputs are absent!"; - exit(1); + reactor::log::Error() << "Reaction to input of triggered even though all inputs are absent!"; + exit(1); } =} } diff --git a/test/Cpp/src/concurrent/AsyncCallback.lf b/test/Cpp/src/concurrent/AsyncCallback.lf index fff5b229e0..b9d655ca75 100644 --- a/test/Cpp/src/concurrent/AsyncCallback.lf +++ b/test/Cpp/src/concurrent/AsyncCallback.lf @@ -20,43 +20,43 @@ main reactor AsyncCallback { reaction(t) -> a {= // make sure to join the old thread first if(thread.joinable()) { - thread.join(); + thread.join(); } // start new thread this->thread = std::thread([&] () { - // Simulate time passing before a callback occurs - std::this_thread::sleep_for(100ms); - // Schedule twice. If the action is not physical, these should - // get consolidated into a single action triggering. If it is, - // then they cause two separate triggerings with close but not - // equal time stamps. - a.schedule(0); - a.schedule(0); + // Simulate time passing before a callback occurs + std::this_thread::sleep_for(100ms); + // Schedule twice. If the action is not physical, these should + // get consolidated into a single action triggering. If it is, + // then they cause two separate triggerings with close but not + // equal time stamps. + a.schedule(0); + a.schedule(0); }); =} reaction(a) {= auto elapsed_time = get_elapsed_logical_time(); std::cout << "Asynchronous callback " << i++ << ": Assigned logical " - << "time greater than start time by " << elapsed_time << std::endl; + << "time greater than start time by " << elapsed_time << std::endl; if (elapsed_time <= expected_time) { - std::cerr << "ERROR: Expected logical time to be larger than " - << expected_time << std::endl; - exit(1); + std::cerr << "ERROR: Expected logical time to be larger than " + << expected_time << std::endl; + exit(1); } if (toggle) { - toggle = false; - expected_time += 200ms; + toggle = false; + expected_time += 200ms; } else { - toggle = true; + toggle = true; } =} reaction(shutdown) {= // make sure to join the thread before shutting down if(thread.joinable()) { - thread.join(); + thread.join(); } =} } diff --git a/test/Cpp/src/concurrent/AsyncCallback2.lf b/test/Cpp/src/concurrent/AsyncCallback2.lf index d2f34ea4e6..905e9ad2e0 100644 --- a/test/Cpp/src/concurrent/AsyncCallback2.lf +++ b/test/Cpp/src/concurrent/AsyncCallback2.lf @@ -18,14 +18,14 @@ main reactor AsyncCallback2 { reaction(t) -> a {= // start new thread auto thread = std::thread([&] () { - // Simulate time passing before a callback occurs - std::this_thread::sleep_for(100ms); - // Schedule twice. If the action is not physical, these should - // get consolidated into a single action triggering. If it is, - // then they cause two separate triggerings with close but not - // equal time stamps. - a.schedule(0); - a.schedule(0); + // Simulate time passing before a callback occurs + std::this_thread::sleep_for(100ms); + // Schedule twice. If the action is not physical, these should + // get consolidated into a single action triggering. If it is, + // then they cause two separate triggerings with close but not + // equal time stamps. + a.schedule(0); + a.schedule(0); }); thread.join(); =} @@ -33,10 +33,10 @@ main reactor AsyncCallback2 { reaction(a) {= auto elapsed_time = get_elapsed_logical_time(); std::cout << "Asynchronous callback " << i++ << ": Assigned logical " - << "time greater than start time by " << elapsed_time << std::endl; + << "time greater than start time by " << elapsed_time << std::endl; if (elapsed_time != expected_time) { - std::cerr << "ERROR: Expected logical time to be " << expected_time << std::endl; - exit(1); + std::cerr << "ERROR: Expected logical time to be " << expected_time << std::endl; + exit(1); } expected_time += 200ms; =} diff --git a/test/Cpp/src/concurrent/CompositionThreaded.lf b/test/Cpp/src/concurrent/CompositionThreaded.lf index 01cb2b9b17..ba90950d21 100644 --- a/test/Cpp/src/concurrent/CompositionThreaded.lf +++ b/test/Cpp/src/concurrent/CompositionThreaded.lf @@ -24,15 +24,15 @@ reactor Test { auto value = *x.get(); std::cout << "Received " << value << std::endl; if (value != count) { - std::cerr << "FAILURE: Expected " << count << std::endl; - exit(1); + std::cerr << "FAILURE: Expected " << count << std::endl; + exit(1); } =} reaction(shutdown) {= if (count != 5) { - std::cerr << "ERROR: expected to receive 5 values but got " << count << '\n'; - exit(1); + std::cerr << "ERROR: expected to receive 5 values but got " << count << '\n'; + exit(1); } =} } diff --git a/test/Cpp/src/concurrent/DeadlineHandledAboveThreaded.lf b/test/Cpp/src/concurrent/DeadlineHandledAboveThreaded.lf index 548a5d477b..273621bcc7 100644 --- a/test/Cpp/src/concurrent/DeadlineHandledAboveThreaded.lf +++ b/test/Cpp/src/concurrent/DeadlineHandledAboveThreaded.lf @@ -26,17 +26,17 @@ main reactor { reaction(d.deadline_violation) {= if (*d.deadline_violation.get()) { - std::cout << "Output successfully produced by deadline miss handler." << std::endl; - violation_detected = true; + std::cout << "Output successfully produced by deadline miss handler." << std::endl; + violation_detected = true; } =} reaction(shutdown) {= if (violation_detected) { - std::cout << "SUCCESS. Test passes." << std::endl; + std::cout << "SUCCESS. Test passes." << std::endl; } else { - std::cerr << "ERROR. Container did not react to deadline violation." << std::endl; - exit(2); + std::cerr << "ERROR. Container did not react to deadline violation." << std::endl; + exit(2); } =} } diff --git a/test/Cpp/src/concurrent/DeadlineThreaded.lf b/test/Cpp/src/concurrent/DeadlineThreaded.lf index 3a202fd568..b55fcd76d4 100644 --- a/test/Cpp/src/concurrent/DeadlineThreaded.lf +++ b/test/Cpp/src/concurrent/DeadlineThreaded.lf @@ -14,9 +14,9 @@ reactor Source(period: time = 2 sec) { reaction(t) -> y {= if (count % 2 == 1) { - // The count variable is odd. - // Take time to cause a deadline violation. - std::this_thread::sleep_for(200ms); + // The count variable is odd. + // Take time to cause a deadline violation. + std::this_thread::sleep_for(200ms); } std::cout << "Source sends: " << count << std::endl; y.set(count); @@ -31,21 +31,21 @@ reactor Destination(timeout: time = 1 sec) { reaction(x) {= std::cout << "Destination receives: " << *x.get() << std::endl; if (count % 2 == 1) { - // The count variable is odd, so the deadline should have been - // violated - std::cerr << "ERROR: Failed to detect deadline." << std::endl; - exit(1); + // The count variable is odd, so the deadline should have been + // violated + std::cerr << "ERROR: Failed to detect deadline." << std::endl; + exit(1); } count++; =} deadline(timeout) {= std::cout << "Destination deadline handler receives: " - << *x.get() << std::endl; + << *x.get() << std::endl; if (count % 2 == 0) { - // The count variable is even, so the deadline should not have - // been violated. - std::cerr << "ERROR: Deadline handler invoked without deadline " - << "violation." << std::endl; - exit(2); + // The count variable is even, so the deadline should not have + // been violated. + std::cerr << "ERROR: Deadline handler invoked without deadline " + << "violation." << std::endl; + exit(2); } count++; =} diff --git a/test/Cpp/src/concurrent/DelayIntThreaded.lf b/test/Cpp/src/concurrent/DelayIntThreaded.lf index dc3c2746ee..33db1411de 100644 --- a/test/Cpp/src/concurrent/DelayIntThreaded.lf +++ b/test/Cpp/src/concurrent/DelayIntThreaded.lf @@ -10,7 +10,7 @@ reactor Delay(delay: time = 100 msec) { reaction(d) -> out {= if (d.is_present()) { - out.set(d.get()); + out.set(d.get()); } =} } @@ -32,14 +32,14 @@ reactor Test { auto elapsed = current_time - start_time; std::cout << "After " << elapsed << " of logical time." << std::endl; if (elapsed != 100ms) { - std::cerr << "ERROR: Expected elapsed time to be 100000000 nsecs. " - << "It was " << elapsed << std::endl; - exit(1); + std::cerr << "ERROR: Expected elapsed time to be 100000000 nsecs. " + << "It was " << elapsed << std::endl; + exit(1); } if (*in.get() != 42) { - std::cerr << "ERROR: Expected input value to be 42. " - << "It was " << *in.get() << std::endl; - exit(2); + std::cerr << "ERROR: Expected input value to be 42. " + << "It was " << *in.get() << std::endl; + exit(2); } =} } diff --git a/test/Cpp/src/concurrent/DeterminismThreaded.lf b/test/Cpp/src/concurrent/DeterminismThreaded.lf index b97d9fd1fe..c0de1858c1 100644 --- a/test/Cpp/src/concurrent/DeterminismThreaded.lf +++ b/test/Cpp/src/concurrent/DeterminismThreaded.lf @@ -14,15 +14,15 @@ reactor Destination { reaction(x, y) {= int sum = 0; if (x.is_present()) { - sum += *x.get(); + sum += *x.get(); } if (y.is_present()) { - sum += *y.get(); + sum += *y.get(); } std::cout << "Received " << sum << std::endl; if (sum != 2) { - std::cerr << "FAILURE: Expected 2." << std::endl; - exit(4); + std::cerr << "FAILURE: Expected 2." << std::endl; + exit(4); } =} } diff --git a/test/Cpp/src/concurrent/DoubleReactionThreaded.lf b/test/Cpp/src/concurrent/DoubleReactionThreaded.lf index 489782ed94..69dd20f049 100644 --- a/test/Cpp/src/concurrent/DoubleReactionThreaded.lf +++ b/test/Cpp/src/concurrent/DoubleReactionThreaded.lf @@ -24,16 +24,16 @@ reactor Destination { reaction(x, w) {= int sum = 0; if (x.is_present()) { - sum += *x.get(); + sum += *x.get(); } if (w.is_present()) { - sum += *w.get(); + sum += *w.get(); } std::cout << "Sum of inputs is: " << sum << std::endl; if (sum != s) { - std::cerr << "FAILURE: Expected sum to be " << s - << "but it was " << sum << std::endl; - exit(1); + std::cerr << "FAILURE: Expected sum to be " << s + << "but it was " << sum << std::endl; + exit(1); } s += 2; =} diff --git a/test/Cpp/src/concurrent/GainThreaded.lf b/test/Cpp/src/concurrent/GainThreaded.lf index ca1a7cc676..112f97632b 100644 --- a/test/Cpp/src/concurrent/GainThreaded.lf +++ b/test/Cpp/src/concurrent/GainThreaded.lf @@ -15,8 +15,8 @@ reactor Test { auto value = *x.get(); std::cout << "Received " << value << std::endl; if (value != 2) { - std::cerr << "Expected 2!" << std::endl; - exit(1); + std::cerr << "Expected 2!" << std::endl; + exit(1); } =} } diff --git a/test/Cpp/src/concurrent/HelloThreaded.lf b/test/Cpp/src/concurrent/HelloThreaded.lf index 790aadf913..35e2261048 100644 --- a/test/Cpp/src/concurrent/HelloThreaded.lf +++ b/test/Cpp/src/concurrent/HelloThreaded.lf @@ -25,18 +25,18 @@ reactor HelloCpp(period: time = 2 sec, message: {= std::string =} = "Hello C++") count++; auto time = get_logical_time(); std::cout << "***** action " << count << " at time " - << time << std::endl; + << time << std::endl; auto diff = time - previous_time; if (diff != 200ms) { - std::cerr << "FAILURE: Expected 200 msecs of logical time to elapse " - << "but got " << diff << std::endl; - exit(1); + std::cerr << "FAILURE: Expected 200 msecs of logical time to elapse " + << "but got " << diff << std::endl; + exit(1); } =} } reactor Inside(period: time = 1 sec, message: {= std::string =} = "Composite default message.") { - third_instance = new HelloCpp(period = period, message = message) + third_instance = new HelloCpp(period=period, message=message) } main reactor { diff --git a/test/Cpp/src/concurrent/SendingInsideThreaded.lf b/test/Cpp/src/concurrent/SendingInsideThreaded.lf index f4b4dd2560..7854d42a22 100644 --- a/test/Cpp/src/concurrent/SendingInsideThreaded.lf +++ b/test/Cpp/src/concurrent/SendingInsideThreaded.lf @@ -12,8 +12,8 @@ reactor Printer { reaction(x) {= std::cout << "Inside reactor received: " << *x.get() << std::endl; if (*x.get() != count) { - std::cerr << "FAILURE: Expected " << count << std::endl; - exit(1); + std::cerr << "FAILURE: Expected " << count << std::endl; + exit(1); } count++; =} diff --git a/test/Cpp/src/concurrent/Threaded.lf b/test/Cpp/src/concurrent/Threaded.lf index 382c3bfa7c..26a8a9e2cd 100644 --- a/test/Cpp/src/concurrent/Threaded.lf +++ b/test/Cpp/src/concurrent/Threaded.lf @@ -43,8 +43,8 @@ reactor Destination { int sum = *in1.get() + *in2.get() + *in3.get() + *in4.get(); std::cout << "Sum of received: " << sum << '\n'; if (sum != s) { - std::cerr << "ERROR: Expected " << s << '\n'; - exit(1); + std::cerr << "ERROR: Expected " << s << '\n'; + exit(1); } s += 4; =} diff --git a/test/Cpp/src/concurrent/ThreadedThreaded.lf b/test/Cpp/src/concurrent/ThreadedThreaded.lf index 8e51ef0ccb..5f5a3a7e71 100644 --- a/test/Cpp/src/concurrent/ThreadedThreaded.lf +++ b/test/Cpp/src/concurrent/ThreadedThreaded.lf @@ -39,12 +39,12 @@ reactor Destination { reaction(in) {= int sum = 0; for (std::size_t i = 0; i < in.size(); i++) { - if (in[i].is_present()) sum += *in[i].get(); + if (in[i].is_present()) sum += *in[i].get(); } std::cout << "Sum of received: " << sum << '\n'; if (sum != s) { - std::cerr << "ERROR: Expected " << s << '\n'; - exit(1); + std::cerr << "ERROR: Expected " << s << '\n'; + exit(1); } s += 4; =} diff --git a/test/Cpp/src/concurrent/TimeLimitThreaded.lf b/test/Cpp/src/concurrent/TimeLimitThreaded.lf index 195ccef79f..ecff6ecfc9 100644 --- a/test/Cpp/src/concurrent/TimeLimitThreaded.lf +++ b/test/Cpp/src/concurrent/TimeLimitThreaded.lf @@ -24,8 +24,8 @@ reactor Destination { reaction(x) {= //std::cout << "Received " << *x.get() << '\n'; if (*x.get() != s) { - std::cerr << "Error: Expected " << s << " and got " << *x.get() << '\n'; - exit(1); + std::cerr << "Error: Expected " << s << " and got " << *x.get() << '\n'; + exit(1); } s++; =} @@ -33,15 +33,15 @@ reactor Destination { reaction(shutdown) {= std::cout << "**** shutdown reaction invoked.\n"; if (s != 12) { - std::cerr << "ERROR: Expected 12 but got " << s << '\n'; - exit(1); + std::cerr << "ERROR: Expected 12 but got " << s << '\n'; + exit(1); } =} } main reactor(period: time = 1 sec) { timer stop(10 sec) - c = new Clock(period = period) + c = new Clock(period=period) d = new Destination() c.y -> d.x diff --git a/test/Cpp/src/concurrent/Workers.lf b/test/Cpp/src/concurrent/Workers.lf index 43b7d8a114..c896b10604 100644 --- a/test/Cpp/src/concurrent/Workers.lf +++ b/test/Cpp/src/concurrent/Workers.lf @@ -5,10 +5,10 @@ target Cpp { main reactor { reaction(startup) {= if (environment()->num_workers() != 16) { - std::cout << "Expected to have 16 workers.\n"; - exit(1); + std::cout << "Expected to have 16 workers.\n"; + exit(1); } else { - std::cout << "Using 16 workers.\n"; + std::cout << "Using 16 workers.\n"; } =} } diff --git a/test/Cpp/src/enclave/EnclaveBank.lf b/test/Cpp/src/enclave/EnclaveBank.lf index 64d1cba5a2..95cfb876a3 100644 --- a/test/Cpp/src/enclave/EnclaveBank.lf +++ b/test/Cpp/src/enclave/EnclaveBank.lf @@ -4,11 +4,10 @@ target Cpp { } reactor Node( - bank_index: size_t = 0, - id: std::string = {= "node" + std::to_string(bank_index) =}, - period: time = 500 msec, - duration: time = 10 msec -) { + bank_index: size_t = 0, + id: std::string = {= "node" + std::to_string(bank_index) =}, + period: time = 500 msec, + duration: time = 10 msec) { logical action a: void reaction(startup, a) -> a {= @@ -23,7 +22,7 @@ reactor Node( } main reactor { - slow = new Node(id = "slow", period = 1 sec, duration = 500 msec) + slow = new Node(id="slow", period = 1 sec, duration = 500 msec) @enclave nodes = new[2] Node() } diff --git a/test/Cpp/src/enclave/EnclaveBankEach.lf b/test/Cpp/src/enclave/EnclaveBankEach.lf index e4c497f422..d1b94748ba 100644 --- a/test/Cpp/src/enclave/EnclaveBankEach.lf +++ b/test/Cpp/src/enclave/EnclaveBankEach.lf @@ -4,11 +4,10 @@ target Cpp { } reactor Node( - bank_index: size_t = 0, - id: std::string = {= "node" + std::to_string(bank_index) =}, - period: {= reactor::Duration =} = {= 100ms * (bank_index+1) =}, - duration: {= reactor::Duration =} = {= 50ms + 100ms * bank_index =} -) { + bank_index: size_t = 0, + id: std::string = {= "node" + std::to_string(bank_index) =}, + period: {= reactor::Duration =} = {= 100ms * (bank_index+1) =}, + duration: {= reactor::Duration =} = {= 50ms + 100ms * bank_index =}) { logical action a: void reaction(startup, a) -> a {= @@ -23,7 +22,7 @@ reactor Node( } main reactor { - slow = new Node(id = "slow", period = {= 1s =}, duration = {= 700ms =}) + slow = new Node(id="slow", period = {= 1s =}, duration = {= 700ms =}) @enclave(each = true) nodes = new[2] Node() } diff --git a/test/Cpp/src/enclave/EnclaveBroadcast.lf b/test/Cpp/src/enclave/EnclaveBroadcast.lf index cc4a110f13..a54452b2ea 100644 --- a/test/Cpp/src/enclave/EnclaveBroadcast.lf +++ b/test/Cpp/src/enclave/EnclaveBroadcast.lf @@ -17,15 +17,15 @@ reactor Sink(bank_index: size_t = 0) { received = true; std::cout << "Received " << *in.get() << '\n'; if (*in.get() != 42) { - std::cerr << "Error: expected " << 42 << "!\n"; - exit(1); + std::cerr << "Error: expected " << 42 << "!\n"; + exit(1); } =} reaction(shutdown) {= if (!received) { - std::cerr << "Error: Sink " << bank_index << " didn't receive anything.\n"; - exit(2); + std::cerr << "Error: Sink " << bank_index << " didn't receive anything.\n"; + exit(2); } =} } diff --git a/test/Cpp/src/enclave/EnclaveCommunication.lf b/test/Cpp/src/enclave/EnclaveCommunication.lf index 17c8ee9242..9bf2af20cc 100644 --- a/test/Cpp/src/enclave/EnclaveCommunication.lf +++ b/test/Cpp/src/enclave/EnclaveCommunication.lf @@ -21,15 +21,15 @@ reactor Sink { reactor::log::Info() << "Received " << value; auto expected = 100ms * value; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} } diff --git a/test/Cpp/src/enclave/EnclaveCommunication2.lf b/test/Cpp/src/enclave/EnclaveCommunication2.lf index 9451f455e2..bb60949645 100644 --- a/test/Cpp/src/enclave/EnclaveCommunication2.lf +++ b/test/Cpp/src/enclave/EnclaveCommunication2.lf @@ -21,15 +21,15 @@ reactor Sink { reactor::log::Info() << "Received " << value; auto expected = 100ms * value; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} } diff --git a/test/Cpp/src/enclave/EnclaveCommunicationDelayed.lf b/test/Cpp/src/enclave/EnclaveCommunicationDelayed.lf index 36afcecd34..9adad03ebb 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationDelayed.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationDelayed.lf @@ -21,15 +21,15 @@ reactor Sink { reactor::log::Info() << "Received " << value; auto expected = 100ms * value + 50ms; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} } diff --git a/test/Cpp/src/enclave/EnclaveCommunicationDelayed2.lf b/test/Cpp/src/enclave/EnclaveCommunicationDelayed2.lf index 5c51a84850..6272a7aa00 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationDelayed2.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationDelayed2.lf @@ -21,15 +21,15 @@ reactor Sink { reactor::log::Info() << "Received " << value; auto expected = 100ms * value + 50ms; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} } diff --git a/test/Cpp/src/enclave/EnclaveCommunicationDelayedLocalEvents.lf b/test/Cpp/src/enclave/EnclaveCommunicationDelayedLocalEvents.lf index 5c2ea549ea..31939cf447 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationDelayedLocalEvents.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationDelayedLocalEvents.lf @@ -22,15 +22,15 @@ reactor Sink { reactor::log::Info() << "Received " << value; auto expected = 100ms * value + 50ms; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} diff --git a/test/Cpp/src/enclave/EnclaveCommunicationLocalEvents.lf b/test/Cpp/src/enclave/EnclaveCommunicationLocalEvents.lf index a8a93dabbe..342a6e7eaf 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationLocalEvents.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationLocalEvents.lf @@ -22,15 +22,15 @@ reactor Sink { reactor::log::Info() << "Received " << value; auto expected = 100ms * value; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} diff --git a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBank.lf b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBank.lf index a853b023a3..e315632425 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBank.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBank.lf @@ -10,7 +10,7 @@ reactor Src { reaction(t) -> out {= for (auto& port : out) { - port.set(counter++); + port.set(counter++); } =} } @@ -27,20 +27,20 @@ reactor Sink(bank_index: std::size_t = 0) { reactor::log::Info() << "Received " << value << " at " << get_elapsed_logical_time(); auto expected = 100ms * iteration; if (value != iteration*4 + bank_index) { - reactor::log::Error() << "Expected to recive " << iteration*4 + bank_index; - exit(1); + reactor::log::Error() << "Expected to recive " << iteration*4 + bank_index; + exit(1); } iteration++; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expected value at " << expected; - exit(1); + reactor::log::Error() << "Expected value at " << expected; + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} diff --git a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankDelayed.lf b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankDelayed.lf index 3b716ddbb7..4eda00fd38 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankDelayed.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankDelayed.lf @@ -10,7 +10,7 @@ reactor Src { reaction(t) -> out {= for (auto& port : out) { - port.set(counter++); + port.set(counter++); } =} } @@ -27,20 +27,20 @@ reactor Sink(bank_index: std::size_t = 0) { reactor::log::Info() << "Received " << value << " at " << get_elapsed_logical_time(); auto expected = 100ms * iteration + 50ms; if (value != iteration*4 + bank_index) { - reactor::log::Error() << "Expected to recive " << iteration*4 + bank_index; - exit(1); + reactor::log::Error() << "Expected to recive " << iteration*4 + bank_index; + exit(1); } iteration++; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expected value at " << expected; - exit(1); + reactor::log::Error() << "Expected value at " << expected; + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} diff --git a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEach.lf b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEach.lf index bf1dcc9a6d..1016beffce 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEach.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEach.lf @@ -10,7 +10,7 @@ reactor Src { reaction(t) -> out {= for (auto& port : out) { - port.set(counter++); + port.set(counter++); } =} } @@ -27,20 +27,20 @@ reactor Sink(bank_index: std::size_t = 0) { reactor::log::Info() << "Received " << value << " at " << get_elapsed_logical_time(); auto expected = 100ms * iteration; if (value != iteration*4 + bank_index) { - reactor::log::Error() << "Expected to recive " << iteration*4 + bank_index; - exit(1); + reactor::log::Error() << "Expected to recive " << iteration*4 + bank_index; + exit(1); } iteration++; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expected value at " << expected; - exit(1); + reactor::log::Error() << "Expected value at " << expected; + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} diff --git a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachDelayed.lf b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachDelayed.lf index 0da4f978d7..97ad53108a 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachDelayed.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachDelayed.lf @@ -10,7 +10,7 @@ reactor Src { reaction(t) -> out {= for (auto& port : out) { - port.set(counter++); + port.set(counter++); } =} } @@ -27,20 +27,20 @@ reactor Sink(bank_index: std::size_t = 0) { reactor::log::Info() << "Received " << value << " at " << get_elapsed_logical_time(); auto expected = 100ms * iteration + 50ms; if (value != iteration*4 + bank_index) { - reactor::log::Error() << "Expected to recive " << iteration*4 + bank_index; - exit(1); + reactor::log::Error() << "Expected to recive " << iteration*4 + bank_index; + exit(1); } iteration++; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expected value at " << expected; - exit(1); + reactor::log::Error() << "Expected value at " << expected; + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} diff --git a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachPhysical.lf b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachPhysical.lf index 87d498d3c8..e7b9ab3288 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachPhysical.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachPhysical.lf @@ -10,7 +10,7 @@ reactor Src { reaction(t) -> out {= for (auto& port : out) { - port.set(counter++); + port.set(counter++); } =} } @@ -27,20 +27,20 @@ reactor Sink(bank_index: std::size_t = 0) { reactor::log::Info() << "Received " << value << " at " << get_elapsed_logical_time(); auto expected = 100ms * iteration; if (value != iteration*4 + bank_index) { - reactor::log::Error() << "Expected to recive " << iteration*4 + bank_index; - exit(1); + reactor::log::Error() << "Expected to recive " << iteration*4 + bank_index; + exit(1); } iteration++; if (get_elapsed_logical_time() < expected) { - reactor::log::Error() << "Expected value not before " << expected; - exit(1); + reactor::log::Error() << "Expected value not before " << expected; + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} diff --git a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankPhysical.lf b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankPhysical.lf index 84b933d475..ece73aab30 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankPhysical.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankPhysical.lf @@ -10,7 +10,7 @@ reactor Src { reaction(t) -> out {= for (auto& port : out) { - port.set(counter++); + port.set(counter++); } =} } @@ -27,20 +27,20 @@ reactor Sink(bank_index: std::size_t = 0) { reactor::log::Info() << "Received " << value << " at " << get_elapsed_logical_time(); auto expected = 100ms * iteration; if (value != iteration*4 + bank_index) { - reactor::log::Error() << "Expected to recive " << iteration*4 + bank_index; - exit(1); + reactor::log::Error() << "Expected to recive " << iteration*4 + bank_index; + exit(1); } iteration++; if (get_elapsed_logical_time() < expected) { - reactor::log::Error() << "Expected value not before " << expected; - exit(1); + reactor::log::Error() << "Expected value not before " << expected; + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} diff --git a/test/Cpp/src/enclave/EnclaveCommunicationPhysical.lf b/test/Cpp/src/enclave/EnclaveCommunicationPhysical.lf index 19e49b0642..65a2b44825 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationPhysical.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationPhysical.lf @@ -21,15 +21,15 @@ reactor Sink { reactor::log::Info() << "Received " << value << " at " << get_elapsed_logical_time(); auto expected = 100ms * value; if (get_elapsed_logical_time() < expected) { - reactor::log::Error() << "Expecded value not before " << expected; - exit(1); + reactor::log::Error() << "Expecded value not before " << expected; + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} } diff --git a/test/Cpp/src/enclave/EnclaveCommunicationPhysicalLocalEvents.lf b/test/Cpp/src/enclave/EnclaveCommunicationPhysicalLocalEvents.lf index e4467680db..c413345f16 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationPhysicalLocalEvents.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationPhysicalLocalEvents.lf @@ -22,15 +22,15 @@ reactor Sink { reactor::log::Info() << "Received " << value << " at " << get_elapsed_logical_time(); auto expected = 100ms * value; if (get_elapsed_logical_time() < expected) { - reactor::log::Error() << "Expecded value not before " << expected; - exit(1); + reactor::log::Error() << "Expecded value not before " << expected; + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} diff --git a/test/Cpp/src/enclave/EnclaveCycle.lf b/test/Cpp/src/enclave/EnclaveCycle.lf index 5643ba824c..15d68b99cc 100644 --- a/test/Cpp/src/enclave/EnclaveCycle.lf +++ b/test/Cpp/src/enclave/EnclaveCycle.lf @@ -18,15 +18,15 @@ reactor Ping { reactor::log::Info() << "Ping Received " << value; auto expected = 50ms + 100ms * value; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} } @@ -42,16 +42,16 @@ reactor Pong { reactor::log::Info() << "Pong Received " << value; auto expected = 100ms * value; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } out.set(value); =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} } diff --git a/test/Cpp/src/enclave/EnclaveCycleTwoTimers.lf b/test/Cpp/src/enclave/EnclaveCycleTwoTimers.lf index 5a0310573d..8c4ce316a3 100644 --- a/test/Cpp/src/enclave/EnclaveCycleTwoTimers.lf +++ b/test/Cpp/src/enclave/EnclaveCycleTwoTimers.lf @@ -18,15 +18,15 @@ reactor Ping { reactor::log::Info() << "Ping Received " << value; auto expected = 50ms + 100ms * value; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} } @@ -46,15 +46,15 @@ reactor Pong { reactor::log::Info() << "Pong Received " << value; auto expected = 50ms + 100ms * value; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expecded value at " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} } diff --git a/test/Cpp/src/enclave/EnclaveHelloWorld.lf b/test/Cpp/src/enclave/EnclaveHelloWorld.lf index 7947dd0bf4..21b7374a09 100644 --- a/test/Cpp/src/enclave/EnclaveHelloWorld.lf +++ b/test/Cpp/src/enclave/EnclaveHelloWorld.lf @@ -5,8 +5,8 @@ reactor Hello(msg: std::string = "World") { } main reactor(msg1: std::string = "World", msg2: std::string = "Enclave") { - hello1 = new Hello(msg = msg1) + hello1 = new Hello(msg=msg1) @enclave - hello2 = new Hello(msg = msg2) + hello2 = new Hello(msg=msg2) } diff --git a/test/Cpp/src/enclave/EnclaveHierarchy.lf b/test/Cpp/src/enclave/EnclaveHierarchy.lf index 3fd3b6d528..1f745443a0 100644 --- a/test/Cpp/src/enclave/EnclaveHierarchy.lf +++ b/test/Cpp/src/enclave/EnclaveHierarchy.lf @@ -18,20 +18,20 @@ reactor Node(id: std::string = "node", period: time = 100 msec, duration: time = reactor MiddleNode { @enclave - inner = new Node(id = "inner", period = 1 sec, duration = 400 msec) + inner = new Node(id="inner", period = 1 sec, duration = 400 msec) - middle = new Node(id = "middle", period = 200 msec, duration = 70 msec) + middle = new Node(id="middle", period = 200 msec, duration = 70 msec) } reactor OuterNode { @enclave middle = new MiddleNode() - outer = new Node(id = "outer", period = 500 msec, duration = 200 msec) + outer = new Node(id="outer", period = 500 msec, duration = 200 msec) } main reactor { outer = new OuterNode() @enclave - node = new Node(id = "node", period = 2 sec, duration = 500 msec) + node = new Node(id="node", period = 2 sec, duration = 500 msec) } diff --git a/test/Cpp/src/enclave/EnclaveMultiportToPort.lf b/test/Cpp/src/enclave/EnclaveMultiportToPort.lf index e5eb8dac90..f20ad09633 100644 --- a/test/Cpp/src/enclave/EnclaveMultiportToPort.lf +++ b/test/Cpp/src/enclave/EnclaveMultiportToPort.lf @@ -9,8 +9,8 @@ reactor Source { reaction(startup) -> out {= for(int i = 0; i < out.size(); i++) { - std::cout << "Source sending " << i << ".\n"; - out[i].set(i); + std::cout << "Source sending " << i << ".\n"; + out[i].set(i); } =} } @@ -23,15 +23,15 @@ reactor Destination(expected: int = 0) { std::cout << "Received: " << *in.get() << ".\n"; received = true; if (*in.get() != expected) { - std::cerr << "ERROR: Expected " << expected << ".\n"; - exit(1); + std::cerr << "ERROR: Expected " << expected << ".\n"; + exit(1); } =} reaction(shutdown) {= if (!received) { - std::cerr << "ERROR: Destination received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} @@ -43,6 +43,6 @@ main reactor { @enclave b1 = new Destination() @enclave - b2 = new Destination(expected = 1) + b2 = new Destination(expected=1) a.out -> b1.in, b2.in } diff --git a/test/Cpp/src/enclave/EnclaveMultiportToPort2.lf b/test/Cpp/src/enclave/EnclaveMultiportToPort2.lf index 7f3c5ff938..7e40a09623 100644 --- a/test/Cpp/src/enclave/EnclaveMultiportToPort2.lf +++ b/test/Cpp/src/enclave/EnclaveMultiportToPort2.lf @@ -9,8 +9,8 @@ reactor Source { reaction(startup) -> out {= for(int i = 0; i < out.size(); i++) { - std::cout << "Source sending " << i << ".\n"; - out[i].set(i); + std::cout << "Source sending " << i << ".\n"; + out[i].set(i); } =} } @@ -23,15 +23,15 @@ reactor Destination(expected: int = 0) { std::cout << "Received: " << *in.get() << ".\n"; received = true; if (*in.get() != expected) { - std::cerr << "ERROR: Expected " << expected << ".\n"; - exit(1); + std::cerr << "ERROR: Expected " << expected << ".\n"; + exit(1); } =} reaction(shutdown) {= if (!received) { - std::cerr << "ERROR: Destination received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} @@ -42,6 +42,6 @@ main reactor { a = new Source() @enclave b1 = new Destination() - b2 = new Destination(expected = 1) + b2 = new Destination(expected=1) a.out -> b1.in, b2.in } diff --git a/test/Cpp/src/enclave/EnclaveShutdown.lf b/test/Cpp/src/enclave/EnclaveShutdown.lf index c0c0aa1c64..ab56d58b08 100644 --- a/test/Cpp/src/enclave/EnclaveShutdown.lf +++ b/test/Cpp/src/enclave/EnclaveShutdown.lf @@ -12,8 +12,8 @@ reactor Node(message: std::string = "Hello", period: time = 1 sec, stop: time = reactor::log::Info() << "Goodbye!"; if (get_elapsed_logical_time() != stop || get_microstep() != 1) { - reactor::log::Error() << "Expected to shut down at [" << stop << ", 1]"; - exit(1); + reactor::log::Error() << "Expected to shut down at [" << stop << ", 1]"; + exit(1); } =} } @@ -26,8 +26,8 @@ main reactor { reaction(shutdown) {= if (get_elapsed_logical_time() != 0s || get_microstep() != 1) { - reactor::log::Error() << "Expected to shut down at [0, 1]e"; - exit(1); + reactor::log::Error() << "Expected to shut down at [0, 1]e"; + exit(1); } =} } diff --git a/test/Cpp/src/enclave/EnclaveSparseUpstreamEvents.lf b/test/Cpp/src/enclave/EnclaveSparseUpstreamEvents.lf index 6f713a7d88..047910fd91 100644 --- a/test/Cpp/src/enclave/EnclaveSparseUpstreamEvents.lf +++ b/test/Cpp/src/enclave/EnclaveSparseUpstreamEvents.lf @@ -24,15 +24,15 @@ reactor Sink { reactor::log::Info() << "Received " << value; auto expected = 4s * value; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expected value at " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expected value at " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} diff --git a/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsDelayed.lf b/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsDelayed.lf index dd2e0d04d7..486655ddd6 100644 --- a/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsDelayed.lf +++ b/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsDelayed.lf @@ -24,15 +24,15 @@ reactor Sink { reactor::log::Info() << "Received " << value; auto expected = 2s + 4s * value; if (get_elapsed_logical_time() != expected) { - reactor::log::Error() << "Expected value at " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expected value at " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} diff --git a/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsPhysical.lf b/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsPhysical.lf index 895e50d6c8..d2f0a78e3f 100644 --- a/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsPhysical.lf +++ b/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsPhysical.lf @@ -24,15 +24,15 @@ reactor Sink { reactor::log::Info() << "Received " << value; auto expected = 4s * value; if (get_elapsed_logical_time() < expected) { - reactor::log::Error() << "Expected value not before " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expected value not before " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} diff --git a/test/Cpp/src/enclave/EnclaveTimeout.lf b/test/Cpp/src/enclave/EnclaveTimeout.lf index 1e9614baa5..b05e6b7b1e 100644 --- a/test/Cpp/src/enclave/EnclaveTimeout.lf +++ b/test/Cpp/src/enclave/EnclaveTimeout.lf @@ -11,8 +11,8 @@ reactor Node(message: std::string = "Hello", period: time = 1 sec) { reactor::log::Info() << "Goodbye!"; if (get_elapsed_logical_time() != 1s || get_microstep() != 0) { - reactor::log::Error() << "Expected to shut down at [1s, 0]"; - exit(1); + reactor::log::Error() << "Expected to shut down at [1s, 0]"; + exit(1); } =} } @@ -25,8 +25,8 @@ main reactor { reaction(shutdown) {= if (get_elapsed_logical_time() != 1s || get_microstep() != 0) { - reactor::log::Error() << "Expected to shut down at [1s, 0]e"; - exit(1); + reactor::log::Error() << "Expected to shut down at [1s, 0]e"; + exit(1); } =} } diff --git a/test/Cpp/src/enclave/EnclaveUpstreamPhysicalAction.lf b/test/Cpp/src/enclave/EnclaveUpstreamPhysicalAction.lf index a82755181f..16d0d55586 100644 --- a/test/Cpp/src/enclave/EnclaveUpstreamPhysicalAction.lf +++ b/test/Cpp/src/enclave/EnclaveUpstreamPhysicalAction.lf @@ -18,10 +18,10 @@ reactor Src { reaction(startup) -> a {= // start new thread this->thread = std::thread([&] () { - for (int i{0}; i < 3; i++) { - a.schedule(i); - std::this_thread::sleep_for(2s); - } + for (int i{0}; i < 3; i++) { + a.schedule(i); + std::this_thread::sleep_for(2s); + } }); =} @@ -30,7 +30,7 @@ reactor Src { reaction(shutdown) {= // make sure to join the thread before shutting down if(thread.joinable()) { - thread.join(); + thread.join(); } =} } @@ -46,21 +46,21 @@ reactor Sink { reactor::log::Info() << "Received " << value; auto expected = 2s * value; if (get_elapsed_logical_time() < expected) { - reactor::log::Error() << "Expected value not before " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expected value not before " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} reaction(t) {= reactor::log::Info() << "Tick - " << "logical time: " << get_elapsed_logical_time() - << "; physical time: " << get_elapsed_physical_time(); + << "; physical time: " << get_elapsed_physical_time(); =} deadline(1 s) {= reactor::log::Error() << "Deadline violated."; exit(2); diff --git a/test/Cpp/src/enclave/EnclaveUpstreamPhysicalActionDelayed.lf b/test/Cpp/src/enclave/EnclaveUpstreamPhysicalActionDelayed.lf index afc391bca2..4e7b138c90 100644 --- a/test/Cpp/src/enclave/EnclaveUpstreamPhysicalActionDelayed.lf +++ b/test/Cpp/src/enclave/EnclaveUpstreamPhysicalActionDelayed.lf @@ -18,10 +18,10 @@ reactor Src { reaction(startup) -> a {= // start new thread this->thread = std::thread([&] () { - for (int i{0}; i < 3; i++) { - a.schedule(i); - std::this_thread::sleep_for(2s); - } + for (int i{0}; i < 3; i++) { + a.schedule(i); + std::this_thread::sleep_for(2s); + } }); =} @@ -30,7 +30,7 @@ reactor Src { reaction(shutdown) {= // make sure to join the thread before shutting down if(thread.joinable()) { - thread.join(); + thread.join(); } =} } @@ -46,21 +46,21 @@ reactor Sink { reactor::log::Info() << "Received " << value; auto expected = 2s * value; if (get_elapsed_logical_time() < expected) { - reactor::log::Error() << "Expected value not before " << expected << " but received it at " << get_elapsed_logical_time(); - exit(1); + reactor::log::Error() << "Expected value not before " << expected << " but received it at " << get_elapsed_logical_time(); + exit(1); } =} reaction(shutdown) {= if(!received) { - reactor::log::Error() << "Nothing received."; - exit(1); + reactor::log::Error() << "Nothing received."; + exit(1); } =} reaction(t) {= reactor::log::Info() << "Tick - " << "logical time: " << get_elapsed_logical_time() - << "; physical time: " << get_elapsed_physical_time(); + << "; physical time: " << get_elapsed_physical_time(); =} deadline(1 s) {= reactor::log::Error() << "Deadline violated."; exit(2); diff --git a/test/Cpp/src/lib/ImportedAgain.lf b/test/Cpp/src/lib/ImportedAgain.lf index a5e0ba3ceb..36ae8054dc 100644 --- a/test/Cpp/src/lib/ImportedAgain.lf +++ b/test/Cpp/src/lib/ImportedAgain.lf @@ -8,10 +8,10 @@ reactor ImportedAgain { reaction(x) {= auto value = *x.get(); if (value != 42) { - std::cerr << "ERROR: Expected input to be 42. Got: " << value << std::endl; - exit(1); + std::cerr << "ERROR: Expected input to be 42. Got: " << value << std::endl; + exit(1); } else { - std::cout << "Received " << value << std::endl; + std::cout << "Received " << value << std::endl; } =} } diff --git a/test/Cpp/src/lib/LoopedActionSender.lf b/test/Cpp/src/lib/LoopedActionSender.lf index 00dee5631d..252d385168 100644 --- a/test/Cpp/src/lib/LoopedActionSender.lf +++ b/test/Cpp/src/lib/LoopedActionSender.lf @@ -21,11 +21,11 @@ reactor Sender(take_a_break_after: int = 10, break_interval: time = 400 msec) { out.set(sent_messages); sent_messages++; if(sent_messages < take_a_break_after){ - act.schedule(0ns); + act.schedule(0ns); } else { - // Take a break - sent_messages=0; - act.schedule(break_interval); + // Take a break + sent_messages=0; + act.schedule(break_interval); } =} } diff --git a/test/Cpp/src/multiport/BankSelfBroadcast.lf b/test/Cpp/src/multiport/BankSelfBroadcast.lf index 9fcf4c51d0..2961e3a55c 100644 --- a/test/Cpp/src/multiport/BankSelfBroadcast.lf +++ b/test/Cpp/src/multiport/BankSelfBroadcast.lf @@ -17,27 +17,27 @@ reactor A(bank_index: size_t = 0) { reaction(in) {= for (size_t i = 0; i < in.size(); i++) { - if (in[i].is_present()) { - std::cout << "Reactor " << bank_index << " received " - << *in[i].get() << " on channel " << i << '\n'; + if (in[i].is_present()) { + std::cout << "Reactor " << bank_index << " received " + << *in[i].get() << " on channel " << i << '\n'; - if (*in[i].get() != i) { - std::cerr << "ERROR: Expected " << i << '\n'; - exit(1); - } - received = true; - } else { - std::cout << "Reactor " << bank_index << " channel " << i << " is absent.\n"; - std::cerr << "ERROR: Expected " << i << '\n'; - exit(1); + if (*in[i].get() != i) { + std::cerr << "ERROR: Expected " << i << '\n'; + exit(1); } + received = true; + } else { + std::cout << "Reactor " << bank_index << " channel " << i << " is absent.\n"; + std::cerr << "ERROR: Expected " << i << '\n'; + exit(1); + } } =} reaction(shutdown) {= if (!received) { - std::cerr << "ERROR: No inputs received.\n"; - exit(2); + std::cerr << "ERROR: No inputs received.\n"; + exit(2); } =} } diff --git a/test/Cpp/src/multiport/BankToBank.lf b/test/Cpp/src/multiport/BankToBank.lf index d9fe3f437c..c0b59901bf 100644 --- a/test/Cpp/src/multiport/BankToBank.lf +++ b/test/Cpp/src/multiport/BankToBank.lf @@ -22,16 +22,16 @@ reactor Destination(bank_index: size_t = 0) { reaction(in) {= std::cout << "Destination " << bank_index << " received: " << *in.get() << "\n"; if (*in.get() != s) { - std::cerr << "ERROR: Expected " << s << ".\n"; - exit(1); + std::cerr << "ERROR: Expected " << s << ".\n"; + exit(1); } s += bank_index; =} reaction(shutdown) {= if (s == 0 && bank_index != 0) { - std::cerr << "ERROR: Destination " << bank_index << " received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination " << bank_index << " received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} diff --git a/test/Cpp/src/multiport/BankToBankMultiport.lf b/test/Cpp/src/multiport/BankToBankMultiport.lf index faffacb0cf..3df236c758 100644 --- a/test/Cpp/src/multiport/BankToBankMultiport.lf +++ b/test/Cpp/src/multiport/BankToBankMultiport.lf @@ -11,7 +11,7 @@ reactor Source(width: size_t = 1) { reaction(t) -> out {= for(size_t i = 0; i < out.size(); i++) { - out[i].set(s++); + out[i].set(s++); } =} } @@ -24,28 +24,28 @@ reactor Destination(width: size_t = 1) { int sum = 0; for (auto i : in.present_indices_unsorted()) { - sum += *in[i].get(); + sum += *in[i].get(); } std::cout << "Sum of received: " << sum << ".\n"; if (sum != s) { - std::cerr << "ERROR: Expected " << s << ".\n"; - exit(1); + std::cerr << "ERROR: Expected " << s << ".\n"; + exit(1); } s += 16; =} reaction(shutdown) {= if (s <= 6) { - std::cerr << "ERROR: Destination received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} } main reactor(bank_width: size_t = 4) { - a = new[bank_width] Source(width = 4) - b = new[bank_width] Destination(width = 4) + a = new[bank_width] Source(width=4) + b = new[bank_width] Destination(width=4) a.out -> b.in } diff --git a/test/Cpp/src/multiport/BankToBankMultiportAfter.lf b/test/Cpp/src/multiport/BankToBankMultiportAfter.lf index 6c9c81c5b4..64533fb414 100644 --- a/test/Cpp/src/multiport/BankToBankMultiportAfter.lf +++ b/test/Cpp/src/multiport/BankToBankMultiportAfter.lf @@ -11,7 +11,7 @@ reactor Source(width: size_t = 1) { reaction(t) -> out {= for(size_t i = 0; i < out.size(); i++) { - out[i].set(s++); + out[i].set(s++); } =} } @@ -26,34 +26,34 @@ reactor Destination(width: size_t = 1) { auto lt = get_elapsed_logical_time(); auto expected = iterations * 200ms; if (expected != lt) { - std::cerr << "ERROR: Expected logical time to be " << expected << " but got " << lt << '\n'; - exit(1); + std::cerr << "ERROR: Expected logical time to be " << expected << " but got " << lt << '\n'; + exit(1); } int sum = 0; for (auto i : in.present_indices_unsorted()) { - sum += *in[i].get(); + sum += *in[i].get(); } std::cout << "Sum of received: " << sum << '\n'; if (sum != s) { - std::cerr << "ERROR: Expected " << s << '\n'; - exit(1); + std::cerr << "ERROR: Expected " << s << '\n'; + exit(1); } s += 16; =} reaction(shutdown) {= if (s <= 6) { - std::cerr << "ERROR: Destination received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} } main reactor(bank_width: size_t = 4) { - a = new[bank_width] Source(width = 4) - b = new[bank_width] Destination(width = 4) + a = new[bank_width] Source(width=4) + b = new[bank_width] Destination(width=4) a.out -> b.in after 200 msec } diff --git a/test/Cpp/src/multiport/BankToMultiport.lf b/test/Cpp/src/multiport/BankToMultiport.lf index af338a32a2..93b476c235 100644 --- a/test/Cpp/src/multiport/BankToMultiport.lf +++ b/test/Cpp/src/multiport/BankToMultiport.lf @@ -13,19 +13,19 @@ reactor Sink { reaction(in) {= for (unsigned i = 0; i < in.size(); i++) { - received = true; - std::cout << "Received " << *in[i].get() << '\n'; - if (*in[i].get() != i) { - std::cerr << "Error: expected " << i << "!\n"; - exit(1); - } + received = true; + std::cout << "Received " << *in[i].get() << '\n'; + if (*in[i].get() != i) { + std::cerr << "Error: expected " << i << "!\n"; + exit(1); + } } =} reaction(shutdown) {= if (!received) { - std::cerr << "Error: received no input!\n"; - exit(2); + std::cerr << "Error: received no input!\n"; + exit(2); } =} } diff --git a/test/Cpp/src/multiport/Broadcast.lf b/test/Cpp/src/multiport/Broadcast.lf index e6dcbf9607..0ae960053b 100644 --- a/test/Cpp/src/multiport/Broadcast.lf +++ b/test/Cpp/src/multiport/Broadcast.lf @@ -14,15 +14,15 @@ reactor Sink(bank_index: size_t = 0) { received = true; std::cout << "Received " << *in.get() << '\n'; if (*in.get() != 42) { - std::cerr << "Error: expected " << 42 << "!\n"; - exit(1); + std::cerr << "Error: expected " << 42 << "!\n"; + exit(1); } =} reaction(shutdown) {= if (!received) { - std::cerr << "Error: Sink " << bank_index << " didn't receive anything.\n"; - exit(2); + std::cerr << "Error: Sink " << bank_index << " didn't receive anything.\n"; + exit(2); } =} } diff --git a/test/Cpp/src/multiport/BroadcastAfter.lf b/test/Cpp/src/multiport/BroadcastAfter.lf index 73cccc1904..50b8d5bb59 100644 --- a/test/Cpp/src/multiport/BroadcastAfter.lf +++ b/test/Cpp/src/multiport/BroadcastAfter.lf @@ -15,20 +15,20 @@ reactor Sink(bank_index: size_t = 0) { reaction(in) {= std::cout << bank_index << " received " << *in.get() << '\n'; if (*in.get() != 42) { - std::cerr << "Error: expected " << 42 << "!\n"; - exit(1); + std::cerr << "Error: expected " << 42 << "!\n"; + exit(1); } if (get_elapsed_logical_time() != 1s) { - std::cerr << "ERROR: Expected to receive input after one second.\n"; - exit(2); + std::cerr << "ERROR: Expected to receive input after one second.\n"; + exit(2); } received = true; =} reaction(shutdown) {= if (!received) { - std::cerr << "ERROR: Destination " << bank_index << " received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination " << bank_index << " received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} diff --git a/test/Cpp/src/multiport/BroadcastMultipleAfter.lf b/test/Cpp/src/multiport/BroadcastMultipleAfter.lf index f24a5f7c8c..da2af4e9cf 100644 --- a/test/Cpp/src/multiport/BroadcastMultipleAfter.lf +++ b/test/Cpp/src/multiport/BroadcastMultipleAfter.lf @@ -16,29 +16,29 @@ reactor Sink(bank_index: size_t = 0) { std::cout << bank_index << " received " << *in.get() << '\n'; auto expected = (bank_index % 3) + 1; if (*in.get() != expected) { - std::cerr << "Error: expected " << expected << "!\n"; - exit(1); + std::cerr << "Error: expected " << expected << "!\n"; + exit(1); } if (get_elapsed_logical_time() != 1s) { - std::cerr << "ERROR: Expected to receive input after one second.\n"; - exit(2); + std::cerr << "ERROR: Expected to receive input after one second.\n"; + exit(2); } received = true; =} reaction(shutdown) {= if (!received) { - std::cerr << "ERROR: Destination " << bank_index << " received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination " << bank_index << " received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} } main reactor { - source1 = new Source(value = 1) - source2 = new Source(value = 2) - source3 = new Source(value = 3) + source1 = new Source(value=1) + source2 = new Source(value=2) + source3 = new Source(value=3) sink = new[9] Sink() (source1.out, source2.out, source3.out)+ -> sink.in after 1 sec } diff --git a/test/Cpp/src/multiport/FullyConnected.lf b/test/Cpp/src/multiport/FullyConnected.lf index 09826be5f2..116fef9b07 100644 --- a/test/Cpp/src/multiport/FullyConnected.lf +++ b/test/Cpp/src/multiport/FullyConnected.lf @@ -17,26 +17,26 @@ reactor Node(bank_index: size_t = 0, num_nodes: size_t = 4) { received = true; size_t count{0}; for (auto i: in.present_indices_unsorted()) { - count++; - std::cout << *in[i].get() << ", "; + count++; + std::cout << *in[i].get() << ", "; } std::cout << '\n'; if (count != num_nodes) { - std::cerr << "ERROR: received less messages than expected!"; - exit(1); + std::cerr << "ERROR: received less messages than expected!"; + exit(1); } =} reaction(shutdown) {= if (!received) { - std::cerr << "Error: received no input!\n"; - exit(2); + std::cerr << "Error: received no input!\n"; + exit(2); } =} } main reactor(num_nodes: size_t = 4) { - nodes = new[num_nodes] Node(num_nodes = num_nodes) + nodes = new[num_nodes] Node(num_nodes=num_nodes) (nodes.out)+ -> nodes.in } diff --git a/test/Cpp/src/multiport/FullyConnectedAddressable.lf b/test/Cpp/src/multiport/FullyConnectedAddressable.lf index 5047109cf8..4c8f95aa5f 100644 --- a/test/Cpp/src/multiport/FullyConnectedAddressable.lf +++ b/test/Cpp/src/multiport/FullyConnectedAddressable.lf @@ -19,32 +19,32 @@ reactor Node(bank_index: size_t = 0, num_nodes: size_t = 4) { size_t count{0}; size_t result{0}; for (auto i : in.present_indices_unsorted()) { - count++; - result = *in[i].get(); - std::cout << result << ", "; + count++; + result = *in[i].get(); + std::cout << result << ", "; } std::cout << '\n'; size_t expected = bank_index == 0 ? num_nodes - 1 : bank_index - 1; if (count != 1 || result != expected) { - std::cerr << "ERROR: received an unexpected message!\n"; - exit(1); + std::cerr << "ERROR: received an unexpected message!\n"; + exit(1); } =} reaction(shutdown) {= if (!received) { - std::cerr << "Error: received no input!\n"; - exit(2); + std::cerr << "Error: received no input!\n"; + exit(2); } =} } main reactor(num_nodes: size_t = 4) { - nodes1 = new[num_nodes] Node(num_nodes = num_nodes) + nodes1 = new[num_nodes] Node(num_nodes=num_nodes) nodes1.out -> interleaved(nodes1.in) - nodes2 = new[num_nodes] Node(num_nodes = num_nodes) + nodes2 = new[num_nodes] Node(num_nodes=num_nodes) interleaved(nodes2.out) -> nodes2.in } diff --git a/test/Cpp/src/multiport/FullyConnectedAddressableAfter.lf b/test/Cpp/src/multiport/FullyConnectedAddressableAfter.lf index d3593ab530..4af328f569 100644 --- a/test/Cpp/src/multiport/FullyConnectedAddressableAfter.lf +++ b/test/Cpp/src/multiport/FullyConnectedAddressableAfter.lf @@ -4,9 +4,9 @@ target Cpp import Node from "FullyConnectedAddressable.lf" main reactor(num_nodes: size_t = 4) { - nodes1 = new[num_nodes] Node(num_nodes = num_nodes) + nodes1 = new[num_nodes] Node(num_nodes=num_nodes) nodes1.out -> interleaved(nodes1.in) after 200 msec - nodes2 = new[num_nodes] Node(num_nodes = num_nodes) + nodes2 = new[num_nodes] Node(num_nodes=num_nodes) interleaved(nodes2.out) -> nodes2.in after 400 msec } diff --git a/test/Cpp/src/multiport/IndexIntoMultiportInput.lf b/test/Cpp/src/multiport/IndexIntoMultiportInput.lf index 8deaef2c2a..39baee6b6b 100644 --- a/test/Cpp/src/multiport/IndexIntoMultiportInput.lf +++ b/test/Cpp/src/multiport/IndexIntoMultiportInput.lf @@ -13,17 +13,17 @@ reactor ReactorWithMultiport { reaction(startup, in) {= bool error{false}; for (size_t i{0}; i < in.size(); i++) { - if (in[i].is_present()) { - if (*in[i].get() != i) { - reactor::log::Error() << "received wrong input on port " << i; - } - } else { - error = true; - reactor::log::Error() << "input " << i << " is not present"; + if (in[i].is_present()) { + if (*in[i].get() != i) { + reactor::log::Error() << "received wrong input on port " << i; } + } else { + error = true; + reactor::log::Error() << "input " << i << " is not present"; + } } if (error) { - exit(1); + exit(1); } reactor::log::Info() << "success"; =} diff --git a/test/Cpp/src/multiport/IndexIntoMultiportOutput.lf b/test/Cpp/src/multiport/IndexIntoMultiportOutput.lf index 70b89fa728..23e366958a 100644 --- a/test/Cpp/src/multiport/IndexIntoMultiportOutput.lf +++ b/test/Cpp/src/multiport/IndexIntoMultiportOutput.lf @@ -12,7 +12,7 @@ reactor ReactorWithMultiport(width: size_t = 3) { reaction(startup) -> out {= for (size_t i{0}; i < width; i++) { - out[i].set(i); + out[i].set(i); } =} } @@ -40,32 +40,32 @@ main reactor IndexIntoMultiportOutput { reaction(splitter.out0) {= received0 = true; if (*splitter.out0.get() != 0) { - reactor::log::Error() << "expeced 0"; - exit(1); + reactor::log::Error() << "expeced 0"; + exit(1); } =} reaction(splitter.out1) {= received1 = true; if (*splitter.out1.get() != 1) { - reactor::log::Error() << "expeced 1"; - exit(1); + reactor::log::Error() << "expeced 1"; + exit(1); } =} reaction(splitter.out2) {= received2 = true; if (*splitter.out2.get() != 2) { - reactor::log::Error() << "expeced 2"; - exit(1); + reactor::log::Error() << "expeced 2"; + exit(1); } =} reaction(shutdown) {= if (!received0 || !received1 || !received2) { - reactor::log::Error() << "missed a message"; + reactor::log::Error() << "missed a message"; } else { - reactor::log::Info() << "success"; + reactor::log::Info() << "success"; } =} } diff --git a/test/Cpp/src/multiport/Multiport.lf b/test/Cpp/src/multiport/Multiport.lf index 32bc20b810..7482216734 100644 --- a/test/Cpp/src/multiport/Multiport.lf +++ b/test/Cpp/src/multiport/Multiport.lf @@ -13,7 +13,7 @@ reactor Test { reaction(sink) -> source {= for (auto i: sink.present_indices_unsorted()) { - source[i].set(); + source[i].set(); } =} } @@ -24,8 +24,8 @@ main reactor Multiport { reaction(startup) -> test.sink {= for (auto i = 0; i < 30; i++) { - auto semi_random_index = (i * 100) % 3000; - test.sink[semi_random_index].set(); + auto semi_random_index = (i * 100) % 3000; + test.sink[semi_random_index].set(); } =} @@ -34,23 +34,23 @@ main reactor Multiport { std::vector positions; for (auto i = 0; i < 30; i++) { - auto semi_random_index = (i * 100) % 3000; - positions.push_back(semi_random_index); + auto semi_random_index = (i * 100) % 3000; + positions.push_back(semi_random_index); } auto received_indices = test.source.present_indices_unsorted(); if (positions.size() != received_indices.size()) { - std::cerr << "positions size:" << positions.size() - << " indices size:" << received_indices.size() << std::endl; - throw std::runtime_error("not matching sizes"); + std::cerr << "positions size:" << positions.size() + << " indices size:" << received_indices.size() << std::endl; + throw std::runtime_error("not matching sizes"); } for (auto i = 0; i < positions.size(); i++) { - if (positions[i] != received_indices[i]) { - std::cerr << "mismatch detected:" << positions[i] << " and " << received_indices[i] << std::endl; - throw std::runtime_error("indices do not match"); - } + if (positions[i] != received_indices[i]) { + std::cerr << "mismatch detected:" << positions[i] << " and " << received_indices[i] << std::endl; + throw std::runtime_error("indices do not match"); + } } std::cout << "[SUCCESS] all indices match" << std::endl; @@ -58,8 +58,8 @@ main reactor Multiport { reaction(shutdown) {= if (!received) { - std::cerr << "Error: received no input!\n"; - exit(2); + std::cerr << "Error: received no input!\n"; + exit(2); } =} } diff --git a/test/Cpp/src/multiport/MultiportFromBank.lf b/test/Cpp/src/multiport/MultiportFromBank.lf index 65d3554b3f..e3f6a23b30 100644 --- a/test/Cpp/src/multiport/MultiportFromBank.lf +++ b/test/Cpp/src/multiport/MultiportFromBank.lf @@ -17,19 +17,19 @@ reactor Destination(port_width: size_t = 2) { reaction(in) {= for (size_t i = 0; i < in.size(); i++) { - std::cout << "Destination channel " << i << " received " << *in[i].get() << ".\n"; - if (i != *in[i].get()) { - std::cerr << "ERROR: Expected " << i << ".\n"; - exit(1); - } + std::cout << "Destination channel " << i << " received " << *in[i].get() << ".\n"; + if (i != *in[i].get()) { + std::cerr << "ERROR: Expected " << i << ".\n"; + exit(1); + } } received = true; =} reaction(shutdown) {= if (!received) { - std::cerr << "ERROR: Destination received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} @@ -37,6 +37,6 @@ reactor Destination(port_width: size_t = 2) { main reactor(width: size_t = 4) { a = new[width] Source() - b = new Destination(port_width = width) + b = new Destination(port_width=width) a.out -> b.in } diff --git a/test/Cpp/src/multiport/MultiportFromBankHierarchy.lf b/test/Cpp/src/multiport/MultiportFromBankHierarchy.lf index 3814b6c510..c6ffb52819 100644 --- a/test/Cpp/src/multiport/MultiportFromBankHierarchy.lf +++ b/test/Cpp/src/multiport/MultiportFromBankHierarchy.lf @@ -23,19 +23,19 @@ reactor Destination { reaction(in) {= for (size_t i = 0; i < in.size(); i++) { - std::cout << "Destination channel " << i << " received " << *in[i].get() << ".\n"; - if (i != *in[i].get()) { - std::cerr << "ERROR: Expected " << i << ".\n"; - exit(1); - } + std::cout << "Destination channel " << i << " received " << *in[i].get() << ".\n"; + if (i != *in[i].get()) { + std::cerr << "ERROR: Expected " << i << ".\n"; + exit(1); + } } received = true; =} reaction(shutdown) {= if (!received) { - std::cerr << "ERROR: Destination received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} diff --git a/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf b/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf index d745d5ebd0..cb3eeaa0c4 100644 --- a/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf +++ b/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf @@ -23,24 +23,24 @@ reactor Destination { reaction(in) {= for (int i = 0; i < in.size(); i++) { - int value = *in[i].get(); - std::cout << "Destination channel " << i << " received " << value << '\n'; - if (i != value) { - std::cerr << "ERROR: Expected " << i << '\n'; - exit(1); - } + int value = *in[i].get(); + std::cout << "Destination channel " << i << " received " << value << '\n'; + if (i != value) { + std::cerr << "ERROR: Expected " << i << '\n'; + exit(1); + } } if (get_elapsed_logical_time() != 1s) { - std::cerr << "ERROR: Expected to receive input after one second.\n"; - exit(2); + std::cerr << "ERROR: Expected to receive input after one second.\n"; + exit(2); } received = true; =} reaction(shutdown) {= if (!received) { - std::cerr << "ERROR: Destination received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} diff --git a/test/Cpp/src/multiport/MultiportFromHierarchy.lf b/test/Cpp/src/multiport/MultiportFromHierarchy.lf index 21726e1238..0615286dfc 100644 --- a/test/Cpp/src/multiport/MultiportFromHierarchy.lf +++ b/test/Cpp/src/multiport/MultiportFromHierarchy.lf @@ -11,7 +11,7 @@ reactor Source { reaction(t) -> out {= for(int i = 0; i < 4; i++) { - out[i].set(s++); + out[i].set(s++); } =} } @@ -23,21 +23,21 @@ reactor Destination { reaction(in) {= int sum = 0; for (auto i : in.present_indices_unsorted()) { - sum += *in[i].get(); + sum += *in[i].get(); } std::cout << "Sum of received: " << sum << ".\n"; if (sum != s) { - std::cerr << "ERROR: Expected " << s << ".\n"; - exit(1); + std::cerr << "ERROR: Expected " << s << ".\n"; + exit(1); } s += 16; =} reaction(shutdown) {= if (s <= 6) { - std::cerr << "ERROR: Destination received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} diff --git a/test/Cpp/src/multiport/MultiportIn.lf b/test/Cpp/src/multiport/MultiportIn.lf index 5e6750a886..6f4f63f74b 100644 --- a/test/Cpp/src/multiport/MultiportIn.lf +++ b/test/Cpp/src/multiport/MultiportIn.lf @@ -27,20 +27,20 @@ reactor Destination { reaction(in) {= int sum = 0; for (int i = 0; i < in.size(); i++) { - sum += *in[i].get(); + sum += *in[i].get(); } std::cout << "Sum of received: " << sum << ".\n"; if (sum != s) { - std::cerr << "ERROR: Expected " << s << ".\n"; - exit(1); + std::cerr << "ERROR: Expected " << s << ".\n"; + exit(1); } s += 4; =} reaction(shutdown) {= if (s == 0) { - std::cerr << "ERROR: Destination received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} diff --git a/test/Cpp/src/multiport/MultiportMultipleSet.lf b/test/Cpp/src/multiport/MultiportMultipleSet.lf index 74ef376070..fb1a9d593f 100644 --- a/test/Cpp/src/multiport/MultiportMultipleSet.lf +++ b/test/Cpp/src/multiport/MultiportMultipleSet.lf @@ -11,9 +11,9 @@ reactor Producer { reaction(t) -> out {= for (int i{odd ? 1 : 0}; i < 10; i += 2) { - for (int j{0}; j < 10; j++) { - out[i].set(j); - } + for (int j{0}; j < 10; j++) { + out[i].set(j); + } } odd = !odd; @@ -29,23 +29,23 @@ reactor Consumer { int last = -1; for (int i : in.present_indices_unsorted()) { - count++; - if (odd && i%2 == 0) { - reactor::log::Error() << "Expected values only on odd ports, but received one on port " << i; - exit(1); - } - if (!odd && i%2 == 1) { - reactor::log::Error() << "Expected values only on even ports, but received one on port " << i; - exit(2); - } - if (9 != *in[i].get()) { - reactor::log::Error() << "Expected 9 but got " << *in[i].get(); - exit(3); - } + count++; + if (odd && i%2 == 0) { + reactor::log::Error() << "Expected values only on odd ports, but received one on port " << i; + exit(1); + } + if (!odd && i%2 == 1) { + reactor::log::Error() << "Expected values only on even ports, but received one on port " << i; + exit(2); + } + if (9 != *in[i].get()) { + reactor::log::Error() << "Expected 9 but got " << *in[i].get(); + exit(3); + } } if (count != 5) { - reactor::log::Error() << "Expected count to be 5, but got " << count; - exit(4); + reactor::log::Error() << "Expected count to be 5, but got " << count; + exit(4); } odd = !odd; diff --git a/test/Cpp/src/multiport/MultiportOut.lf b/test/Cpp/src/multiport/MultiportOut.lf index 1e03e75fdb..ff23644d42 100644 --- a/test/Cpp/src/multiport/MultiportOut.lf +++ b/test/Cpp/src/multiport/MultiportOut.lf @@ -11,7 +11,7 @@ reactor Source { reaction(t) -> out {= for(int i = 0; i < 4; i++) { - out[i].set(s); + out[i].set(s); } s++; =} @@ -37,20 +37,20 @@ reactor Destination { reaction(in) {= int sum = 0; for (auto i : in.present_indices_unsorted()) { - sum += *in[i].get(); + sum += *in[i].get(); } std::cout << "Sum of received: " << sum << ".\n"; if (sum != s) { - std::cerr << "ERROR: Expected " << s << ".\n"; - exit(1); + std::cerr << "ERROR: Expected " << s << ".\n"; + exit(1); } s += 4; =} reaction(shutdown) {= if (s == 0) { - std::cerr << "ERROR: Destination received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} diff --git a/test/Cpp/src/multiport/MultiportToBank.lf b/test/Cpp/src/multiport/MultiportToBank.lf index adb7b73b34..77ae5247e1 100644 --- a/test/Cpp/src/multiport/MultiportToBank.lf +++ b/test/Cpp/src/multiport/MultiportToBank.lf @@ -5,7 +5,7 @@ reactor Source { reaction(startup) -> out {= for (unsigned i = 0 ; i < out.size(); i++) { - out[i].set(i); + out[i].set(i); } =} } @@ -16,8 +16,8 @@ reactor Sink(bank_index: size_t = 0) { reaction(in) {= std::cout << "Received " << *in.get() << '\n'; if (*in.get() != bank_index) { - std::cerr << "Error: expected " << bank_index << "!\n"; - exit(1); + std::cerr << "Error: expected " << bank_index << "!\n"; + exit(1); } =} } diff --git a/test/Cpp/src/multiport/MultiportToBankAfter.lf b/test/Cpp/src/multiport/MultiportToBankAfter.lf index 423d9ee433..ff4f83b388 100644 --- a/test/Cpp/src/multiport/MultiportToBankAfter.lf +++ b/test/Cpp/src/multiport/MultiportToBankAfter.lf @@ -5,7 +5,7 @@ reactor Source { reaction(startup) -> out {= for (unsigned i = 0 ; i < out.size(); i++) { - out[i].set(i); + out[i].set(i); } =} } @@ -16,12 +16,12 @@ reactor Sink(bank_index: size_t = 0) { reaction(in) {= std::cout << "Received " << *in.get() << '\n'; if (*in.get() != bank_index) { - std::cerr << "Error: expected " << bank_index << "!\n"; - exit(1); + std::cerr << "Error: expected " << bank_index << "!\n"; + exit(1); } if (get_elapsed_logical_time() != 1s) { - std::cerr << "ERROR: Expected to receive input after one second.\n"; - exit(2); + std::cerr << "ERROR: Expected to receive input after one second.\n"; + exit(2); } =} } diff --git a/test/Cpp/src/multiport/MultiportToBankHierarchy.lf b/test/Cpp/src/multiport/MultiportToBankHierarchy.lf index e58531e70c..60bc731a3b 100644 --- a/test/Cpp/src/multiport/MultiportToBankHierarchy.lf +++ b/test/Cpp/src/multiport/MultiportToBankHierarchy.lf @@ -10,7 +10,7 @@ reactor Source { reaction(startup) -> out {= for(size_t i = 0; i < out.size(); i++) { - out[i].set(i); + out[i].set(i); } =} } @@ -22,16 +22,16 @@ reactor Destination(bank_index: size_t = 0) { reaction(in) {= std::cout << "Destination " << bank_index << " received " << *in.get() << ".\n"; if (bank_index != *in.get()) { - std::cerr << "ERROR: Expected " << bank_index << ".\n"; - exit(1); + std::cerr << "ERROR: Expected " << bank_index << ".\n"; + exit(1); } received = true; =} reaction(shutdown) {= if (!received) { - std::cerr << "ERROR: Destination " << bank_index << " received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination " << bank_index << " received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} diff --git a/test/Cpp/src/multiport/MultiportToHierarchy.lf b/test/Cpp/src/multiport/MultiportToHierarchy.lf index 6e7a8e757b..3fc5fdc057 100644 --- a/test/Cpp/src/multiport/MultiportToHierarchy.lf +++ b/test/Cpp/src/multiport/MultiportToHierarchy.lf @@ -12,7 +12,7 @@ reactor Source(width: size_t = 4) { reaction(t) -> out {= for(size_t i = 0; i < 4; i++) { - out[i].set(s++); + out[i].set(s++); } =} } @@ -24,21 +24,21 @@ reactor Destination(width: size_t = 4) { reaction(in) {= int sum = 0; for (auto i : in.present_indices_unsorted()) { - sum += *in[i].get(); + sum += *in[i].get(); } std::cout << "Sum of received: " << sum << ".\n"; if (sum != s) { - std::cerr << "ERROR: Expected " << s << ".\n"; - exit(1); + std::cerr << "ERROR: Expected " << s << ".\n"; + exit(1); } s += 16; =} reaction(shutdown) {= if (s <= 6) { - std::cerr << "ERROR: Destination received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} @@ -51,7 +51,7 @@ reactor Container(width: size_t = 4) { } main reactor MultiportToHierarchy(width: size_t = 4) { - a = new Source(width = width) - b = new Container(width = width) + a = new Source(width=width) + b = new Container(width=width) a.out -> b.in } diff --git a/test/Cpp/src/multiport/MultiportToMultiport.lf b/test/Cpp/src/multiport/MultiportToMultiport.lf index b018299508..3e89a847e0 100644 --- a/test/Cpp/src/multiport/MultiportToMultiport.lf +++ b/test/Cpp/src/multiport/MultiportToMultiport.lf @@ -5,7 +5,7 @@ reactor Source { reaction(startup) -> out {= for (unsigned i = 0; i < out.size(); i++) { - out[i].set(i); + out[i].set(i); } =} } @@ -16,19 +16,19 @@ reactor Sink { reaction(in) {= for (unsigned i = 0; i < in.size(); i++) { - std::cout << "Received " << *in[i].get() << '\n'; - received = true; - if (*in[i].get() != i) { - std::cerr << "Error: expected " << i << "!\n"; - exit(1); - } + std::cout << "Received " << *in[i].get() << '\n'; + received = true; + if (*in[i].get() != i) { + std::cerr << "Error: expected " << i << "!\n"; + exit(1); + } } =} reaction(shutdown) {= if (!received) { - std::cerr << "Error: No data received!\n"; - exit(2); + std::cerr << "Error: No data received!\n"; + exit(2); } =} } diff --git a/test/Cpp/src/multiport/MultiportToMultiport2.lf b/test/Cpp/src/multiport/MultiportToMultiport2.lf index eafe9fee3c..607d345460 100644 --- a/test/Cpp/src/multiport/MultiportToMultiport2.lf +++ b/test/Cpp/src/multiport/MultiportToMultiport2.lf @@ -6,7 +6,7 @@ reactor Source(width: size_t = 2) { reaction(startup) -> out {= for (size_t i = 0; i < out.size(); i++) { - out[i].set(i); + out[i].set(i); } =} } @@ -16,21 +16,21 @@ reactor Destination(width: size_t = 2) { reaction(in) {= for (auto i: in.present_indices_unsorted()) { - size_t value = *in[i].get(); - std::cout << "Received on channel " << i << ": " << value << '\n'; - // NOTE: For testing purposes, this assumes the specific - // widths instantiated below. - if (value != i % 3) { - std::cerr << "ERROR: expected " << i % 3 << '\n'; - exit(1); - } + size_t value = *in[i].get(); + std::cout << "Received on channel " << i << ": " << value << '\n'; + // NOTE: For testing purposes, this assumes the specific + // widths instantiated below. + if (value != i % 3) { + std::cerr << "ERROR: expected " << i % 3 << '\n'; + exit(1); + } } =} } main reactor MultiportToMultiport2 { - a1 = new Source(width = 3) - a2 = new Source(width = 2) - b = new Destination(width = 5) + a1 = new Source(width=3) + a2 = new Source(width=2) + b = new Destination(width=5) a1.out, a2.out -> b.in } diff --git a/test/Cpp/src/multiport/MultiportToMultiport2After.lf b/test/Cpp/src/multiport/MultiportToMultiport2After.lf index ed64200076..c339814cca 100644 --- a/test/Cpp/src/multiport/MultiportToMultiport2After.lf +++ b/test/Cpp/src/multiport/MultiportToMultiport2After.lf @@ -6,7 +6,7 @@ reactor Source(width: size_t = 2) { reaction(startup) -> out {= for (size_t i = 0; i < out.size(); i++) { - out[i].set(i); + out[i].set(i); } =} } @@ -16,27 +16,27 @@ reactor Destination(width: size_t = 2) { reaction(in) {= for (size_t i = 0; i < in.size(); i++) { - if (in[i].is_present()) { - size_t value = *in[i].get(); - std::cout << "Received on channel " << i << ": " << value << '\n'; - // NOTE: For testing purposes, this assumes the specific - // widths instantiated below. - if (value != i % 3) { - std::cerr << "ERROR: expected " << i % 3 << '\n'; - exit(1); - } + if (in[i].is_present()) { + size_t value = *in[i].get(); + std::cout << "Received on channel " << i << ": " << value << '\n'; + // NOTE: For testing purposes, this assumes the specific + // widths instantiated below. + if (value != i % 3) { + std::cerr << "ERROR: expected " << i % 3 << '\n'; + exit(1); } + } } if (get_elapsed_logical_time() != 1s) { - std::cerr << "ERROR: Expected to receive input after one second.\n"; - exit(2); + std::cerr << "ERROR: Expected to receive input after one second.\n"; + exit(2); } =} } main reactor { - a1 = new Source(width = 3) - a2 = new Source(width = 2) - b = new Destination(width = 5) + a1 = new Source(width=3) + a2 = new Source(width=2) + b = new Destination(width=5) a1.out, a2.out -> b.in after 1 sec } diff --git a/test/Cpp/src/multiport/MultiportToMultiportArray.lf b/test/Cpp/src/multiport/MultiportToMultiportArray.lf index fce25b346b..3f95cd2c21 100644 --- a/test/Cpp/src/multiport/MultiportToMultiportArray.lf +++ b/test/Cpp/src/multiport/MultiportToMultiportArray.lf @@ -11,14 +11,14 @@ reactor Source { reaction(t) -> out {= for(int i = 0; i < 2; i++) { - // Dynamically allocate a new output array - auto a = reactor::make_mutable_value>(); - // initialize it - (*a)[0] = s++; - (*a)[1] = s++; - (*a)[2] = s++; - // and send it - out[i].set(std::move(a)); + // Dynamically allocate a new output array + auto a = reactor::make_mutable_value>(); + // initialize it + (*a)[0] = s++; + (*a)[1] = s++; + (*a)[2] = s++; + // and send it + out[i].set(std::move(a)); } =} } @@ -30,23 +30,23 @@ reactor Destination { reaction(in) {= int sum = 0; for (auto i : in.present_indices_unsorted()) { - const auto& a = *in[i].get(); - for (int j = 0; j < a.size(); j++) { - sum += a[j]; - } + const auto& a = *in[i].get(); + for (int j = 0; j < a.size(); j++) { + sum += a[j]; + } } std::cout << "Sum of received: " << sum << '\n'; if (sum != s) { - std::cerr << "ERROR: Expected " << s << '\n'; - exit(1); + std::cerr << "ERROR: Expected " << s << '\n'; + exit(1); } s += 36; =} reaction(shutdown) {= if (s <= 15) { - std::cerr << "ERROR: Destination received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} diff --git a/test/Cpp/src/multiport/MultiportToMultiportPhysical.lf b/test/Cpp/src/multiport/MultiportToMultiportPhysical.lf index 7418bee409..db8583f3fd 100644 --- a/test/Cpp/src/multiport/MultiportToMultiportPhysical.lf +++ b/test/Cpp/src/multiport/MultiportToMultiportPhysical.lf @@ -5,7 +5,7 @@ reactor Source { reaction(startup) -> out {= for (unsigned i = 0; i < out.size(); i++) { - out[i].set(i); + out[i].set(i); } =} } @@ -17,22 +17,22 @@ reactor Sink { reaction(in) {= auto present_ports = in.present_indices_unsorted(); if (present_ports.size() != 1) { - reactor::log::Error() << "Expected only one value, but got " << present_ports.size(); - exit(1); + reactor::log::Error() << "Expected only one value, but got " << present_ports.size(); + exit(1); } int idx = present_ports[0]; std::cout << "Received " << *in[idx].get() << '\n'; if (idx <= received) { - reactor::log::Error() << "Received index " << idx << " after " << received; - exit(2); + reactor::log::Error() << "Received index " << idx << " after " << received; + exit(2); } received = idx; =} reaction(shutdown) {= if (received != 3) { - std::cerr << "Error: No data received!\n"; - exit(2); + std::cerr << "Error: No data received!\n"; + exit(2); } =} } diff --git a/test/Cpp/src/multiport/MultiportToPort.lf b/test/Cpp/src/multiport/MultiportToPort.lf index ed69542aa7..31354d320c 100644 --- a/test/Cpp/src/multiport/MultiportToPort.lf +++ b/test/Cpp/src/multiport/MultiportToPort.lf @@ -9,8 +9,8 @@ reactor Source { reaction(startup) -> out {= for(int i = 0; i < out.size(); i++) { - std::cout << "Source sending " << i << ".\n"; - out[i].set(i); + std::cout << "Source sending " << i << ".\n"; + out[i].set(i); } =} } @@ -23,15 +23,15 @@ reactor Destination(expected: int = 0) { std::cout << "Received: " << *in.get() << ".\n"; received = true; if (*in.get() != expected) { - std::cerr << "ERROR: Expected " << expected << ".\n"; - exit(1); + std::cerr << "ERROR: Expected " << expected << ".\n"; + exit(1); } =} reaction(shutdown) {= if (!received) { - std::cerr << "ERROR: Destination received no input!\n"; - exit(1); + std::cerr << "ERROR: Destination received no input!\n"; + exit(1); } std::cout << "Success.\n"; =} @@ -40,6 +40,6 @@ reactor Destination(expected: int = 0) { main reactor MultiportToPort { a = new Source() b1 = new Destination() - b2 = new Destination(expected = 1) + b2 = new Destination(expected=1) a.out -> b1.in, b2.in } diff --git a/test/Cpp/src/multiport/PipelineAfter.lf b/test/Cpp/src/multiport/PipelineAfter.lf index b160ab8104..8fb6418e65 100644 --- a/test/Cpp/src/multiport/PipelineAfter.lf +++ b/test/Cpp/src/multiport/PipelineAfter.lf @@ -19,12 +19,12 @@ reactor Sink { reaction(in) {= std::cout << "Received " << *in.get() << '\n'; if (*in.get() != 42) { - std::cerr << "Error: expected 42!\n"; - exit(1); + std::cerr << "Error: expected 42!\n"; + exit(1); } if (get_elapsed_logical_time() != 1s) { - std::cerr << "ERROR: Expected to receive input after 1 second.\n"; - exit(2); + std::cerr << "ERROR: Expected to receive input after 1 second.\n"; + exit(2); } =} } diff --git a/test/Cpp/src/multiport/ReadMultiportOutputOfContainedBank.lf b/test/Cpp/src/multiport/ReadMultiportOutputOfContainedBank.lf index 329ac18ed7..b44b355ca7 100644 --- a/test/Cpp/src/multiport/ReadMultiportOutputOfContainedBank.lf +++ b/test/Cpp/src/multiport/ReadMultiportOutputOfContainedBank.lf @@ -6,7 +6,7 @@ reactor Contained(bank_index: size_t = 0) { reaction(startup) -> out {= for (size_t i = 0; i < 3; i++) { - out[i].set(bank_index * i); + out[i].set(bank_index * i); } =} } @@ -17,53 +17,53 @@ main reactor { reaction(startup) c.out {= for (size_t i = 0; i < c.size(); i++) { - for (size_t j = 0; j < c[i].out.size(); j++) { - unsigned result = *c[i].out[j].get(); - std::cout << "Startup reaction reading output of contained " - << "reactor: " << result << std::endl; - if (result != i * j) { - std::cout << "FAILURE: expected " << i * j << std::endl; - exit(2); - } + for (size_t j = 0; j < c[i].out.size(); j++) { + unsigned result = *c[i].out[j].get(); + std::cout << "Startup reaction reading output of contained " + << "reactor: " << result << std::endl; + if (result != i * j) { + std::cout << "FAILURE: expected " << i * j << std::endl; + exit(2); } + } } count++; =} reaction(c.out) {= for (size_t i = 0; i < c.size(); i++) { - for (size_t j = 0; j < c[i].out.size(); j++) { - unsigned result = *c[i].out[j].get(); - std::cout << "Reading output of contained reactor: " << result << std::endl; - if (result != i * j) { - std::cout << "FAILURE: expected " << i * j << std::endl; - exit(2); - } + for (size_t j = 0; j < c[i].out.size(); j++) { + unsigned result = *c[i].out[j].get(); + std::cout << "Reading output of contained reactor: " << result << std::endl; + if (result != i * j) { + std::cout << "FAILURE: expected " << i * j << std::endl; + exit(2); } + } } count++; =} reaction(startup, c.out) {= for (size_t i = 0; i < c.size(); i++) { - for (size_t j = 0; j < c[i].out.size(); j++) { - unsigned result = *c[i].out[j].get(); - std::cout << "Alternate triggering reading output of contained " - << "reactor: " << result << std::endl; - if (result != i * j) { - std::cout << "FAILURE: expected " << i * j << std::endl; - exit(2); - } + for (size_t j = 0; j < c[i].out.size(); j++) { + unsigned result = *c[i].out[j].get(); + std::cout << "Alternate triggering reading output of contained " + << "reactor: " << result << std::endl; + if (result != i * j) { + std::cout << "FAILURE: expected " << i * j << std::endl; + exit(2); } + } } count++; =} reaction(shutdown) {= if (count != 3) { - std::cerr << "ERROR: One of the reactions failed to trigger." - << std::endl; - exit(1); + std::cerr << "ERROR: One of the reactions failed to trigger." + << std::endl; + exit(1); } =} } diff --git a/test/Cpp/src/multiport/ReadOutputOfContainedBank.lf b/test/Cpp/src/multiport/ReadOutputOfContainedBank.lf index b9a485ac7d..c0fb6d59ee 100644 --- a/test/Cpp/src/multiport/ReadOutputOfContainedBank.lf +++ b/test/Cpp/src/multiport/ReadOutputOfContainedBank.lf @@ -13,48 +13,48 @@ main reactor { reaction(startup) c.out {= for (size_t i = 0; i < c.size(); i++) { - unsigned result = *c[i].out.get(); - std::cout << "Startup reaction reading output of contained " - << "reactor: " << result << std::endl; - if (result != 42 * i) { - std::cout << "FAILURE: expected " << 42 * i << std::endl; - exit(2); - } + unsigned result = *c[i].out.get(); + std::cout << "Startup reaction reading output of contained " + << "reactor: " << result << std::endl; + if (result != 42 * i) { + std::cout << "FAILURE: expected " << 42 * i << std::endl; + exit(2); + } } count++; =} reaction(c.out) {= for (size_t i = 0; i < c.size(); i++) { - unsigned result = *c[i].out.get(); - std::cout << "Reading output of contained reactor: " << result - << std::endl; - if (result != 42 * i) { - std::cout << "FAILURE: expected " << 42 * i << std::endl; - exit(2); - } + unsigned result = *c[i].out.get(); + std::cout << "Reading output of contained reactor: " << result + << std::endl; + if (result != 42 * i) { + std::cout << "FAILURE: expected " << 42 * i << std::endl; + exit(2); + } } count++; =} reaction(startup, c.out) {= for (size_t i = 0; i < c.size(); i++) { - unsigned result = *c[i].out.get(); - std::cout << "Alternate triggering reading output of contained " - << "reactor: " << result << std::endl; - if (result != 42 * i) { - std::cout << "FAILURE: expected " << 42 * i << std::endl; - exit(2); - } + unsigned result = *c[i].out.get(); + std::cout << "Alternate triggering reading output of contained " + << "reactor: " << result << std::endl; + if (result != 42 * i) { + std::cout << "FAILURE: expected " << 42 * i << std::endl; + exit(2); + } } count++; =} reaction(shutdown) {= if (count != 3) { - std::cerr << "ERROR: One of the reactions failed to trigger." - << std::endl; - exit(1); + std::cerr << "ERROR: One of the reactions failed to trigger." + << std::endl; + exit(1); } =} } diff --git a/test/Cpp/src/multiport/SparseMultiport.lf b/test/Cpp/src/multiport/SparseMultiport.lf index f126ce385d..6113c3beb3 100644 --- a/test/Cpp/src/multiport/SparseMultiport.lf +++ b/test/Cpp/src/multiport/SparseMultiport.lf @@ -11,7 +11,7 @@ reactor Producer { reaction(t) -> out {= for (int i{odd ? 1 : 0}; i < 10; i += 2) { - out[i].set(i); + out[i].set(i); } odd = !odd; @@ -25,17 +25,17 @@ reactor Consumer { reaction(in) {= reactor::log::Info() << "Received:"; for (int i{0}; i < 10; i++) { - if (in[i].is_present()) { - if (odd && i%2 == 0) { - reactor::log::Error() << "Expected values only on odd ports, but received one on port " << i; - exit(1); - } - if (!odd && i%2 == 1) { - reactor::log::Error() << "Expected values only on even ports, but received one on port " << i; - exit(1); - } - reactor::log::Info() << "- " << i; + if (in[i].is_present()) { + if (odd && i%2 == 0) { + reactor::log::Error() << "Expected values only on odd ports, but received one on port " << i; + exit(1); + } + if (!odd && i%2 == 1) { + reactor::log::Error() << "Expected values only on even ports, but received one on port " << i; + exit(1); } + reactor::log::Info() << "- " << i; + } } =} @@ -43,34 +43,34 @@ reactor Consumer { int count = 0; int last = -1; for (int i : in.present_indices_sorted()) { - count++; - if (odd && i%2 == 0) { - reactor::log::Error() << "Expected values only on odd ports, but received one on port " << i; - exit(1); - } - if (!odd && i%2 == 1) { - reactor::log::Error() << "Expected values only on even ports, but received one on port " << i; - exit(1); - } - if (i < last) { - reactor::log::Error() << "Received index out of order! " << i << " after " << last; - exit(1); - } + count++; + if (odd && i%2 == 0) { + reactor::log::Error() << "Expected values only on odd ports, but received one on port " << i; + exit(1); + } + if (!odd && i%2 == 1) { + reactor::log::Error() << "Expected values only on even ports, but received one on port " << i; + exit(1); + } + if (i < last) { + reactor::log::Error() << "Received index out of order! " << i << " after " << last; + exit(1); + } } for (int i : in.present_indices_unsorted()) { - count++; - if (odd && i%2 == 0) { - reactor::log::Error() << "Expected values only on odd ports, but received one on port " << i; - exit(1); - } - if (!odd && i%2 == 1) { - reactor::log::Error() << "Expected values only on even ports, but received one on port " << i; - exit(1); - } + count++; + if (odd && i%2 == 0) { + reactor::log::Error() << "Expected values only on odd ports, but received one on port " << i; + exit(1); + } + if (!odd && i%2 == 1) { + reactor::log::Error() << "Expected values only on even ports, but received one on port " << i; + exit(1); + } } if (count != 10) { - reactor::log::Error() << "Expected count to be 10, but got " << count; - exit(1); + reactor::log::Error() << "Expected count to be 10, but got " << count; + exit(1); } odd = !odd; diff --git a/test/Cpp/src/multiport/WidthGivenByCode.lf b/test/Cpp/src/multiport/WidthGivenByCode.lf index 6bfc814650..5e9ed80eb3 100644 --- a/test/Cpp/src/multiport/WidthGivenByCode.lf +++ b/test/Cpp/src/multiport/WidthGivenByCode.lf @@ -6,32 +6,32 @@ reactor Foo(a: size_t = 8, b: size_t = 2) { reaction(startup) in -> out {= if (in.size() != a*b) { - std::cerr << "ERROR: expected in to have a width of " << a*b << '\n'; - exit(1); + std::cerr << "ERROR: expected in to have a width of " << a*b << '\n'; + exit(1); } if (out.size() != a/b) { - std::cerr << "ERROR: expected out to have a width of " << a/b << '\n'; - exit(2); + std::cerr << "ERROR: expected out to have a width of " << a/b << '\n'; + exit(2); } =} } main reactor { foo1 = new Foo() - foo2 = new Foo(a = 10, b = 3) - foo3 = new Foo(a = 9, b = 9) + foo2 = new Foo(a=10, b=3) + foo3 = new Foo(a=9, b=9) foo_bank = new[{= 42 =}] Foo() reaction(startup) foo_bank.out {= if (foo_bank.size() != 42) { - std::cerr << "ERROR: expected foo_bank to have a width of " << 42 << '\n'; - exit(3); + std::cerr << "ERROR: expected foo_bank to have a width of " << 42 << '\n'; + exit(3); } for (auto& foo : foo_bank) { - if (foo.out.size() != 4) { - std::cerr << "ERROR: expected foo_bank.out to have a width of " << 4 << '\n'; - exit(4); - } + if (foo.out.size() != 4) { + std::cerr << "ERROR: expected foo_bank.out to have a width of " << 4 << '\n'; + exit(4); + } } =} } diff --git a/test/Cpp/src/multiport/WriteInputOfContainedBank.lf b/test/Cpp/src/multiport/WriteInputOfContainedBank.lf index 87258ae953..ea170511a4 100644 --- a/test/Cpp/src/multiport/WriteInputOfContainedBank.lf +++ b/test/Cpp/src/multiport/WriteInputOfContainedBank.lf @@ -9,16 +9,16 @@ reactor Contained(bank_index: size_t = 0) { unsigned result = *in.get(); std::cout << "Instance " << bank_index << " received " << result << '\n'; if (result != bank_index * 42) { - std::cout << "FAILURE: expected " << 42 * bank_index << '\n'; - exit(2); + std::cout << "FAILURE: expected " << 42 * bank_index << '\n'; + exit(2); } count++; =} reaction(shutdown) {= if (count != 1) { - std::cerr << "ERROR: One of the reactions failed to trigger.\n"; - exit(1); + std::cerr << "ERROR: One of the reactions failed to trigger.\n"; + exit(1); } =} } @@ -28,7 +28,7 @@ main reactor { reaction(startup) -> c.in {= for (size_t i = 0; i < c.size(); i++) { - c[i].in.set(i*42); + c[i].in.set(i*42); } =} } diff --git a/test/Cpp/src/multiport/WriteMultiportInputOfContainedBank.lf b/test/Cpp/src/multiport/WriteMultiportInputOfContainedBank.lf index 2bb7c12b9a..7dea69a28d 100644 --- a/test/Cpp/src/multiport/WriteMultiportInputOfContainedBank.lf +++ b/test/Cpp/src/multiport/WriteMultiportInputOfContainedBank.lf @@ -7,20 +7,20 @@ reactor Contained(bank_index: size_t = 0) { reaction(in) {= for (size_t i = 0; i < 3; i++) { - unsigned result = *in[i].get(); - std::cout << "Instance " << bank_index << " received " << result << '\n'; - if (result != bank_index * i) { - std::cout << "FAILURE: expected " << i * bank_index << '\n'; - exit(2); - } + unsigned result = *in[i].get(); + std::cout << "Instance " << bank_index << " received " << result << '\n'; + if (result != bank_index * i) { + std::cout << "FAILURE: expected " << i * bank_index << '\n'; + exit(2); + } } count++; =} reaction(shutdown) {= if (count != 1) { - std::cerr << "ERROR: One of the reactions failed to trigger.\n"; - exit(1); + std::cerr << "ERROR: One of the reactions failed to trigger.\n"; + exit(1); } =} } @@ -30,9 +30,9 @@ main reactor { reaction(startup) -> c.in {= for (size_t i = 0; i < c.size(); i++) { - for (size_t j = 0; j < c[i].in.size(); j++) { - c[i].in[j].set(i*j); - } + for (size_t j = 0; j < c[i].in.size(); j++) { + c[i].in[j].set(i*j); + } } =} } diff --git a/test/Cpp/src/properties/Fast.lf b/test/Cpp/src/properties/Fast.lf index 97e40f05b8..a44d1fb7e5 100644 --- a/test/Cpp/src/properties/Fast.lf +++ b/test/Cpp/src/properties/Fast.lf @@ -12,17 +12,17 @@ main reactor { reaction(a) {= triggered = true; if (get_elapsed_physical_time() >= 2s) { - std::cout << "ERROR: needed more than 2s to process the reaction\n"; - exit(1); + std::cout << "ERROR: needed more than 2s to process the reaction\n"; + exit(1); } =} reaction(shutdown) {= if (triggered) { - std::cout << "SUCCESS!\n"; + std::cout << "SUCCESS!\n"; } else { - std::cout << "ERROR: reaction was not invoked!\n"; - exit(2); + std::cout << "ERROR: reaction was not invoked!\n"; + exit(2); } =} } diff --git a/test/Cpp/src/properties/Timeout.lf b/test/Cpp/src/properties/Timeout.lf index 3fd5982952..a278d6d712 100644 --- a/test/Cpp/src/properties/Timeout.lf +++ b/test/Cpp/src/properties/Timeout.lf @@ -10,22 +10,22 @@ main reactor { reaction(t) {= triggered = true; if (get_elapsed_logical_time() != 1s) { - std::cout << "ERROR: triggered reaction at an unexpected tag"; - exit(1); + std::cout << "ERROR: triggered reaction at an unexpected tag"; + exit(1); } =} reaction(shutdown) {= if (get_elapsed_logical_time() != 1s || get_microstep() != 0) { - std::cout << "ERROR: shutdown invoked at an unexpected tag"; - exit(2); + std::cout << "ERROR: shutdown invoked at an unexpected tag"; + exit(2); } if (triggered) { - std::cout << "SUCCESS!\n"; + std::cout << "SUCCESS!\n"; } else { - std::cout << "ERROR: reaction was not invoked!\n"; - exit(2); + std::cout << "ERROR: reaction was not invoked!\n"; + exit(2); } =} } diff --git a/test/Cpp/src/properties/TimeoutZero.lf b/test/Cpp/src/properties/TimeoutZero.lf index c49db95731..3aa45c7203 100644 --- a/test/Cpp/src/properties/TimeoutZero.lf +++ b/test/Cpp/src/properties/TimeoutZero.lf @@ -10,22 +10,22 @@ main reactor { reaction(t) {= triggered = true; if (get_elapsed_logical_time() != 0s) { - std::cout << "ERROR: triggered reaction at an unexpected tag"; - exit(1); + std::cout << "ERROR: triggered reaction at an unexpected tag"; + exit(1); } =} reaction(shutdown) {= if (get_elapsed_logical_time() != 0s || get_microstep() != 0) { - std::cout << "ERROR: shutdown invoked at an unexpected tag"; - exit(2); + std::cout << "ERROR: shutdown invoked at an unexpected tag"; + exit(2); } if (triggered) { - std::cout << "SUCCESS!\n"; + std::cout << "SUCCESS!\n"; } else { - std::cout << "ERROR: reaction was not invoked!\n"; - exit(2); + std::cout << "ERROR: reaction was not invoked!\n"; + exit(2); } =} } diff --git a/test/Cpp/src/target/AfterVoid.lf b/test/Cpp/src/target/AfterVoid.lf index dbb0041a3e..5b208b4008 100644 --- a/test/Cpp/src/target/AfterVoid.lf +++ b/test/Cpp/src/target/AfterVoid.lf @@ -22,16 +22,16 @@ reactor print { std::cout << "Current logical time is: " << elapsed_time << '\n'; std::cout << "Current physical time is: " << get_elapsed_physical_time() << '\n'; if (elapsed_time != expected_time) { - std::cerr << "ERROR: Expected logical time to be " << expected_time << '\n'; - exit(2); + std::cerr << "ERROR: Expected logical time to be " << expected_time << '\n'; + exit(2); } expected_time += 1s; =} reaction(shutdown) {= if (i == 0) { - std::cerr << "ERROR: Final reactor received no data.\n"; - exit(3); + std::cerr << "ERROR: Final reactor received no data.\n"; + exit(3); } =} } diff --git a/test/Cpp/src/target/BraceAndParenInitialization.lf b/test/Cpp/src/target/BraceAndParenInitialization.lf index e6ab2168f3..59818d4bd0 100644 --- a/test/Cpp/src/target/BraceAndParenInitialization.lf +++ b/test/Cpp/src/target/BraceAndParenInitialization.lf @@ -1,24 +1,24 @@ target Cpp reactor Foo( - param_list_1: std::vector(4, 2), // list containing [2,2,2,2] - param_list_2: std::vector{4, 2}, // list containing [4,2] - param_list_3: std::vector(4, 2), // list containing [2,2,2,2] - param_list_4: std::vector{4, 2} // list containing [4,2] -) { + param_list_1: std::vector(4, 2), // list containing [2,2,2,2] + param_list_2: std::vector{4, 2}, // list containing [4,2] + param_list_3: std::vector(4, 2), // list containing [2,2,2,2] + // list containing [4,2] + param_list_4: std::vector{4, 2}) { state state_list_1: std::vector(6, 42) // list containing [42,42,42,42,42,42] state state_list_2: std::vector{6, 42} // list containing [6,42] reaction(startup) {= std::cerr << "Hello!\n"; if (param_list_1.size() != 4 || param_list_1[0] != 2 || - param_list_2.size() != 2 || param_list_2[0] != 4 || - param_list_3.size() != 3 || param_list_3[0] != 5 || - param_list_4.size() != 2 || param_list_4[0] != 3 || - state_list_1.size() != 6 || state_list_1[0] != 42 || - state_list_2.size() != 2 || state_list_2[0] != 6) { - std::cerr << "Error!\n"; - exit(1); + param_list_2.size() != 2 || param_list_2[0] != 4 || + param_list_3.size() != 3 || param_list_3[0] != 5 || + param_list_4.size() != 2 || param_list_4[0] != 3 || + state_list_1.size() != 6 || state_list_1[0] != 42 || + state_list_2.size() != 2 || state_list_2[0] != 6) { + std::cerr << "Error!\n"; + exit(1); } =} } diff --git a/test/Cpp/src/target/CMakeInclude.lf b/test/Cpp/src/target/CMakeInclude.lf index 1291e56425..2527966dc6 100644 --- a/test/Cpp/src/target/CMakeInclude.lf +++ b/test/Cpp/src/target/CMakeInclude.lf @@ -3,9 +3,8 @@ */ target Cpp { cmake-include: [ - "../include/mlib-cmake-extension.cmake", - "../include/bar-cmake-compile-definition.txt" - ], + "../include/mlib-cmake-extension.cmake", + "../include/bar-cmake-compile-definition.txt"], timeout: 0 sec } diff --git a/test/Cpp/src/target/CliParserGenericArguments.lf b/test/Cpp/src/target/CliParserGenericArguments.lf index 4ab5729088..8028776e07 100644 --- a/test/Cpp/src/target/CliParserGenericArguments.lf +++ b/test/Cpp/src/target/CliParserGenericArguments.lf @@ -7,7 +7,7 @@ target Cpp public preamble {= using unsigned_long = unsigned long; - using long_long = long long; + using long_long = long long; using uns_long_long = unsigned long long; using long_double = long double; @@ -15,12 +15,12 @@ public preamble {= #include using namespace std; class CustomClass { - public: - std::string name; - CustomClass(std::string new_name="John") : name{new_name} - {} - std::string get_name() const {return this->name;} - void set_name(std::string updated_name){this->name = updated_name;} + public: + std::string name; + CustomClass(std::string new_name="John") : name{new_name} + {} + std::string get_name() const {return this->name;} + void set_name(std::string updated_name){this->name = updated_name;} }; ostream& operator<<(ostream& os, const CustomClass& cc); @@ -31,32 +31,31 @@ public preamble {= private preamble {= stringstream& operator>>(stringstream& in, CustomClass& cc) { - cc.set_name(in.str()); - return in; + cc.set_name(in.str()); + return in; } ostream& operator<<(ostream& os, const CustomClass& cc) { - os << cc.get_name(); - return os; + os << cc.get_name(); + return os; } =} main reactor CliParserGenericArguments( - int_value: int = 10, - signed_value: signed = -10, - unsigned_value: unsigned = 11, - long_value: long = -100, - unsigned_long_value: {= unsigned_long =} = 42, - long_long_value: {= long_long =} = -42, - ull_value: {= uns_long_long =} = 42, - bool_value: bool = false, - char_value: char = 'T', - double_value: double = 4.2, - long_double_value: {= long_double =} = 4.2, - float_value: float = 10.5, - string_value: string = "This is a testvalue", - custom_class_value: {= CustomClass =}("Peter") -) { + int_value: int = 10, + signed_value: signed = -10, + unsigned_value: unsigned = 11, + long_value: long = -100, + unsigned_long_value: {= unsigned_long =} = 42, + long_long_value: {= long_long =} = -42, + ull_value: {= uns_long_long =} = 42, + bool_value: bool = false, + char_value: char = 'T', + double_value: double = 4.2, + long_double_value: {= long_double =} = 4.2, + float_value: float = 10.5, + string_value: string = "This is a testvalue", + custom_class_value: {= CustomClass =}("Peter")) { reaction(startup) {= std::cout << "Hello World!\n"; =} } diff --git a/test/Cpp/src/target/CombinedTypeNames.lf b/test/Cpp/src/target/CombinedTypeNames.lf index e4ae72cfcd..f64116eb4a 100644 --- a/test/Cpp/src/target/CombinedTypeNames.lf +++ b/test/Cpp/src/target/CombinedTypeNames.lf @@ -8,12 +8,12 @@ reactor Foo(bar: {= unsigned int =} = 0, baz: {= const unsigned int* =} = {= nul reaction(startup) {= if (bar != 42 || s_bar != 42 || *baz != 42 || *s_baz != 42) { - reactor::log::Error() << "Unexpected value!"; - exit(1); - } + reactor::log::Error() << "Unexpected value!"; + exit(1); + } =} } main reactor(bar: {= unsigned int =} = 42) { - foo = new Foo(bar = bar, baz = {= &bar =}) + foo = new Foo(bar=bar, baz = {= &bar =}) } diff --git a/test/Cpp/src/target/GenericParameterAndState.lf b/test/Cpp/src/target/GenericParameterAndState.lf index 76cb2f9c3d..0ad99fd4ca 100644 --- a/test/Cpp/src/target/GenericParameterAndState.lf +++ b/test/Cpp/src/target/GenericParameterAndState.lf @@ -16,6 +16,6 @@ reactor Foo(bar: T = 0, expected: T = 14542135) { } main reactor { - foo = new Foo(bar = 42, expected = 42) - bar = new Foo(expected = 0) // default value is used + foo = new Foo(bar=42, expected=42) + bar = new Foo(expected=0) // default value is used } diff --git a/test/Cpp/src/target/InitializerSyntax.lf b/test/Cpp/src/target/InitializerSyntax.lf index 998c711f1f..fdc57d1f36 100644 --- a/test/Cpp/src/target/InitializerSyntax.lf +++ b/test/Cpp/src/target/InitializerSyntax.lf @@ -3,48 +3,48 @@ target Cpp public preamble {= #include struct TestType { - int x; + int x; - // constructor #1 - TestType() : x(42) {} - // constructor #2 - TestType(int x) : x(x) {} - // constructor #3 - TestType(std::initializer_list l) : x(l.size()) {} - // constructor #4 - TestType(const TestType& t) : x(t.x + 10) { } - // constructor #5 - TestType(TestType&& t) : x(t.x + 20) { } + // constructor #1 + TestType() : x(42) {} + // constructor #2 + TestType(int x) : x(x) {} + // constructor #3 + TestType(std::initializer_list l) : x(l.size()) {} + // constructor #4 + TestType(const TestType& t) : x(t.x + 10) { } + // constructor #5 + TestType(TestType&& t) : x(t.x + 20) { } - TestType& operator=(const TestType& t) { - std::cout << "assign\n"; - this->x = t.x + 30; - return *this; - } - TestType& operator=(TestType&& t) { - this->x = t.x + 40; - return *this; - } + TestType& operator=(const TestType& t) { + std::cout << "assign\n"; + this->x = t.x + 30; + return *this; + } + TestType& operator=(TestType&& t) { + this->x = t.x + 40; + return *this; + } - ~TestType() = default; + ~TestType() = default; }; =} reactor TestReactor( - /** - * FIXME: should work without an explicit initialization, see - * https://github.com/lf-lang/lingua-franca/issues/623 - */ - // p_default: TestType, constructor #1 - p_default: TestType(), - p_empty: TestType(), // constructor #1 - p_value: TestType(24), // constructor #2 - p_init_empty: TestType{}, // constructor #1 - p_init_empty2: TestType({}), // constructor #1 - p_init_some: TestType{2, 6, 6, 3, 1}, // constructor #1 - p_assign_init_empty: TestType = {}, // constructor #1 - p_assign_init_some: TestType = {4, 2, 1} // constructor #3 -) { + /** + * FIXME: should work without an explicit initialization, see + * https://github.com/lf-lang/lingua-franca/issues/623 + */ + // p_default: TestType, constructor #1 + p_default: TestType(), + p_empty: TestType(), // constructor #1 + p_value: TestType(24), // constructor #2 + p_init_empty: TestType{}, // constructor #1 + p_init_empty2: TestType({}), // constructor #1 + p_init_some: TestType{2, 6, 6, 3, 1}, // constructor #1 + p_assign_init_empty: TestType = {}, // constructor #1 + // constructor #3 + p_assign_init_some: TestType = {4, 2, 1}) { state s_default: TestType // constructor #1 state s_empty: TestType() // constructor #1 state s_value: TestType(24) // constructor #2 diff --git a/test/Cpp/src/target/MultipleContainedGeneric.lf b/test/Cpp/src/target/MultipleContainedGeneric.lf index 5a767dc3c1..da4e28081c 100644 --- a/test/Cpp/src/target/MultipleContainedGeneric.lf +++ b/test/Cpp/src/target/MultipleContainedGeneric.lf @@ -11,16 +11,16 @@ reactor Contained { reaction(in1) {= std::cout << "in1 received " << *in1.get() << '\n'; if (*in1.get() != 42) { - std::cerr << "FAILED: Expected 42.\n"; - exit(1); + std::cerr << "FAILED: Expected 42.\n"; + exit(1); } =} reaction(in2) {= std::cout << "in2 received " << *in2.get() << '\n'; if (*in2.get() != 42) { - std::cerr << "FAILED: Expected 42.\n"; - exit(1); + std::cerr << "FAILED: Expected 42.\n"; + exit(1); } =} } diff --git a/test/Cpp/src/target/PointerParameters.lf b/test/Cpp/src/target/PointerParameters.lf index 2de286aaa4..007fb1a816 100644 --- a/test/Cpp/src/target/PointerParameters.lf +++ b/test/Cpp/src/target/PointerParameters.lf @@ -5,8 +5,8 @@ target Cpp reactor Foo(ptr: int* = {= nullptr =}) { reaction(startup) {= if (ptr == nullptr || *ptr != 42) { - reactor::log::Error() << "received an unexpected value!"; - exit(1); + reactor::log::Error() << "received an unexpected value!"; + exit(1); } =} } diff --git a/test/Cpp/src/target/PreambleFile.lf b/test/Cpp/src/target/PreambleFile.lf index 53f6ff49da..93678481cc 100644 --- a/test/Cpp/src/target/PreambleFile.lf +++ b/test/Cpp/src/target/PreambleFile.lf @@ -4,8 +4,8 @@ target Cpp // header. This goes to PreampleFile/preamble.hh. public preamble {= struct MyStruct { - int foo; - std::string bar; + int foo; + std::string bar; }; int add_42(int i); @@ -15,7 +15,7 @@ public preamble {= // be defined once, this needs to go to a source file. This goes to PreampleFile/preamble.cc. private preamble {= int add_42(int i) { - return i + 42; + return i + 42; } =} @@ -33,7 +33,7 @@ reactor Print { // interface. This goes to PreambleFile/Print.cc private preamble {= void print(const MyStruct& x) { - std::cout << "Received " << x.foo << " and '" << x.bar << "'\n"; + std::cout << "Received " << x.foo << " and '" << x.bar << "'\n"; } =} input x: MyStruct diff --git a/test/Python/src/ActionDelay.lf b/test/Python/src/ActionDelay.lf index ba46edf9c4..0c063f6f1d 100644 --- a/test/Python/src/ActionDelay.lf +++ b/test/Python/src/ActionDelay.lf @@ -30,10 +30,10 @@ reactor Sink { physical = lf.time.physical() print("Logical, physical, and elapsed logical: ", logical, physical, elapsed_logical) if elapsed_logical != MSEC(100): - sys.stderr.write("FAILURE: Expected " + str(MSEC(100)) + " but got " + str(elapsed_logical) + ".\n") - exit(1) + sys.stderr.write("FAILURE: Expected " + str(MSEC(100)) + " but got " + str(elapsed_logical) + ".\n") + exit(1) else: - print("SUCCESS. Elapsed logical time is 100 msec.\n") + print("SUCCESS. Elapsed logical time is 100 msec.\n") =} } diff --git a/test/Python/src/ActionIsPresent.lf b/test/Python/src/ActionIsPresent.lf index 3bdd419700..b23328f1a8 100644 --- a/test/Python/src/ActionIsPresent.lf +++ b/test/Python/src/ActionIsPresent.lf @@ -9,21 +9,21 @@ main reactor ActionIsPresent(offset = 1 nsec, period = 500 msec) { reaction(startup, a) -> a {= # The is_present field should be initially False if a.is_present is not True: - if self.offset == 0: - print("Hello World!") - self.success = True - else: - a.schedule(self.offset) - self.first_time = False + if self.offset == 0: + print("Hello World!") + self.success = True + else: + a.schedule(self.offset) + self.first_time = False else: - print("Hello World 2!") - if self.first_time is not True: - self.success = True + print("Hello World 2!") + if self.first_time is not True: + self.success = True =} reaction(shutdown) {= if self.success is not True: - sys.stderr.write("Failed to print 'Hello World'\n") - exit(1) + sys.stderr.write("Failed to print 'Hello World'\n") + exit(1) =} } diff --git a/test/Python/src/After.lf b/test/Python/src/After.lf index d1f720ddfa..765f9ef990 100644 --- a/test/Python/src/After.lf +++ b/test/Python/src/After.lf @@ -21,21 +21,21 @@ reactor print { elapsed_time = lf.time.logical_elapsed() print("Result is " + str(x.value)) if x.value != 84: - sys.stderr.write("ERROR: Expected result to be 84.\n") - exit(1) + sys.stderr.write("ERROR: Expected result to be 84.\n") + exit(1) print("Current logical time is: " + str(elapsed_time)) print("Current physical time is: " + str(lf.time.physical_elapsed())) if elapsed_time != self.expected_time: - sys.stderr.write("ERROR: Expected logical time to be " + self.expected_time) - exit(2) + sys.stderr.write("ERROR: Expected logical time to be " + self.expected_time) + exit(2) self.expected_time += SEC(1) =} reaction(shutdown) {= if (self.received == 0): - sys.stderr.write("ERROR: Final reactor received no data.\n") - exit(3) + sys.stderr.write("ERROR: Final reactor received no data.\n") + exit(3) =} } diff --git a/test/Python/src/AfterCycles.lf b/test/Python/src/AfterCycles.lf index 38ee982c6e..4aa2ed0d39 100644 --- a/test/Python/src/AfterCycles.lf +++ b/test/Python/src/AfterCycles.lf @@ -29,12 +29,12 @@ main reactor AfterCycles { elapsed_time = lf.time.logical_elapsed() print("Received {:d} from worker 0 at time {:d}.".format(w0.out.value, elapsed_time)) if elapsed_time != MSEC(10): - sys.stderr.write("Time should have been 10000000.\n") - exit(1) + sys.stderr.write("Time should have been 10000000.\n") + exit(1) if w0.out.value != 1: - sys.stderr.write("Value should have been 1.\n") - exit(4) + sys.stderr.write("Value should have been 1.\n") + exit(4) =} reaction(w1.out) {= @@ -42,17 +42,17 @@ main reactor AfterCycles { elapsed_time = lf.time.logical_elapsed() print("Received {:d} from worker 1 at time {:d}.".format(w1.out.value, elapsed_time)) if elapsed_time != MSEC(20): - sys.stderr.write("Time should have been 20000000.\n") - exit(3) + sys.stderr.write("Time should have been 20000000.\n") + exit(3) if w1.out.value != 1: - sys.stderr.write("Value should have been 1.\n") - exit(4) + sys.stderr.write("Value should have been 1.\n") + exit(4) =} reaction(shutdown) {= if self.count != 2: - sys.stderr.write("Top-level reactions should have been triggered but were not.\n") - exit(5) + sys.stderr.write("Top-level reactions should have been triggered but were not.\n") + exit(5) =} } diff --git a/test/Python/src/AfterOverlapped.lf b/test/Python/src/AfterOverlapped.lf index ec090046f4..f84a877e5c 100644 --- a/test/Python/src/AfterOverlapped.lf +++ b/test/Python/src/AfterOverlapped.lf @@ -16,21 +16,21 @@ reactor Test { print(f"Received {c.value}.") self.i += 1 if c.value != self.i: - sys.stderr.write("ERROR: Expected {:d} but got {:d}\n.".format(self.i, c.value)); - exit(1) + sys.stderr.write("ERROR: Expected {:d} but got {:d}\n.".format(self.i, c.value)); + exit(1) elapsed_time = lf.time.logical_elapsed() print("Current logical time is: ", elapsed_time) expected_logical_time = SEC(2) + SEC(1)*(c.value - 1) if elapsed_time != expected_logical_time: - sys.stderr.write("ERROR: Expected logical time to be {:d} but got {:d}\n.".format(expected_logical_time, elapsed_time)) - exit(1) + sys.stderr.write("ERROR: Expected logical time to be {:d} but got {:d}\n.".format(expected_logical_time, elapsed_time)) + exit(1) =} reaction(shutdown) {= if self.received == 0: - sys.stderr.write("ERROR: Final reactor received no data.\n") - exit(3) + sys.stderr.write("ERROR: Final reactor received no data.\n") + exit(3) =} } diff --git a/test/Python/src/ArrayAsParameter.lf b/test/Python/src/ArrayAsParameter.lf index ad5fe3c15e..b794008a7c 100644 --- a/test/Python/src/ArrayAsParameter.lf +++ b/test/Python/src/ArrayAsParameter.lf @@ -10,7 +10,7 @@ reactor Source(sequence(0, 1, 2)) { out.set(self.sequence[self.count]) self.count+=1 if self.count < len(self.sequence): - next.schedule(0) + next.schedule(0) =} } @@ -23,15 +23,15 @@ reactor Print { self.received+=1 print("Received: {:d}\n".format(_in.value)) if _in.value != self.count: - sys.stderr.write("ERROR: Expected {:d}.\n".format(self.count)) - exit(1) + sys.stderr.write("ERROR: Expected {:d}.\n".format(self.count)) + exit(1) self.count+=1 =} reaction(shutdown) {= if self.received == 0: - sys.stderr.write("ERROR: Final reactor received no data.\n") - exit(3) + sys.stderr.write("ERROR: Final reactor received no data.\n") + exit(3) =} } diff --git a/test/Python/src/ArrayAsType.lf b/test/Python/src/ArrayAsType.lf index 554293a623..4a050785a3 100644 --- a/test/Python/src/ArrayAsType.lf +++ b/test/Python/src/ArrayAsType.lf @@ -12,14 +12,14 @@ reactor Source { } # The scale parameter is just for testing. -reactor Print(scale = 1) { +reactor Print(scale=1) { input _in reaction(_in) {= print("Received: [%s]" % ", ".join(map(str, _in.value))) if _in.value != (0, 2.8, "hello"): - sys.stderr.write("ERROR: Value received by Print does not match expectation!\n") - exit(1) + sys.stderr.write("ERROR: Value received by Print does not match expectation!\n") + exit(1) =} } diff --git a/test/Python/src/ArrayFree.lf b/test/Python/src/ArrayFree.lf index 24f9b4b754..9c13409b82 100644 --- a/test/Python/src/ArrayFree.lf +++ b/test/Python/src/ArrayFree.lf @@ -7,12 +7,12 @@ target Python import Source, Print from "ArrayPrint.lf" import Scale from "ArrayScale.lf" -reactor Free(scale = 2) { +reactor Free(scale=2) { mutable input _in reaction(_in) {= for i in range(len(_in.value)): - _in.value[i] *= self.scale + _in.value[i] *= self.scale =} } @@ -20,7 +20,7 @@ main reactor ArrayFree { s = new Source() c = new Free() c2 = new Scale() - p = new Print(scale = 2) + p = new Print(scale=2) s.out -> c._in s.out -> c2._in c2.out -> p._in diff --git a/test/Python/src/ArrayParallel.lf b/test/Python/src/ArrayParallel.lf index 1316f14ee5..915adf6cf6 100644 --- a/test/Python/src/ArrayParallel.lf +++ b/test/Python/src/ArrayParallel.lf @@ -9,9 +9,9 @@ import Source, Print from "ArrayPrint.lf" main reactor ArrayParallel { s = new Source() c1 = new Scale() - c2 = new Scale(scale = 3) - p1 = new Print(scale = 2) - p2 = new Print(scale = 3) + c2 = new Scale(scale=3) + p1 = new Print(scale=2) + p2 = new Print(scale=3) s.out -> c1._in s.out -> c2._in c1.out -> p1._in diff --git a/test/Python/src/ArrayPrint.lf b/test/Python/src/ArrayPrint.lf index 3d77584d1d..e2df8f0db2 100644 --- a/test/Python/src/ArrayPrint.lf +++ b/test/Python/src/ArrayPrint.lf @@ -12,14 +12,14 @@ reactor Source { } # The scale parameter is just for testing. -reactor Print(scale = 1) { +reactor Print(scale=1) { input _in reaction(_in) {= print("Received: [%s]" % ", ".join(map(str, _in.value))) if _in.value != [x * self.scale for x in [0, 1, 2]]: - sys.stderr.write("ERROR: Value received by Print does not match expectation!\n") - exit(1) + sys.stderr.write("ERROR: Value received by Print does not match expectation!\n") + exit(1) =} } diff --git a/test/Python/src/ArrayScale.lf b/test/Python/src/ArrayScale.lf index a174053b2c..5c5b76a979 100644 --- a/test/Python/src/ArrayScale.lf +++ b/test/Python/src/ArrayScale.lf @@ -5,13 +5,13 @@ target Python import Print, Source from "ArrayPrint.lf" -reactor Scale(scale = 2) { +reactor Scale(scale=2) { mutable input _in output out reaction(_in) -> out {= for i in range(len(_in.value)): - _in.value[i] *= self.scale + _in.value[i] *= self.scale out.set(_in.value) =} } @@ -19,7 +19,7 @@ reactor Scale(scale = 2) { main reactor ArrayScale { s = new Source() c = new Scale() - p = new Print(scale = 2) + p = new Print(scale=2) s.out -> c._in c.out -> p._in } diff --git a/test/Python/src/CompareTags.lf b/test/Python/src/CompareTags.lf index 462d57864e..38366d2742 100644 --- a/test/Python/src/CompareTags.lf +++ b/test/Python/src/CompareTags.lf @@ -13,8 +13,8 @@ main reactor CompareTags { tag1 = lf.tag() tag2 = lf.tag() if (lf.tag_compare(tag1, tag2) != 0 or not tag1 == tag2 or tag1 != tag2): - self.sys.stderr.write("Tags should be equal\n") - self.sys.exit(1) + self.sys.stderr.write("Tags should be equal\n") + self.sys.exit(1) l.schedule(0, tag1) =} @@ -22,10 +22,10 @@ main reactor CompareTags { tag3 = lf.tag() tag1 = l.value if (lf.tag_compare(tag1, tag3) != -1 or not tag1 < tag3 or tag1 >= tag3): - self.sys.stderr.write("tag1 should be lesser than tag3\n") - self.sys.exit(1) + self.sys.stderr.write("tag1 should be lesser than tag3\n") + self.sys.exit(1) if (lf.tag_compare(tag3, tag1) != 1 or not tag3 > tag1 or tag3 <= tag1): - self.sys.stderr.write("tag3 should be greater than tag1\n") - self.sys.exit(1) + self.sys.stderr.write("tag3 should be greater than tag1\n") + self.sys.exit(1) =} } diff --git a/test/Python/src/Composition.lf b/test/Python/src/Composition.lf index d4b36c0a76..d0623cd1d8 100644 --- a/test/Python/src/Composition.lf +++ b/test/Python/src/Composition.lf @@ -25,13 +25,13 @@ reactor Test { self.count += 1 print("Recieved " + str(x.value)) if (x.value != self.count): - sys.stderr.write("FAILURE: Expected " + str(self.count) + "\n") - exit(1) + sys.stderr.write("FAILURE: Expected " + str(self.count) + "\n") + exit(1) =} reaction(shutdown) {= if(self.count == 0): - sys.stderr.write("FAILURE: No data received.\n") + sys.stderr.write("FAILURE: No data received.\n") =} } diff --git a/test/Python/src/CompositionAfter.lf b/test/Python/src/CompositionAfter.lf index 49b2f0012a..8a57038467 100644 --- a/test/Python/src/CompositionAfter.lf +++ b/test/Python/src/CompositionAfter.lf @@ -23,8 +23,8 @@ reactor Test { self.count += 1 print("Received ", x.value) if x.value != self.count: - sys.stderr.write("FAILURE: Expected %d\n", self.count) - exit(1) + sys.stderr.write("FAILURE: Expected %d\n", self.count) + exit(1) =} } diff --git a/test/Python/src/CompositionGain.lf b/test/Python/src/CompositionGain.lf index e3630f3169..067d662bdf 100644 --- a/test/Python/src/CompositionGain.lf +++ b/test/Python/src/CompositionGain.lf @@ -27,7 +27,7 @@ main reactor { reaction(wrapper.y) {= print("Received " + str(wrapper_y.value)) if (wrapper_y.value != 42 * 2): - sys.stderr.write("ERROR: Received value should have been ", str(42 * 2)) - exit(2) + sys.stderr.write("ERROR: Received value should have been ", str(42 * 2)) + exit(2) =} } diff --git a/test/Python/src/CompositionInheritance.lf b/test/Python/src/CompositionInheritance.lf index 8765192cc7..65abaf1059 100644 --- a/test/Python/src/CompositionInheritance.lf +++ b/test/Python/src/CompositionInheritance.lf @@ -35,13 +35,13 @@ reactor Test { self.count += 1 print("Received ", x.value) if x.value != self.count: - sys.stderr.write("FAILURE: Expected %d\n", self.count) - exit(1) + sys.stderr.write("FAILURE: Expected %d\n", self.count) + exit(1) =} reaction(shutdown) {= if self.count == 0: - sys.stderr.write("FAILURE: No data received.\n") + sys.stderr.write("FAILURE: No data received.\n") =} } diff --git a/test/Python/src/CountSelf.lf b/test/Python/src/CountSelf.lf index 8fe1d4915b..c7d49f4c1b 100644 --- a/test/Python/src/CountSelf.lf +++ b/test/Python/src/CountSelf.lf @@ -26,8 +26,8 @@ reactor Test { reaction(_in) {= print("Received: {:d}".format(_in.value)) if _in.value != self.count: - sys.stderr.write("ERROR: Expected {:d}.\n".format(self.count)) - exit(1) + sys.stderr.write("ERROR: Expected {:d}.\n".format(self.count)) + exit(1) self.count+=1 =} diff --git a/test/Python/src/CountTest.lf b/test/Python/src/CountTest.lf index 6e178cbcb0..076b83f1c0 100644 --- a/test/Python/src/CountTest.lf +++ b/test/Python/src/CountTest.lf @@ -13,14 +13,14 @@ reactor Test { print("Received ", c.value) self.i +=1 if c.value != self.i: - sys.stderr.write("ERROR: Expected {:d} but got {:d}\n.".format(self.i, c.value)) - exit(1) + sys.stderr.write("ERROR: Expected {:d} but got {:d}\n.".format(self.i, c.value)) + exit(1) =} reaction(shutdown) {= if self.i != 4: - sys.stderr.write("ERROR: Test should have reacted 4 times, but reacted {:d} times.\n".format(self.i)) - exit(2) + sys.stderr.write("ERROR: Test should have reacted 4 times, but reacted {:d} times.\n".format(self.i)) + exit(2) =} } diff --git a/test/Python/src/Deadline.lf b/test/Python/src/Deadline.lf index 1104c80e86..7dfde79a35 100644 --- a/test/Python/src/Deadline.lf +++ b/test/Python/src/Deadline.lf @@ -13,9 +13,9 @@ reactor Source(period = 3 sec) { reaction(t) -> y {= if self.count % 2 != 0: - # The count variable is odd. - # Take time to cause a deadline violation. - time.sleep(1.5) + # The count variable is odd. + # Take time to cause a deadline violation. + time.sleep(1.5) print("Source sends: ", self.count) y.set(self.count) @@ -30,17 +30,17 @@ reactor Destination(timeout = 1 sec) { reaction(x) {= print("Destination receives: ", x.value) if self.count % 2 != 0: - # The count variable is odd, so the deadline should have been violated. - sys.stderr.write("ERROR: Failed to detect deadline.\n") - exit(1) + # The count variable is odd, so the deadline should have been violated. + sys.stderr.write("ERROR: Failed to detect deadline.\n") + exit(1) self.count += 1 =} deadline(timeout) {= print("Destination deadline handler receives: ", x.value) if self.count % 2 == 0: - # The count variable is even, so the deadline should not have been violated. - sys.stderr.write("ERROR: Deadline miss handler invoked without deadline violation.\n") - exit(2) + # The count variable is even, so the deadline should not have been violated. + sys.stderr.write("ERROR: Deadline miss handler invoked without deadline violation.\n") + exit(2) self.count += 1 =} } diff --git a/test/Python/src/DeadlineHandledAbove.lf b/test/Python/src/DeadlineHandledAbove.lf index 575b9df49e..80a5f847f6 100644 --- a/test/Python/src/DeadlineHandledAbove.lf +++ b/test/Python/src/DeadlineHandledAbove.lf @@ -28,15 +28,15 @@ main reactor DeadlineHandledAbove { reaction(d.deadline_violation) {= if d.deadline_violation.value is True: - print("Output successfully produced by deadline miss handler.") - self.violation_detected = True + print("Output successfully produced by deadline miss handler.") + self.violation_detected = True =} reaction(shutdown) {= if self.violation_detected is True: - print("SUCCESS. Test passes.") + print("SUCCESS. Test passes.") else: - sys.stderr.write("FAILURE. Container did not react to deadline violation.\n") - exit(2) + sys.stderr.write("FAILURE. Container did not react to deadline violation.\n") + exit(2) =} } diff --git a/test/Python/src/DelayArray.lf b/test/Python/src/DelayArray.lf index fd2c113c0f..aa7e66cb6e 100644 --- a/test/Python/src/DelayArray.lf +++ b/test/Python/src/DelayArray.lf @@ -25,14 +25,14 @@ reactor Source { } # The scale parameter is just for testing. -reactor Print(scale = 1) { +reactor Print(scale=1) { input _in reaction(_in) {= print("Received: [%s]" % ", ".join(map(str, _in.value))) if _in.value != [x * self.scale for x in [0, 1, 2]]: - sys.stderr.write("ERROR: Value received by Print does not match expectation!\n") - exit(1) + sys.stderr.write("ERROR: Value received by Print does not match expectation!\n") + exit(1) =} } diff --git a/test/Python/src/DelayArrayWithAfter.lf b/test/Python/src/DelayArrayWithAfter.lf index a13dbe1c2d..2437915978 100644 --- a/test/Python/src/DelayArrayWithAfter.lf +++ b/test/Python/src/DelayArrayWithAfter.lf @@ -18,7 +18,7 @@ reactor Source { } # The scale parameter is just for testing. -reactor Print(scale = 1) { +reactor Print(scale=1) { input _in state iteration = 1 state inputs_received = 0 @@ -29,19 +29,19 @@ reactor Print(scale = 1) { print("At time {:d}, received list ".format(lf.time.logical_elapsed()), _in.value) print("Received: [%s]" % ", ".join(map(str, _in.value))) if _in.value != [(x * self.scale * self.iteration) for x in [1, 2, 3]]: - sys.stderr.write("ERROR: Value received by Print does not match expectation!\n") - exit(1) + sys.stderr.write("ERROR: Value received by Print does not match expectation!\n") + exit(1) if len(_in.value) != 3: - sys.stderr.write("ERROR: Received list length is not 3!\n") - exit(2) + sys.stderr.write("ERROR: Received list length is not 3!\n") + exit(2) self.iteration += 1 =} reaction(shutdown) {= if self.inputs_received == 0: - sys.stderr.write("ERROR: Print reactor received no inputs.\n") - exit(3) + sys.stderr.write("ERROR: Print reactor received no inputs.\n") + exit(3) =} } diff --git a/test/Python/src/DelayInt.lf b/test/Python/src/DelayInt.lf index 52d78dd47e..0432a5c18a 100644 --- a/test/Python/src/DelayInt.lf +++ b/test/Python/src/DelayInt.lf @@ -8,7 +8,7 @@ reactor Delay(delay = 100 msec) { reaction(a) -> out {= if (a.value is not None) and a.is_present: - out.set(a.value) + out.set(a.value) =} reaction(_in) -> a {= a.schedule(self.delay, _in.value) =} @@ -32,18 +32,18 @@ reactor Test { elapsed = current_time - self.start_time print("After {:d} nsec of logical time.\n".format(elapsed)) if elapsed != 100000000: - sys.stderr.write("ERROR: Expected elapsed time to be 100000000. It was {:d}.\n".format(elapsed)) - exit(1) + sys.stderr.write("ERROR: Expected elapsed time to be 100000000. It was {:d}.\n".format(elapsed)) + exit(1) if _in.value != 42: - sys.stderr.write("ERROR: Expected input value to be 42. It was {:d}.\n".format(_in.value)) - exit(2) + sys.stderr.write("ERROR: Expected input value to be 42. It was {:d}.\n".format(_in.value)) + exit(2) =} reaction(shutdown) {= print("Checking that communication occurred.") if self.received_value is not True: - sys.stderr.write("ERROR: No communication occurred!\n") - exit(3) + sys.stderr.write("ERROR: No communication occurred!\n") + exit(3) =} } diff --git a/test/Python/src/DelayString.lf b/test/Python/src/DelayString.lf index e5462b60e8..1faf80e31f 100644 --- a/test/Python/src/DelayString.lf +++ b/test/Python/src/DelayString.lf @@ -21,11 +21,11 @@ reactor Test { elapsed = lf.time.logical_elapsed() print("After {:d} nsec of logical time.\n".format(elapsed)) if elapsed != 100000000: - sys.stderr.write("ERROR: Expected elapsed time to be 100000000. It was {:d}.\n".format(elapsed)) - exit(1) + sys.stderr.write("ERROR: Expected elapsed time to be 100000000. It was {:d}.\n".format(elapsed)) + exit(1) if _in.value != "Hello": - sys.stderr.write("ERROR: Expected input value to be 'Hello'. It was '{:s}'.\n".format(_in.value)) - exit(2) + sys.stderr.write("ERROR: Expected input value to be 'Hello'. It was '{:s}'.\n".format(_in.value)) + exit(2) =} } diff --git a/test/Python/src/DelayStruct.lf b/test/Python/src/DelayStruct.lf index d02f43ce58..dcf1a8be7c 100644 --- a/test/Python/src/DelayStruct.lf +++ b/test/Python/src/DelayStruct.lf @@ -26,14 +26,14 @@ reactor Source { } # expected parameter is for testing. -reactor Print(expected = 42) { +reactor Print(expected=42) { input _in reaction(_in) {= print("Received: name = {:s}, value = {:d}".format(_in.value.name, _in.value.value)) if _in.value.value != self.expected: - sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(self.expected)) - exit(1) + sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(self.expected)) + exit(1) =} } diff --git a/test/Python/src/DelayStructWithAfter.lf b/test/Python/src/DelayStructWithAfter.lf index 4ea5827157..c6f27a0775 100644 --- a/test/Python/src/DelayStructWithAfter.lf +++ b/test/Python/src/DelayStructWithAfter.lf @@ -12,14 +12,14 @@ reactor Source { } # expected parameter is for testing. -reactor Print(expected = 42) { +reactor Print(expected=42) { input _in reaction(_in) {= print("Received: name = {:s}, value = {:d}".format(_in.value.name, _in.value.value)) if _in.value.value != self.expected: - sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(self.expected)) - exit(1) + sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(self.expected)) + exit(1) =} } diff --git a/test/Python/src/DelayStructWithAfterOverlapped.lf b/test/Python/src/DelayStructWithAfterOverlapped.lf index 1137efeb22..73fd60c504 100644 --- a/test/Python/src/DelayStructWithAfterOverlapped.lf +++ b/test/Python/src/DelayStructWithAfterOverlapped.lf @@ -27,14 +27,14 @@ reactor Print { self.s += 1 print("Received: name = {:s}, value = {:d}".format(_in.value.name, _in.value.value)) if _in.value.value != 42 * self.s: - sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(42 * self.s)) - exit(1) + sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(42 * self.s)) + exit(1) =} reaction(shutdown) {= if self.s == 0: - sys.stderr.write("ERROR: Print received no data.\n") - exit(2) + sys.stderr.write("ERROR: Print received no data.\n") + exit(2) =} } diff --git a/test/Python/src/DelayedAction.lf b/test/Python/src/DelayedAction.lf index 5bab6bc7c8..1a461eccff 100644 --- a/test/Python/src/DelayedAction.lf +++ b/test/Python/src/DelayedAction.lf @@ -18,7 +18,7 @@ main reactor DelayedAction { expected = self.count * 1000000000 + 100000000 self.count += 1 if elapsed != expected: - sys.stderr.write("Expected {:d} but got {:d}.\n".format(expected, elapsed)) - exit(1) + sys.stderr.write("Expected {:d} but got {:d}.\n".format(expected, elapsed)) + exit(1) =} } diff --git a/test/Python/src/DelayedReaction.lf b/test/Python/src/DelayedReaction.lf index c62b4a3857..2ebde05b5a 100644 --- a/test/Python/src/DelayedReaction.lf +++ b/test/Python/src/DelayedReaction.lf @@ -15,8 +15,8 @@ reactor Sink { elapsed = lf.time.logical_elapsed() print("Nanoseconds since start: ", elapsed) if elapsed != 100000000: - sys.stderr.write("ERROR: Expected 100000000 but.\n") - exit(1) + sys.stderr.write("ERROR: Expected 100000000 but.\n") + exit(1) =} } diff --git a/test/Python/src/Determinism.lf b/test/Python/src/Determinism.lf index fdfe446e3d..f200c141f5 100644 --- a/test/Python/src/Determinism.lf +++ b/test/Python/src/Determinism.lf @@ -14,13 +14,13 @@ reactor Destination { reaction(x, y) {= sm = 0 if x.is_present: - sm += x.value + sm += x.value if y.is_present: - sm += y.value + sm += y.value print("Received ", sm); if sm != 2: - sys.stderr.write("FAILURE: Expected 2.\n") - exit(4) + sys.stderr.write("FAILURE: Expected 2.\n") + exit(4) =} } diff --git a/test/Python/src/DoubleInvocation.lf b/test/Python/src/DoubleInvocation.lf index 36327d815f..34ed1cf007 100644 --- a/test/Python/src/DoubleInvocation.lf +++ b/test/Python/src/DoubleInvocation.lf @@ -33,10 +33,10 @@ reactor Print { reaction(position, velocity) {= if position.is_present: - print("Position: ", position.value) + print("Position: ", position.value) if position.value == self.previous: - sys.stderr.write("ERROR: Multiple firings at the same logical time!\n") - exit(1) + sys.stderr.write("ERROR: Multiple firings at the same logical time!\n") + exit(1) =} } diff --git a/test/Python/src/DoubleReaction.lf b/test/Python/src/DoubleReaction.lf index 855dbdfe6a..c77e5b17e1 100644 --- a/test/Python/src/DoubleReaction.lf +++ b/test/Python/src/DoubleReaction.lf @@ -5,7 +5,7 @@ target Python { fast: true } -reactor Clock(offset = 0, period = 1 sec) { +reactor Clock(offset=0, period = 1 sec) { output y timer t(offset, period) state count = 0 @@ -24,13 +24,13 @@ reactor Destination { reaction(x, w) {= sm = 0 if x.is_present: - sm += x.value + sm += x.value if w.is_present: - sm += w.value + sm += w.value print("Sum of inputs is: ", sm) if sm != self.s: - sys.stderr.write("FAILURE: Expected sum to be {:d}, but it was {:d}.\n".format(self.s, sm)); - exit(1) + sys.stderr.write("FAILURE: Expected sum to be {:d}, but it was {:d}.\n".format(self.s, sm)); + exit(1) self.s += 2 =} } diff --git a/test/Python/src/FloatLiteral.lf b/test/Python/src/FloatLiteral.lf index 2f029996f4..a7c86c3942 100644 --- a/test/Python/src/FloatLiteral.lf +++ b/test/Python/src/FloatLiteral.lf @@ -10,11 +10,11 @@ main reactor { reaction(startup) {= F = - self.N * self.charge if abs(F - self.expected) < abs(self.minus_epsilon): - print("The Faraday constant is roughly {}.".format(F)) + print("The Faraday constant is roughly {}.".format(F)) else: - sys.stderr.write("ERROR: Expected {} but got {}.".format( - self.expected, F - )) - exit(1) + sys.stderr.write("ERROR: Expected {} but got {}.".format( + self.expected, F + )) + exit(1) =} } diff --git a/test/Python/src/Gain.lf b/test/Python/src/Gain.lf index 769d08f78e..34e9229748 100644 --- a/test/Python/src/Gain.lf +++ b/test/Python/src/Gain.lf @@ -1,7 +1,7 @@ # Example in the Wiki. target Python -reactor Scale(scale = 2) { +reactor Scale(scale=2) { input x output y @@ -16,15 +16,15 @@ reactor Test { print("Received " + str(x.value)) self.received_value = True if x.value != 2: - sys.stderr.write("ERROR: Expected 2!") - exit(1) + sys.stderr.write("ERROR: Expected 2!") + exit(1) =} reaction(shutdown) {= if self.received_value is None: - sys.stderr.write("ERROR: No value received by Test reactor!") + sys.stderr.write("ERROR: No value received by Test reactor!") else: - sys.stderr.write("Test passes.") + sys.stderr.write("Test passes.") =} } diff --git a/test/Python/src/GetMicroStep.lf b/test/Python/src/GetMicroStep.lf index 345c953f95..b137b8cd94 100644 --- a/test/Python/src/GetMicroStep.lf +++ b/test/Python/src/GetMicroStep.lf @@ -14,10 +14,10 @@ main reactor GetMicroStep { reaction(l) -> l {= microstep = lf.tag().microstep if microstep != self.s: - self.sys.stderr.write(f"expected microstep {self.s}, got {microstep} instead\n") - self.sys.exit(1) + self.sys.stderr.write(f"expected microstep {self.s}, got {microstep} instead\n") + self.sys.exit(1) self.s += 1 if self.s < 10: - l.schedule(0) + l.schedule(0) =} } diff --git a/test/Python/src/Hello.lf b/test/Python/src/Hello.lf index 4f9dd68f47..41ed95d186 100644 --- a/test/Python/src/Hello.lf +++ b/test/Python/src/Hello.lf @@ -28,17 +28,17 @@ reactor Reschedule(period = 2 sec, message = "Hello Python") { print("***** action {:d} at time {:d}\n".format(self.count, lf.time.logical())) # Check if a.value is not None. if a.value is not None: - sys.stderr.write("FAILURE: Expected a.value to be None, but it exists.\n") - exit(2) + sys.stderr.write("FAILURE: Expected a.value to be None, but it exists.\n") + exit(2) tm = lf.time.logical() if (tm - self.previous_time) != 200000000: - sys.stderr.write("FAILURE: Expected 200ms of logical time to elapse but got {:d} nanoseconds.\n".format(tm - self.previous_time)) - exit(1) + sys.stderr.write("FAILURE: Expected 200ms of logical time to elapse but got {:d} nanoseconds.\n".format(tm - self.previous_time)) + exit(1) =} } reactor Inside(period = 1 sec, message = "Composite default message.") { - third_instance = new Reschedule(period = period, message = message) + third_instance = new Reschedule(period=period, message=message) } main reactor Hello { diff --git a/test/Python/src/HelloWorld.lf b/test/Python/src/HelloWorld.lf index 486bea5990..20c3a4b6a7 100644 --- a/test/Python/src/HelloWorld.lf +++ b/test/Python/src/HelloWorld.lf @@ -13,8 +13,8 @@ reactor HelloWorld2 { reaction(shutdown) {= print("Shutdown invoked.") if not self.success: - sys.stderr.write("ERROR: startup reaction not executed.\n") - sys.exit(1) + sys.stderr.write("ERROR: startup reaction not executed.\n") + sys.exit(1) =} } diff --git a/test/Python/src/Hierarchy.lf b/test/Python/src/Hierarchy.lf index f8206f81db..4d92568592 100644 --- a/test/Python/src/Hierarchy.lf +++ b/test/Python/src/Hierarchy.lf @@ -24,8 +24,8 @@ reactor Print { reaction(_in) {= print("Received: ", _in.value) if _in.value != 2: - sys.stderr.write("Expected 2.\n") - exit(1) + sys.stderr.write("Expected 2.\n") + exit(1) =} } diff --git a/test/Python/src/Hierarchy2.lf b/test/Python/src/Hierarchy2.lf index cec5bf4c9f..2172396617 100644 --- a/test/Python/src/Hierarchy2.lf +++ b/test/Python/src/Hierarchy2.lf @@ -30,9 +30,9 @@ reactor Add { reaction(in1, in2) -> out {= result = 0 if in1.is_present: - result += in1.value + result += in1.value if in2.is_present: - result += in2.value + result += in2.value out.set(result) =} } @@ -44,8 +44,8 @@ reactor Print { reaction(_in) {= print("Received: ", _in.value) if _in.value != self.expected: - sys.stderr.write("Expected {:d}.\n".format(self.expected)) - exit(1) + sys.stderr.write("Expected {:d}.\n".format(self.expected)) + exit(1) self.expected+=1 =} } diff --git a/test/Python/src/IdentifierLength.lf b/test/Python/src/IdentifierLength.lf index e80c3e3f7a..6eca0821e2 100644 --- a/test/Python/src/IdentifierLength.lf +++ b/test/Python/src/IdentifierLength.lf @@ -5,8 +5,7 @@ target Python { } reactor A_Really_Long_Name_For_A_Source_But_Not_Quite_255_Characters_Which_Is_The_Maximum_For_The_Python_Target( - period = 2 sec -) { + period = 2 sec) { output y timer t(1 sec, period) state count = 0 @@ -25,15 +24,13 @@ reactor Another_Really_Long_Name_For_A_Test_Class { self.count += 1 print("Received ", x.value) if x.value != self.count: - sys.stderr.write("FAILURE: Expected {:d}.\n".format(self.count)) - exit(1) + sys.stderr.write("FAILURE: Expected {:d}.\n".format(self.count)) + exit(1) =} } main reactor IdentifierLength { - a_really_long_name_for_a_source_instance = new A_Really_Long_Name_For_A_Source_But_Not_Quite_255_Characters_Which_Is_The_Maximum_For_The_Python_Target( - - ) + a_really_long_name_for_a_source_instance = new A_Really_Long_Name_For_A_Source_But_Not_Quite_255_Characters_Which_Is_The_Maximum_For_The_Python_Target() another_really_long_name_for_a_test_instance = new Another_Really_Long_Name_For_A_Test_Class() a_really_long_name_for_a_source_instance.y -> another_really_long_name_for_a_test_instance.x } diff --git a/test/Python/src/ImportComposition.lf b/test/Python/src/ImportComposition.lf index 5558db6163..cbdeeb5c6c 100644 --- a/test/Python/src/ImportComposition.lf +++ b/test/Python/src/ImportComposition.lf @@ -14,16 +14,16 @@ main reactor ImportComposition { print("Received {:d} at time {:d}".format(a.y.value, receive_time)) self.received = True if receive_time != 55000000: - sys.stderr.write("ERROR: Received time should have been 55,000,000.\n") - exit(1) + sys.stderr.write("ERROR: Received time should have been 55,000,000.\n") + exit(1) if a.y.value != 42 * 2 * 2: - sys.stderr.write("ERROR: Received value should have been {:d}.\n".format(42 * 2 * 2)) - exit(2) + sys.stderr.write("ERROR: Received value should have been {:d}.\n".format(42 * 2 * 2)) + exit(2) =} reaction(shutdown) {= if self.received is not True: - sys.stderr.write("ERROR: Nothing received.\n"); - exit(3) + sys.stderr.write("ERROR: Nothing received.\n"); + exit(3) =} } diff --git a/test/Python/src/ManualDelayedReaction.lf b/test/Python/src/ManualDelayedReaction.lf index 645c58f6ea..a9863589ff 100644 --- a/test/Python/src/ManualDelayedReaction.lf +++ b/test/Python/src/ManualDelayedReaction.lf @@ -37,8 +37,8 @@ reactor Sink { physical = lf.time.physical() print("Nanoseconds since start: {:d} {:d} {:d}.\n".format(logical, physical, elapsed_logical)) if elapsed_logical < MSEC(100): - sys.stderr.write("Expected {:d} but got {:d}.\n".format(MSEC(100), elapsed_logical)) - exit(1) + sys.stderr.write("Expected {:d} but got {:d}.\n".format(MSEC(100), elapsed_logical)) + exit(1) =} deadline(200 msec) {= =} } diff --git a/test/Python/src/Methods.lf b/test/Python/src/Methods.lf index 54bdacc825..ad158e72b3 100644 --- a/test/Python/src/Methods.lf +++ b/test/Python/src/Methods.lf @@ -11,14 +11,14 @@ main reactor { reaction(startup) {= print(f"Foo is initialized to {self.getFoo()}") if self.getFoo() != 2: - sys.stderr.write("Expected 2!"); - exit(1) + sys.stderr.write("Expected 2!"); + exit(1) self.add(40) a = self.getFoo() print(f"2 + 40 = {a}") if a != 42: - sys.stderr.write("Expected 42!"); - exit(1) + sys.stderr.write("Expected 42!"); + exit(1) =} } diff --git a/test/Python/src/MethodsRecursive.lf b/test/Python/src/MethodsRecursive.lf index bc3cedb8cd..cc6a9ccb85 100644 --- a/test/Python/src/MethodsRecursive.lf +++ b/test/Python/src/MethodsRecursive.lf @@ -7,7 +7,7 @@ main reactor { # Return the n-th Fibonacci number. method fib(n) {= if n <= 1: - return 1 + return 1 return self.add(self.fib(n-1), self.fib(n-2)) =} @@ -15,6 +15,6 @@ main reactor { reaction(startup) {= for n in range(1, 10): - print(f"{n}-th Fibonacci number is {self.fib(n)}") + print(f"{n}-th Fibonacci number is {self.fib(n)}") =} } diff --git a/test/Python/src/MethodsSameName.lf b/test/Python/src/MethodsSameName.lf index aedf19bef0..e842912e84 100644 --- a/test/Python/src/MethodsSameName.lf +++ b/test/Python/src/MethodsSameName.lf @@ -10,8 +10,8 @@ reactor Foo { self.add(40) print(f"Foo: 2 + 40 = {self.foo}") if self.foo != 42: - sys.stderr.write("Expected 42!") - exit(1) + sys.stderr.write("Expected 42!") + exit(1) =} } @@ -26,7 +26,7 @@ main reactor { self.add(40) print(f"Main: 2 + 40 = {self.foo}") if self.foo != 42: - sys.stderr.write("Expected 42!") - exit(1) + sys.stderr.write("Expected 42!") + exit(1) =} } diff --git a/test/Python/src/Microsteps.lf b/test/Python/src/Microsteps.lf index 3913cc9c4b..871ad321bc 100644 --- a/test/Python/src/Microsteps.lf +++ b/test/Python/src/Microsteps.lf @@ -8,18 +8,18 @@ reactor Destination { elapsed = lf.time.logical_elapsed() print("Time since start: ", elapsed) if elapsed != 0: - sys.stderr.write("Expected elapsed time to be 0, but it was {:d}.".format(elapsed)) - exit(1) + sys.stderr.write("Expected elapsed time to be 0, but it was {:d}.".format(elapsed)) + exit(1) count = 0 if x.is_present: - print("x is present.") - count += 1 + print("x is present.") + count += 1 if y.is_present: - print("y is present.") - count += 1 + print("y is present.") + count += 1 if count != 1: - sys.stderr.write("Expected exactly one input to be present but got {:d}.".format(count)) - exit(1) + sys.stderr.write("Expected exactly one input to be present but got {:d}.".format(count)) + exit(1) =} } diff --git a/test/Python/src/MovingAverage.lf b/test/Python/src/MovingAverage.lf index efaff22c10..c4afbd4af0 100644 --- a/test/Python/src/MovingAverage.lf +++ b/test/Python/src/MovingAverage.lf @@ -37,7 +37,7 @@ reactor MovingAverageImpl { # Update the index for the next input. self.index +=1 if self.index >= 3: - self.index = 0 + self.index = 0 =} } diff --git a/test/Python/src/MultipleContained.lf b/test/Python/src/MultipleContained.lf index 515962986f..8d0afa0a12 100644 --- a/test/Python/src/MultipleContained.lf +++ b/test/Python/src/MultipleContained.lf @@ -12,23 +12,23 @@ reactor Contained { reaction(in1) {= print("in1 received ", in1.value); if in1.value != 42: - sys.stderr.write("FAILED: Expected 42.\n") - exit(1) + sys.stderr.write("FAILED: Expected 42.\n") + exit(1) self.count += 1 =} reaction(in2) {= print("in2 received ", in2.value) if in2.value != 42: - sys.stderr.write("FAILED: Expected 42.\n") - exit(1) + sys.stderr.write("FAILED: Expected 42.\n") + exit(1) self.count += 1 =} reaction(shutdown) {= if self.count != 2: - sys.stderr.write("FAILED: Should have received two inputs.\n") - exit(1) + sys.stderr.write("FAILED: Should have received two inputs.\n") + exit(1) =} } diff --git a/test/Python/src/NativeListsAndTimes.lf b/test/Python/src/NativeListsAndTimes.lf index 28a7d5c015..8a5de9d148 100644 --- a/test/Python/src/NativeListsAndTimes.lf +++ b/test/Python/src/NativeListsAndTimes.lf @@ -2,13 +2,13 @@ target Python # This test passes if it is successfully compiled into valid target code. main reactor( - x = 0, - y = 0, # Units are missing but not required - z = 1 msec, # Type is missing but not required - p(1, 2, 3, 4), # List of integers - q(1 msec, 2 msec, 3 msec), # list of time values - g(1 msec, 2 msec) # List of time values -) { + x=0, + y=0, # Units are missing but not required + z = 1 msec, # Type is missing but not required + p(1, 2, 3, 4), # List of integers + q(1 msec, 2 msec, 3 msec), # list of time values + # List of time values + g(1 msec, 2 msec)) { state s = y # Reference to explicitly typed time parameter state t = z # Reference to implicitly typed time parameter state v # Uninitialized boolean state variable diff --git a/test/Python/src/ParameterizedState.lf b/test/Python/src/ParameterizedState.lf index 32791918de..2553cfcfd2 100644 --- a/test/Python/src/ParameterizedState.lf +++ b/test/Python/src/ParameterizedState.lf @@ -1,6 +1,6 @@ target Python -reactor Foo(bar = 42) { +reactor Foo(bar=42) { state baz = bar reaction(startup) {= print("Baz: ", self.baz) =} diff --git a/test/Python/src/PeriodicDesugared.lf b/test/Python/src/PeriodicDesugared.lf index 7c6f6768f2..3715a15c7e 100644 --- a/test/Python/src/PeriodicDesugared.lf +++ b/test/Python/src/PeriodicDesugared.lf @@ -3,16 +3,16 @@ target Python { timeout: 1 sec } -main reactor(offset = 0, period = 500 msec) { +main reactor(offset=0, period = 500 msec) { logical action init(offset) logical action recur(period) reaction(startup) -> init, recur {= if self.offset == 0: - print("Hello World!") - recur.schedule(0) + print("Hello World!") + recur.schedule(0) else: - init.schedule(0) + init.schedule(0) =} reaction(init, recur) -> recur {= diff --git a/test/Python/src/PingPong.lf b/test/Python/src/PingPong.lf index 5be9cfb50b..329401e925 100644 --- a/test/Python/src/PingPong.lf +++ b/test/Python/src/PingPong.lf @@ -21,7 +21,7 @@ target Python { fast: true } -reactor Ping(count = 10) { +reactor Ping(count=10) { input receive output send state pingsLeft = count @@ -34,13 +34,13 @@ reactor Ping(count = 10) { reaction(receive) -> serve {= if self.pingsLeft > 0: - serve.schedule(0) + serve.schedule(0) else: - request_stop() + request_stop() =} } -reactor Pong(expected = 10) { +reactor Pong(expected=10) { input receive output send state count = 0 @@ -52,13 +52,13 @@ reactor Pong(expected = 10) { reaction(shutdown) {= if self.count != self.expected: - sys.stderr.write( - "ERROR: Pong expected to receive {} inputs, but it received {}.\n".format( - self.expected, - self.count - ) + sys.stderr.write( + "ERROR: Pong expected to receive {} inputs, but it received {}.\n".format( + self.expected, + self.count ) - sys.exit(1) + ) + sys.exit(1) print("Success.") =} } diff --git a/test/Python/src/Pipeline.lf b/test/Python/src/Pipeline.lf index fb72fd1026..eb9703e4cc 100644 --- a/test/Python/src/Pipeline.lf +++ b/test/Python/src/Pipeline.lf @@ -9,7 +9,7 @@ reactor TakeTime { reaction(_in) -> out {= offset = 0 for i in range(10000): - offset+=1 + offset+=1 out.set(_in.value + offset) =} @@ -24,15 +24,15 @@ reactor Print { self.received += 1 print("Received: {:d} at logical time {:d}".format(_in.value, lf.time.logical_elapsed())) if _in.value != (self.count + 40000): - sys.stderr.write("ERROR: Expected {:d}.\n".format(self.count + 40000)) - exit(1) + sys.stderr.write("ERROR: Expected {:d}.\n".format(self.count + 40000)) + exit(1) self.count+=1 =} reaction(shutdown) {= if self.received == 0: - sys.stderr.write("ERROR: Final reactor received no data.\n") - exit(3) + sys.stderr.write("ERROR: Final reactor received no data.\n") + exit(3) =} } diff --git a/test/Python/src/Preamble.lf b/test/Python/src/Preamble.lf index 6cbd9d9299..ab89a51e53 100644 --- a/test/Python/src/Preamble.lf +++ b/test/Python/src/Preamble.lf @@ -9,7 +9,7 @@ main reactor Preamble { preamble {= import platform def add_42(self, i): - return i + 42 + return i + 42 =} timer t diff --git a/test/Python/src/ReadOutputOfContainedReactor.lf b/test/Python/src/ReadOutputOfContainedReactor.lf index c67243b0d5..0a086c9514 100644 --- a/test/Python/src/ReadOutputOfContainedReactor.lf +++ b/test/Python/src/ReadOutputOfContainedReactor.lf @@ -14,32 +14,32 @@ main reactor ReadOutputOfContainedReactor { reaction(startup) c.out {= print("Startup reaction reading output of contained reactor: ", c.out.value) if c.out.value != 42: - sys.stderr.write("Expected 42!\n") - exit(2) + sys.stderr.write("Expected 42!\n") + exit(2) self.count += 1 =} reaction(c.out) {= print("Reading output of contained reactor:", c.out.value) if c.out.value != 42: - sys.stderr.write("Expected 42!\n") - exit(3) + sys.stderr.write("Expected 42!\n") + exit(3) self.count += 1 =} reaction(startup, c.out) {= print("Alternate triggering reading output of contained reactor: ", c.out.value) if c.out.value != 42: - sys.stderr.write("Expected 42!\n") - exit(4) + sys.stderr.write("Expected 42!\n") + exit(4) self.count += 1 =} reaction(shutdown) {= if self.count != 3: - print("FAILURE: One of the reactions failed to trigger.\n") - exit(1) + print("FAILURE: One of the reactions failed to trigger.\n") + exit(1) else: - print("Test passes.") + print("Test passes.") =} } diff --git a/test/Python/src/Schedule.lf b/test/Python/src/Schedule.lf index b79a7298bd..5d42888c2e 100644 --- a/test/Python/src/Schedule.lf +++ b/test/Python/src/Schedule.lf @@ -11,8 +11,8 @@ reactor Schedule2 { elapsed_time = lf.time.logical_elapsed() print("Action triggered at logical time {:d} nsec after start.".format(elapsed_time)) if elapsed_time != 200000000: - sys.stderr.write("Expected action time to be 200 msec. It was {:d} nsec.\n".format(elapsed_time)) - exit(1) + sys.stderr.write("Expected action time to be 200 msec. It was {:d} nsec.\n".format(elapsed_time)) + exit(1) =} } diff --git a/test/Python/src/ScheduleLogicalAction.lf b/test/Python/src/ScheduleLogicalAction.lf index c1328ee85e..37eeb8ab6d 100644 --- a/test/Python/src/ScheduleLogicalAction.lf +++ b/test/Python/src/ScheduleLogicalAction.lf @@ -29,8 +29,8 @@ reactor print { print("Current logical time is: ", elapsed_time) print("Current physical time is: ", lf.time.physical_elapsed()) if elapsed_time != self.expected_time: - sys.stderr.write("ERROR: Expected logical time to be {:d}.\n".format(self.expected_time)) - exit(1); + sys.stderr.write("ERROR: Expected logical time to be {:d}.\n".format(self.expected_time)) + exit(1); self.expected_time += MSEC(500) =} } diff --git a/test/Python/src/ScheduleValue.lf b/test/Python/src/ScheduleValue.lf index 02fb0a3b1f..3f1794eec3 100644 --- a/test/Python/src/ScheduleValue.lf +++ b/test/Python/src/ScheduleValue.lf @@ -14,7 +14,7 @@ main reactor ScheduleValue { reaction(a) {= print("Received: ", a.value) if a.value != "Hello": - sys.stderr.write("FAILURE: Should have received 'Hello'\n") - exit(1) + sys.stderr.write("FAILURE: Should have received 'Hello'\n") + exit(1) =} } diff --git a/test/Python/src/SelfLoop.lf b/test/Python/src/SelfLoop.lf index f4fd756bb2..6362c77373 100644 --- a/test/Python/src/SelfLoop.lf +++ b/test/Python/src/SelfLoop.lf @@ -17,8 +17,8 @@ reactor Self { reaction(x) -> a {= print("x = ", x.value) if x.value != self.expected: - sys.stderr.write("Expected {:d}.\n".format(self.expected)) - exit(1) + sys.stderr.write("Expected {:d}.\n".format(self.expected)) + exit(1) self.expected += 1 a.schedule(MSEC(100), x.value) =} @@ -27,8 +27,8 @@ reactor Self { reaction(shutdown) {= if self.expected <= 43: - sys.stderr.write("Received no data.\n") - exit(2) + sys.stderr.write("Received no data.\n") + exit(2) =} } diff --git a/test/Python/src/SendingInside.lf b/test/Python/src/SendingInside.lf index 0edc80bf73..4854e2d040 100644 --- a/test/Python/src/SendingInside.lf +++ b/test/Python/src/SendingInside.lf @@ -12,8 +12,8 @@ reactor Printer { reaction(x) {= print("Inside reactor received: ", x.value) if x.value != self.count: - sys.stderr.write("FAILURE: Expected {:d}.\n".format(self.count)) - exit(1) + sys.stderr.write("FAILURE: Expected {:d}.\n".format(self.count)) + exit(1) self.count += 1 =} } diff --git a/test/Python/src/SendingInside2.lf b/test/Python/src/SendingInside2.lf index cdf99e6a2d..8ceb1ba5cc 100644 --- a/test/Python/src/SendingInside2.lf +++ b/test/Python/src/SendingInside2.lf @@ -6,8 +6,8 @@ reactor Printer { reaction(x) {= print("Inside reactor received: ", x.value) if x.value != 1: - sys.stderr.write("ERROR: Expected 1.\n") - exit(1) + sys.stderr.write("ERROR: Expected 1.\n") + exit(1) =} } diff --git a/test/Python/src/SetArray.lf b/test/Python/src/SetArray.lf index 2e7e504836..931260ab9b 100644 --- a/test/Python/src/SetArray.lf +++ b/test/Python/src/SetArray.lf @@ -9,14 +9,14 @@ reactor Source { } # The scale parameter is just for testing. -reactor Print(scale = 1) { +reactor Print(scale=1) { input _in reaction(_in) {= print("Recieved ", _in.value) if _in.value != [self.scale*count for count in range(len(_in.value))]: - sys.stderr.write("ERROR: Value received by Print does not match expectation!\n") - exit(1) + sys.stderr.write("ERROR: Value received by Print does not match expectation!\n") + exit(1) =} } diff --git a/test/Python/src/SimpleDeadline.lf b/test/Python/src/SimpleDeadline.lf index 1a9d42f48d..2b6adbf942 100644 --- a/test/Python/src/SimpleDeadline.lf +++ b/test/Python/src/SimpleDeadline.lf @@ -20,7 +20,7 @@ reactor Print { reaction(_in) {= if _in.value is True: - print("Output successfully produced by deadline handler.") + print("Output successfully produced by deadline handler.") =} } diff --git a/test/Python/src/SlowingClock.lf b/test/Python/src/SlowingClock.lf index b53c59d713..8298135c62 100644 --- a/test/Python/src/SlowingClock.lf +++ b/test/Python/src/SlowingClock.lf @@ -19,8 +19,8 @@ main reactor SlowingClock { elapsed_logical_time = lf.time.logical_elapsed() print("Logical time since start: {:d} nsec.\n".format(elapsed_logical_time)) if elapsed_logical_time != self.expected_time: - sys.stderr.write("ERROR: Expected time to be: {:d} nsec.\n".format(self.expected_time)) - exit(1) + sys.stderr.write("ERROR: Expected time to be: {:d} nsec.\n".format(self.expected_time)) + exit(1) a.schedule(self.interval) self.expected_time += MSEC(100) + self.interval @@ -29,10 +29,10 @@ main reactor SlowingClock { reaction(shutdown) {= if self.expected_time != MSEC(1500): - sys.stderr.write("ERROR: Expected the next expected time to be: 1500000000 nsec.\n") - sys.stderr.write("It was: {:d} nsec.\n".format(self.expected_time)) - exit(2) + sys.stderr.write("ERROR: Expected the next expected time to be: 1500000000 nsec.\n") + sys.stderr.write("It was: {:d} nsec.\n".format(self.expected_time)) + exit(2) else: - print("Test passes.") + print("Test passes.") =} } diff --git a/test/Python/src/SlowingClockPhysical.lf b/test/Python/src/SlowingClockPhysical.lf index 39d75b4c6d..a105aca99d 100644 --- a/test/Python/src/SlowingClockPhysical.lf +++ b/test/Python/src/SlowingClockPhysical.lf @@ -24,8 +24,8 @@ main reactor SlowingClockPhysical { elapsed_logical_time = lf.time.logical_elapsed() print("Logical time since start: {:d} nsec.".format(elapsed_logical_time)) if elapsed_logical_time < self.expected_time: - sys.stderr.write("ERROR: Expected logical time to be at least: {:d} nsec.\n".format(self.expected_time)) - exit(1) + sys.stderr.write("ERROR: Expected logical time to be at least: {:d} nsec.\n".format(self.expected_time)) + exit(1) self.interval += MSEC(100) self.expected_time = MSEC(100) + self.interval a.schedule(self.interval) @@ -34,9 +34,9 @@ main reactor SlowingClockPhysical { reaction(shutdown) {= if self.expected_time < MSEC(500): - sys.stderr.write("ERROR: Expected the next expected time to be at least: 500000000 nsec.\n"); - sys.stderr.write("It was: {:d} nsec.\n".format(self.expected_time)) - exit(2) + sys.stderr.write("ERROR: Expected the next expected time to be at least: 500000000 nsec.\n"); + sys.stderr.write("It was: {:d} nsec.\n".format(self.expected_time)) + exit(2) print("Success") =} } diff --git a/test/Python/src/StartupOutFromInside.lf b/test/Python/src/StartupOutFromInside.lf index eff09b1a77..ce2025278f 100644 --- a/test/Python/src/StartupOutFromInside.lf +++ b/test/Python/src/StartupOutFromInside.lf @@ -12,7 +12,7 @@ main reactor StartupOutFromInside { reaction(startup) bar.out {= print("Output from bar: ", bar.out.value) if bar.out.value != 42: - sys.stderr.write("Expected 42!\n") - exit(1) + sys.stderr.write("Expected 42!\n") + exit(1) =} } diff --git a/test/Python/src/Stride.lf b/test/Python/src/Stride.lf index db83ecc2e6..6d845e7251 100644 --- a/test/Python/src/Stride.lf +++ b/test/Python/src/Stride.lf @@ -5,7 +5,7 @@ target Python { fast: true } -reactor Count(stride = 1) { +reactor Count(stride=1) { state count = 1 output y timer t(0, 100 msec) @@ -23,13 +23,13 @@ reactor Display { reaction(x) {= print("Received: ", x.value) if x.value != self.expected: - sys.stderr.write("ERROR: Expected {:d}.\n".format(self.expected)) + sys.stderr.write("ERROR: Expected {:d}.\n".format(self.expected)) self.expected += 2 =} } main reactor Stride { - c = new Count(stride = 2) + c = new Count(stride=2) d = new Display() c.y -> d.x } diff --git a/test/Python/src/StructAsState.lf b/test/Python/src/StructAsState.lf index f7d725325d..0cc8e2d9b6 100644 --- a/test/Python/src/StructAsState.lf +++ b/test/Python/src/StructAsState.lf @@ -4,16 +4,16 @@ target Python main reactor StructAsState { preamble {= class hello: - def __init__(self, name, value): - self.name = name - self.value = value + def __init__(self, name, value): + self.name = name + self.value = value =} state s = {= self.hello("Earth", 42) =} reaction(startup) {= print("State s.name=\"{:s}\", value={:d}.".format(self.s.name, self.s.value)) if self.s.value != 42: - sys.stderr.write("FAILED: Expected 42.\n") - exit(1) + sys.stderr.write("FAILED: Expected 42.\n") + exit(1) =} } diff --git a/test/Python/src/StructAsType.lf b/test/Python/src/StructAsType.lf index a16831f641..e1b089df5b 100644 --- a/test/Python/src/StructAsType.lf +++ b/test/Python/src/StructAsType.lf @@ -14,14 +14,14 @@ reactor Source { } # expected parameter is for testing. -reactor Print(expected = 42) { +reactor Print(expected=42) { input _in reaction(_in) {= print("Received: name = {:s}, value = {:d}\n".format(_in.value.name, _in.value.value)) if _in.value.value != self.expected: - sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(self.expected)) - exit(1) + sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(self.expected)) + exit(1) =} } diff --git a/test/Python/src/StructAsTypeDirect.lf b/test/Python/src/StructAsTypeDirect.lf index 7b903272a8..132ef78948 100644 --- a/test/Python/src/StructAsTypeDirect.lf +++ b/test/Python/src/StructAsTypeDirect.lf @@ -17,14 +17,14 @@ reactor Source { } # expected parameter is for testing. -reactor Print(expected = 42) { +reactor Print(expected=42) { input _in reaction(_in) {= print("Received: name = {:s}, value = {:d}".format(_in.value.name, _in.value.value)) if _in.value.value != self.expected: - sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(self.expected)) - exit(1) + sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(self.expected)) + exit(1) =} } diff --git a/test/Python/src/StructParallel.lf b/test/Python/src/StructParallel.lf index 1f5a51fa50..4e2024d99e 100644 --- a/test/Python/src/StructParallel.lf +++ b/test/Python/src/StructParallel.lf @@ -8,18 +8,18 @@ import Source from "StructScale.lf" preamble {= import hello =} -reactor Check(expected = 42) { +reactor Check(expected=42) { input _in reaction(_in) {= print("Received: name = {:s}, value = {:d}".format(_in.value.name, _in.value.value)) if _in.value.value != self.expected: - sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(self.expected)) - exit(1) + sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(self.expected)) + exit(1) =} } -reactor Print(scale = 2) { +reactor Print(scale=2) { # Mutable keyword indicates that this reactor wants a writable copy of the input. mutable input _in @@ -35,9 +35,9 @@ reactor Print(scale = 2) { main reactor StructParallel { s = new Source() c1 = new Print() - c2 = new Print(scale = 3) - p1 = new Check(expected = 84) - p2 = new Check(expected = 126) + c2 = new Print(scale=3) + p1 = new Check(expected=84) + p2 = new Check(expected=126) s.out -> c1._in s.out -> c2._in c1.out -> p1._in diff --git a/test/Python/src/StructPrint.lf b/test/Python/src/StructPrint.lf index e4303e1d09..968a3e9d27 100644 --- a/test/Python/src/StructPrint.lf +++ b/test/Python/src/StructPrint.lf @@ -13,14 +13,14 @@ reactor Print { } # expected parameter is for testing. -reactor Check(expected = 42) { +reactor Check(expected=42) { input _in reaction(_in) {= print("Received: name = {:s}, value = {:d}\n".format(_in.value.name, _in.value.value)) if _in.value.value != self.expected: - sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(self.expected)) - exit(1) + sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(self.expected)) + exit(1) =} } diff --git a/test/Python/src/StructScale.lf b/test/Python/src/StructScale.lf index fa650211d8..f2ec9162d4 100644 --- a/test/Python/src/StructScale.lf +++ b/test/Python/src/StructScale.lf @@ -13,18 +13,18 @@ reactor Source { } # expected parameter is for testing. -reactor TestInput(expected = 42) { +reactor TestInput(expected=42) { input _in reaction(_in) {= print("Received: name = {:s}, value = {:d}\n".format(_in.value.name, _in.value.value)) if _in.value.value != self.expected: - sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(self.expected)) - exit(1) + sys.stderr.write("ERROR: Expected value to be {:d}.\n".format(self.expected)) + exit(1) =} } -reactor Print(scale = 2) { +reactor Print(scale=2) { # Mutable keyword indicates that this reactor wants a writable copy of the input. mutable input _in @@ -39,7 +39,7 @@ reactor Print(scale = 2) { main reactor StructScale { s = new Source() c = new Print() - p = new TestInput(expected = 84) + p = new TestInput(expected=84) s.out -> c._in c.out -> p._in } diff --git a/test/Python/src/SubclassesAndStartup.lf b/test/Python/src/SubclassesAndStartup.lf index 794ad83d53..67e9348363 100644 --- a/test/Python/src/SubclassesAndStartup.lf +++ b/test/Python/src/SubclassesAndStartup.lf @@ -10,26 +10,26 @@ reactor Super { reaction(shutdown) {= if self.count == 0: - sys.stderr.write("No startup reaction was invoked!\n") - exit(3) + sys.stderr.write("No startup reaction was invoked!\n") + exit(3) =} } -reactor SubA(name = "SubA") extends Super { +reactor SubA(name="SubA") extends Super { reaction(startup) {= print("{:s} started".format(self.name)) if self.count == 0: - sys.stderr.write("Base class startup reaction was not invoked!\n") - exit(1) + sys.stderr.write("Base class startup reaction was not invoked!\n") + exit(1) =} } -reactor SubB(name = "SubB") extends Super { +reactor SubB(name="SubB") extends Super { reaction(startup) {= print("{:s} started".format(self.name)) if self.count == 0: - sys.stderr.write("Base class startup reaction was not invoked!\n") - exit(2) + sys.stderr.write("Base class startup reaction was not invoked!\n") + exit(2) =} } diff --git a/test/Python/src/TestForPreviousOutput.lf b/test/Python/src/TestForPreviousOutput.lf index d2a0661768..7f10c13482 100644 --- a/test/Python/src/TestForPreviousOutput.lf +++ b/test/Python/src/TestForPreviousOutput.lf @@ -11,14 +11,14 @@ reactor Source { self.random.seed() # Randomly produce an output or not. if self.random.choice([0,1]) == 1: - out.set(21) + out.set(21) =} reaction(startup) -> out {= if out.is_present: - out.set(2 * out.value) + out.set(2 * out.value) else: - out.set(42) + out.set(42) =} } @@ -28,8 +28,8 @@ reactor Sink { reaction(_in) {= print("Received ", _in.value) if _in.value != 42: - sys.stderr.write("FAILED: Expected 42.\n") - exit(1) + sys.stderr.write("FAILED: Expected 42.\n") + exit(1) =} } diff --git a/test/Python/src/TimeLimit.lf b/test/Python/src/TimeLimit.lf index 54b0bbc7fb..64c5fa6a71 100644 --- a/test/Python/src/TimeLimit.lf +++ b/test/Python/src/TimeLimit.lf @@ -4,7 +4,7 @@ target Python { fast: true } -reactor Clock(offset = 0, period = 1 sec) { +reactor Clock(offset=0, period = 1 sec) { output y timer t(offset, period) state count = 0 @@ -23,22 +23,22 @@ reactor Destination { reaction(x) {= # print(x.value) if x.value != self.s: - sys.stderr.write("ERROR: Expected {:d} and got {:d}.\n".format(self.s, x.value)) - exit(1) + sys.stderr.write("ERROR: Expected {:d} and got {:d}.\n".format(self.s, x.value)) + exit(1) self.s += 1 =} reaction(shutdown) {= print("**** shutdown reaction invoked.") if self.s != 12: - sys.stderr.write("ERROR: Expected 12 but got {:d}.\n".format(self.s)) - exit(1) + sys.stderr.write("ERROR: Expected 12 but got {:d}.\n".format(self.s)) + exit(1) =} } main reactor TimeLimit(period = 1 sec) { timer stop(10 sec) - c = new Clock(period = period) + c = new Clock(period=period) d = new Destination() c.y -> d.x diff --git a/test/Python/src/TimeState.lf b/test/Python/src/TimeState.lf index 6a82c5fbf9..ab6d435633 100644 --- a/test/Python/src/TimeState.lf +++ b/test/Python/src/TimeState.lf @@ -1,6 +1,6 @@ target Python -reactor Foo(bar = 42) { +reactor Foo(bar=42) { state baz = 500 msec reaction(startup) {= print("Baz: ", self.baz) =} diff --git a/test/Python/src/Timers.lf b/test/Python/src/Timers.lf index fb533ee3f6..88a10bb367 100644 --- a/test/Python/src/Timers.lf +++ b/test/Python/src/Timers.lf @@ -14,8 +14,8 @@ main reactor { reaction(shutdown) {= if self.counter != 1: - sys.stderr.write("Error: Expected {:d} and got {:d}.\n".format(1, self.counter)) - exit(1) + sys.stderr.write("Error: Expected {:d} and got {:d}.\n".format(1, self.counter)) + exit(1) print("SUCCESS.") =} } diff --git a/test/Python/src/TriggerDownstreamOnlyIfPresent.lf b/test/Python/src/TriggerDownstreamOnlyIfPresent.lf index 6f7fdcc8bf..153ad06834 100644 --- a/test/Python/src/TriggerDownstreamOnlyIfPresent.lf +++ b/test/Python/src/TriggerDownstreamOnlyIfPresent.lf @@ -12,9 +12,9 @@ reactor Source { reaction(t) -> a, b {= if (self.count % 2) == 0: - a.set(self.count) + a.set(self.count) else: - b.set(self.count) + b.set(self.count) =} } @@ -24,14 +24,14 @@ reactor Destination { reaction(a) {= if a.is_present is not True: - sys.stderr.write("Reaction to a triggered even though all inputs are absent!\n") - exit(1) + sys.stderr.write("Reaction to a triggered even though all inputs are absent!\n") + exit(1) =} reaction(b) {= if b.is_present is not True: - sys.stderr.write("Reaction to b triggered even though all inputs are absent!\n") - exit(2) + sys.stderr.write("Reaction to b triggered even though all inputs are absent!\n") + exit(2) =} } diff --git a/test/Python/src/TriggerDownstreamOnlyIfPresent2.lf b/test/Python/src/TriggerDownstreamOnlyIfPresent2.lf index 2975045571..4bcba7d298 100644 --- a/test/Python/src/TriggerDownstreamOnlyIfPresent2.lf +++ b/test/Python/src/TriggerDownstreamOnlyIfPresent2.lf @@ -11,10 +11,10 @@ reactor Source { reaction(t) -> out {= if (self.count % 2) == 0: - self.count += 1 - out[0].set(self.count) + self.count += 1 + out[0].set(self.count) else: - out[1].set(self.count) + out[1].set(self.count) =} } @@ -23,8 +23,8 @@ reactor Destination { reaction(_in) {= if _in.is_present is not True: - sys.stderr.write("Reaction to input of triggered even though all inputs are absent!\n") - exit(1) + sys.stderr.write("Reaction to input of triggered even though all inputs are absent!\n") + exit(1) =} reaction(shutdown) {= print("SUCCESS.") =} diff --git a/test/Python/src/UnconnectedInput.lf b/test/Python/src/UnconnectedInput.lf index f518731c20..c64a24f99a 100644 --- a/test/Python/src/UnconnectedInput.lf +++ b/test/Python/src/UnconnectedInput.lf @@ -23,9 +23,9 @@ reactor Add { reaction(in1, in2) -> out {= result = 0 if in1.is_present: - result += in1.value + result += in1.value if in2.is_present: - result += in2.value + result += in2.value out.set(result) =} } @@ -37,8 +37,8 @@ reactor Print { reaction(_in) {= print("Received: ", _in.value) if _in.value != self.expected: - sys.stderr.write("ERROR: Expected {:d}.\n".format(self.expected)) - exit(1) + sys.stderr.write("ERROR: Expected {:d}.\n".format(self.expected)) + exit(1) self.expected +=1 =} diff --git a/test/Python/src/Wcet.lf b/test/Python/src/Wcet.lf index 57216ca078..d1a3e41e18 100644 --- a/test/Python/src/Wcet.lf +++ b/test/Python/src/Wcet.lf @@ -20,9 +20,9 @@ reactor Work { reaction(in1, in2) -> out {= ret = 0 if in1.value > 10: - ret = in2.value * in1.value + ret = in2.value * in1.value else: - ret = in2.value + in1.value + ret = in2.value + in1.value out.set(ret) =} } diff --git a/test/Python/src/concurrent/AsyncCallback.lf b/test/Python/src/concurrent/AsyncCallback.lf index bc61fb8c53..bf3e4f5eaa 100644 --- a/test/Python/src/concurrent/AsyncCallback.lf +++ b/test/Python/src/concurrent/AsyncCallback.lf @@ -13,20 +13,20 @@ main reactor AsyncCallback { import threading def callback(self, a): - # Schedule twice. If the action is not physical, these should - # get consolidated into a single action triggering. If it is, - # then they cause two separate triggerings with close but not - # equal time stamps. The minimum time between these is determined - # by the argument in the physical action definition. - a.schedule(0) - a.schedule(0) + # Schedule twice. If the action is not physical, these should + # get consolidated into a single action triggering. If it is, + # then they cause two separate triggerings with close but not + # equal time stamps. The minimum time between these is determined + # by the argument in the physical action definition. + a.schedule(0) + a.schedule(0) # Simulate time passing before a callback occurs. def take_time(self, a): - # The best Python can offer short of directly using ctypes to call nanosleep - self.time.sleep(0.1) - self.callback(a) - return None + # The best Python can offer short of directly using ctypes to call nanosleep + self.time.sleep(0.1) + self.callback(a) + return None =} timer t(0, 200 msec) state threads = {= list() =} @@ -48,12 +48,12 @@ main reactor AsyncCallback { print("Asynchronous callback {:d}: Assigned logical time greater than start time by {:d} nsec.".format(self.i, elapsed_time)); self.i += 1 if elapsed_time <= self.expected_time: - sys.stderr.write("ERROR: Expected logical time to be larger than {:d}.".format(self.expected_time)); - exit(1) + sys.stderr.write("ERROR: Expected logical time to be larger than {:d}.".format(self.expected_time)); + exit(1) if self.toggle: - self.toggle = False - self.expected_time += 200000000 + self.toggle = False + self.expected_time += 200000000 else: - self.toggle = True + self.toggle = True =} } diff --git a/test/Python/src/concurrent/AsyncCallbackNoTimer.lf b/test/Python/src/concurrent/AsyncCallbackNoTimer.lf index 971b4db6ce..1ebd230db0 100644 --- a/test/Python/src/concurrent/AsyncCallbackNoTimer.lf +++ b/test/Python/src/concurrent/AsyncCallbackNoTimer.lf @@ -18,20 +18,20 @@ main reactor { import threading def callback(self, a): - # Schedule twice. If the action is not physical, these should - # get consolidated into a single action triggering. If it is, - # then they cause two separate triggerings with close but not - # equal time stamps. The minimum time between these is determined - # by the argument in the physical action definition. - a.schedule(0) - a.schedule(0) + # Schedule twice. If the action is not physical, these should + # get consolidated into a single action triggering. If it is, + # then they cause two separate triggerings with close but not + # equal time stamps. The minimum time between these is determined + # by the argument in the physical action definition. + a.schedule(0) + a.schedule(0) # Simulate time passing before a callback occurs. def take_time(self, a): - # The best Python can offer short of directly using ctypes to call nanosleep - self.time.sleep(0.1) - self.callback(a) - return None + # The best Python can offer short of directly using ctypes to call nanosleep + self.time.sleep(0.1) + self.callback(a) + return None =} state threads = {= list() =} @@ -53,12 +53,12 @@ main reactor { print("Asynchronous callback {:d}: Assigned logical time greater than start time by {:d} nsec.".format(self.i, elapsed_time)); self.i += 1 if elapsed_time <= self.expected_time: - sys.stderr.write("ERROR: Expected logical time to be larger than {:d}.".format(self.expected_time)); - exit(1) + sys.stderr.write("ERROR: Expected logical time to be larger than {:d}.".format(self.expected_time)); + exit(1) if self.toggle: - self.toggle = False - self.expected_time += 200000000 + self.toggle = False + self.expected_time += 200000000 else: - self.toggle = True + self.toggle = True =} } diff --git a/test/Python/src/docker/FilesPropertyContainerized.lf b/test/Python/src/docker/FilesPropertyContainerized.lf index f8cea564b3..afbf76f8a8 100644 --- a/test/Python/src/docker/FilesPropertyContainerized.lf +++ b/test/Python/src/docker/FilesPropertyContainerized.lf @@ -5,9 +5,9 @@ target Python { preamble {= try: - import hello + import hello except: - lf_request_stop() + lf_request_stop() =} main reactor { @@ -24,9 +24,9 @@ main reactor { reaction(shutdown) {= if not self.passed: - print("Failed to import file listed in files target property") - exit(1) + print("Failed to import file listed in files target property") + exit(1) else: - print("PASSED") + print("PASSED") =} } diff --git a/test/Python/src/federated/BroadcastFeedback.lf b/test/Python/src/federated/BroadcastFeedback.lf index b33b13742b..facc896800 100644 --- a/test/Python/src/federated/BroadcastFeedback.lf +++ b/test/Python/src/federated/BroadcastFeedback.lf @@ -12,14 +12,14 @@ reactor SenderAndReceiver { reaction(inp) {= if inp[0].is_present and inp[1].is_present and inp[0].value == 42 and inp[1].value == 42: - print("SUCCESS") - self.received = True + print("SUCCESS") + self.received = True =} reaction(shutdown) {= if not self.received: - print("Failed to receive broadcast") - sys.exit(1) + print("Failed to receive broadcast") + sys.exit(1) =} } diff --git a/test/Python/src/federated/BroadcastFeedbackWithHierarchy.lf b/test/Python/src/federated/BroadcastFeedbackWithHierarchy.lf index 5f50210a22..c0cc71ab5b 100644 --- a/test/Python/src/federated/BroadcastFeedbackWithHierarchy.lf +++ b/test/Python/src/federated/BroadcastFeedbackWithHierarchy.lf @@ -21,14 +21,14 @@ reactor Receiver { reaction(in_) {= if in_[0].is_present and in_[1].is_present and in_[0].value == 42 and in_[1].value == 42: - print("SUCCESS") - self.received = True + print("SUCCESS") + self.received = True =} reaction(shutdown) {= if not self.received: - print("Failed to receive broadcast") - self.sys.exit(1) + print("Failed to receive broadcast") + self.sys.exit(1) =} } diff --git a/test/Python/src/federated/ChainWithDelay.lf b/test/Python/src/federated/ChainWithDelay.lf index 8199b0b319..55e77d4441 100644 --- a/test/Python/src/federated/ChainWithDelay.lf +++ b/test/Python/src/federated/ChainWithDelay.lf @@ -14,7 +14,7 @@ import TestCount from "../lib/TestCount.lf" federated reactor { c = new Count(period = 1 msec) i = new InternalDelay(delay = 500 usec) - t = new TestCount(num_inputs = 3) + t = new TestCount(num_inputs=3) c.out -> i.in_ i.out -> t.in_ } diff --git a/test/Python/src/federated/CycleDetection.lf b/test/Python/src/federated/CycleDetection.lf index 26db7bf390..c4eaac6904 100644 --- a/test/Python/src/federated/CycleDetection.lf +++ b/test/Python/src/federated/CycleDetection.lf @@ -16,9 +16,9 @@ reactor CAReplica { reaction(local_update, remote_update) {= if local_update.is_present: - self.balance += local_update.value + self.balance += local_update.value if remote_update.is_present: - self.balance += remote_update.value + self.balance += remote_update.value =} reaction(query) -> response {= response.set(self.balance) =} @@ -33,8 +33,8 @@ reactor UserInput { reaction(balance) {= if balance.value != 200: - self.sys.stderr.write("Did not receive the expected balance. Expected: 200. Got: {}.\n".format(balance.value)) - self.sys.exit(1) + self.sys.stderr.write("Did not receive the expected balance. Expected: 200. Got: {}.\n".format(balance.value)) + self.sys.exit(1) print("Balance: {}".format(balance.value)) request_stop() =} diff --git a/test/Python/src/federated/DecentralizedP2PComm.lf b/test/Python/src/federated/DecentralizedP2PComm.lf index 922b3a7008..5bc2cc61a2 100644 --- a/test/Python/src/federated/DecentralizedP2PComm.lf +++ b/test/Python/src/federated/DecentralizedP2PComm.lf @@ -5,7 +5,7 @@ target Python { coordination: decentralized } -reactor Platform(start = 0, expected_start = 0, stp_offset_param = 0) { +reactor Platform(start=0, expected_start=0, stp_offset_param=0) { preamble {= import sys =} input in_ output out @@ -21,8 +21,8 @@ reactor Platform(start = 0, expected_start = 0, stp_offset_param = 0) { reaction(in_) {= print("Received {}.".format(in_.value)) if in_.value != self.expected: - self.sys.stderr.write("Expected {} but got {}.\n".format(self.expected_start, in_.value)) - self.sys.exit(1) + self.sys.stderr.write("Expected {} but got {}.\n".format(self.expected_start, in_.value)) + self.sys.exit(1) self.expected += 1 =} STP(stp_offset_param) {= print("Received {} late.".format(in_.value)) @@ -34,14 +34,14 @@ reactor Platform(start = 0, expected_start = 0, stp_offset_param = 0) { reaction(shutdown) {= print("Shutdown invoked.") if self.expected == self.expected_start: - self.sys.stderr.write("Did not receive anything.\n") - self.sys.exit(1) + self.sys.stderr.write("Did not receive anything.\n") + self.sys.exit(1) =} } federated reactor DecentralizedP2PComm { - a = new Platform(expected_start = 100, stp_offset_param = 10 msec) - b = new Platform(start = 100, stp_offset_param = 10 msec) + a = new Platform(expected_start=100, stp_offset_param = 10 msec) + b = new Platform(start=100, stp_offset_param = 10 msec) a.out -> b.in_ b.out -> a.in_ } diff --git a/test/Python/src/federated/DecentralizedP2PUnbalancedTimeout.lf b/test/Python/src/federated/DecentralizedP2PUnbalancedTimeout.lf index a91a9fd9ec..9b4883e730 100644 --- a/test/Python/src/federated/DecentralizedP2PUnbalancedTimeout.lf +++ b/test/Python/src/federated/DecentralizedP2PUnbalancedTimeout.lf @@ -11,7 +11,7 @@ target Python { } # reason for failing: lf_tag() not supported by the python target -reactor Clock(offset = 0, period = 1 sec) { +reactor Clock(offset=0, period = 1 sec) { output y timer t(offset, period) state count = 0 @@ -37,9 +37,9 @@ reactor Destination { print("Received {}".format(x.value)) current_tag = lf.tag() if x.value != self.s: - error_msg = "At tag ({}, {}) expected {} and got {}.".format(current_tag.time - self.startup_logical_time, current_tag.microstep, self.s, x.value) - self.sys.stderr.write(error_msg) - self.sys.exit(1) + error_msg = "At tag ({}, {}) expected {} and got {}.".format(current_tag.time - self.startup_logical_time, current_tag.microstep, self.s, x.value) + self.sys.stderr.write(error_msg) + self.sys.exit(1) self.s += 1 =} @@ -50,7 +50,7 @@ reactor Destination { } federated reactor(period = 10 usec) { - c = new Clock(period = period) + c = new Clock(period=period) d = new Destination() c.y -> d.x } diff --git a/test/Python/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf b/test/Python/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf index 15069f0aea..a47d362140 100644 --- a/test/Python/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf +++ b/test/Python/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf @@ -11,7 +11,7 @@ target Python { coordination: decentralized } -reactor Clock(offset = 0, period = 1 sec) { +reactor Clock(offset=0, period = 1 sec) { output y timer t(offset, period) state count = 0 @@ -31,8 +31,8 @@ reactor Destination { reaction(x) {= if x.value != self.s: - self.sys.stderr.write("Expected {} and got {}.".format(self.s, x.value)) - self.sys.exit(1) + self.sys.stderr.write("Expected {} and got {}.".format(self.s, x.value)) + self.sys.exit(1) self.s += 1 =} @@ -43,7 +43,7 @@ reactor Destination { } federated reactor(period = 10 usec) { - c = new Clock(period = period) + c = new Clock(period=period) d = new Destination() c.y ~> d.x } diff --git a/test/Python/src/federated/DistributedBank.lf b/test/Python/src/federated/DistributedBank.lf index 65115acafb..9fb4720d59 100644 --- a/test/Python/src/federated/DistributedBank.lf +++ b/test/Python/src/federated/DistributedBank.lf @@ -16,8 +16,8 @@ reactor Node { reaction(shutdown) {= if self.count == 0: - self.sys.stderr.write("Timer reactions did not execute.\n") - self.sys.exit(1) + self.sys.stderr.write("Timer reactions did not execute.\n") + self.sys.exit(1) =} } diff --git a/test/Python/src/federated/DistributedBankToMultiport.lf b/test/Python/src/federated/DistributedBankToMultiport.lf index 534e623d19..1171c1b1b4 100644 --- a/test/Python/src/federated/DistributedBankToMultiport.lf +++ b/test/Python/src/federated/DistributedBankToMultiport.lf @@ -12,17 +12,17 @@ reactor Destination { reaction(in_) {= for i in range(len(in_)): - print("Received {}.".format(in_[i].value)) - if self.count != in_[i].value: - self.sys.stderr.write("Expected {}.\n".format(self.count)) - self.sys.exit(1) + print("Received {}.".format(in_[i].value)) + if self.count != in_[i].value: + self.sys.stderr.write("Expected {}.\n".format(self.count)) + self.sys.exit(1) self.count += 1 =} reaction(shutdown) {= if self.count == 0: - self.sys.stderr.write("No data received.\n") - self.sys.exit(1) + self.sys.stderr.write("No data received.\n") + self.sys.exit(1) =} } diff --git a/test/Python/src/federated/DistributedCount.lf b/test/Python/src/federated/DistributedCount.lf index 20c8beedc5..6b08b7e7fe 100644 --- a/test/Python/src/federated/DistributedCount.lf +++ b/test/Python/src/federated/DistributedCount.lf @@ -20,18 +20,18 @@ reactor Print { elapsed_time = lf.time.logical_elapsed() print("At time {}, received {}".format(elapsed_time, in_.value)) if in_.value != self.c: - print("Expected to receive {}.".format(self.c)) - self.sys.exit(1) + print("Expected to receive {}.".format(self.c)) + self.sys.exit(1) if elapsed_time != MSEC(200) + SEC(1) * (self.c - 1): - print("Expected received time to be {}.".format(MSEC(200) * self.c)) - self.sys.exit(1) + print("Expected received time to be {}.".format(MSEC(200) * self.c)) + self.sys.exit(1) self.c += 1 =} reaction(shutdown) {= if self.c != 6: - print("Expected to receive 5 items.") - self.sys.exit(1) + print("Expected to receive 5 items.") + self.sys.exit(1) =} } diff --git a/test/Python/src/federated/DistributedCountDecentralized.lf b/test/Python/src/federated/DistributedCountDecentralized.lf index 6b664335dd..62f2921282 100644 --- a/test/Python/src/federated/DistributedCountDecentralized.lf +++ b/test/Python/src/federated/DistributedCountDecentralized.lf @@ -19,20 +19,20 @@ reactor Print { reaction(in_) {= print(f"At tag ({lf.time.logical_elapsed()}, {lf.tag().microstep}), received {in_.value}. " - f"The original intended tag of the message was ({in_.intended_tag.time-lf.time.start()}, {in_.intended_tag.microstep}).") + f"The original intended tag of the message was ({in_.intended_tag.time-lf.time.start()}, {in_.intended_tag.microstep}).") if in_.value != self.c: - print("Expected to receive {}.".format(self.c)) - self.sys.exit(1) + print("Expected to receive {}.".format(self.c)) + self.sys.exit(1) if lf.time.logical_elapsed() != MSEC(200) + SEC(1) * (self.c - 1): - print("Expected received time to be {}.".format(MSEC(200) * self.c)) - self.sys.exit(3) + print("Expected received time to be {}.".format(MSEC(200) * self.c)) + self.sys.exit(3) self.c += 1 =} reaction(shutdown) {= if self.c != 6: - self.sys.stderr.write("Expected to receive 5 items.\n") - self.sys.exit(2) + self.sys.stderr.write("Expected to receive 5 items.\n") + self.sys.exit(2) print("SUCCESS: Successfully received 5 items.") =} } diff --git a/test/Python/src/federated/DistributedCountDecentralizedLate.lf b/test/Python/src/federated/DistributedCountDecentralizedLate.lf index 30f67fc48b..1a0f47febd 100644 --- a/test/Python/src/federated/DistributedCountDecentralizedLate.lf +++ b/test/Python/src/federated/DistributedCountDecentralizedLate.lf @@ -23,23 +23,23 @@ reactor Print { reaction(in_) {= current_tag = lf.tag() print("At tag ({}, {}) received {}. Intended tag is ({}, {}).".format( - lf.time.logical_elapsed(), - lf.tag().microstep, - in_.value, - in_.intended_tag.time - lf.time.start(), - in_.intended_tag.microstep - ) + lf.time.logical_elapsed(), + lf.tag().microstep, + in_.value, + in_.intended_tag.time - lf.time.start(), + in_.intended_tag.microstep + ) ) if (lf.tag() == Tag(SEC(1), 0)): - self.success += 1 # Message was on-time + self.success += 1 # Message was on-time self.c += 1 =} STP(0) {= current_tag = lf.tag() print("At tag ({}, {}), message has violated the STP offset by ({}, {}).".format( - current_tag.time - lf.time.start(), current_tag.microstep, - current_tag.time - in_.intended_tag.time, - current_tag.microstep - in_.intended_tag.microstep - ) + current_tag.time - lf.time.start(), current_tag.microstep, + current_tag.time - in_.intended_tag.time, + current_tag.microstep - in_.intended_tag.microstep + ) ) self.success_stp_violation += 1 self.c += 1 @@ -51,10 +51,10 @@ reactor Print { reaction(shutdown) {= if self.success + self.success_stp_violation != 5: - self.sys.stderr.write("Failed to detect STP violations in messages.\n") - self.sys.exit(1) + self.sys.stderr.write("Failed to detect STP violations in messages.\n") + self.sys.exit(1) else: - print("Successfully detected STP violation ({} violations, {} on-time).".format(self.success_stp_violation, self.success)) + print("Successfully detected STP violation ({} violations, {} on-time).".format(self.success_stp_violation, self.success)) =} } diff --git a/test/Python/src/federated/DistributedCountDecentralizedLateDownstream.lf b/test/Python/src/federated/DistributedCountDecentralizedLateDownstream.lf index a82d66675b..6c1ec4828e 100644 --- a/test/Python/src/federated/DistributedCountDecentralizedLateDownstream.lf +++ b/test/Python/src/federated/DistributedCountDecentralizedLateDownstream.lf @@ -32,17 +32,17 @@ reactor ImportantActuator { reaction(inp) {= current_tag = lf.tag() print(f"ImportantActuator: At tag ({lf.tag().time}, {lf.tag().microstep}) received {inp.value}. " - f"Intended tag is ({inp.intended_tag.time - lf.time.start()}, {inp.intended_tag.microstep}).") + f"Intended tag is ({inp.intended_tag.time - lf.time.start()}, {inp.intended_tag.microstep}).") if lf.tag() == Tag((SEC(1) * self.c) + + lf.time.start(), 0): - self.success += 1 # Message was on-time + self.success += 1 # Message was on-time else: - self.sys.stderr.write("Normal reaction was invoked, but current tag doesn't match expected tag.") - self.sys.exit(1) + self.sys.stderr.write("Normal reaction was invoked, but current tag doesn't match expected tag.") + self.sys.exit(1) self.c += 1 =} STP(0) {= current_tag = lf.tag() print(f"ImportantActuator: At tag ({lf.time.logical_elapsed()}, {lf.tag().microstep}), message has violated the STP offset " - f"by ({lf.tag().time - inp.intended_tag.time}, {lf.tag().microstep - inp.intended_tag.microstep}).") + f"by ({lf.tag().time - inp.intended_tag.time}, {lf.tag().microstep - inp.intended_tag.microstep}).") self.success_stp_violation += 1 self.c += 1 =} @@ -53,10 +53,10 @@ reactor ImportantActuator { reaction(shutdown) {= if (self.success + self.success_stp_violation) != 2: - self.sys.stderr.write("Failed to detect STP violation in messages.") - self.sys.exit(1) + self.sys.stderr.write("Failed to detect STP violation in messages.") + self.sys.exit(1) else: - print(f"Successfully detected STP violations ({self.success_stp_violation} violations, {self.success} on-time).") + print(f"Successfully detected STP violations ({self.success_stp_violation} violations, {self.success} on-time).") =} } @@ -66,7 +66,7 @@ reactor Print { reaction(inp) {= current_tag = lf.tag(); print(f"Print reactor: at tag ({lf.time.logical_elapsed()}, lf.tag().microstep) received {inp.value}. " - f"Intended tag is ({inp.intended_tag.time - lf.time.start()}, {inp.intended_tag.microstep}).") + f"Intended tag is ({inp.intended_tag.time - lf.time.start()}, {inp.intended_tag.microstep}).") =} } diff --git a/test/Python/src/federated/DistributedCountDecentralizedLateHierarchy.lf b/test/Python/src/federated/DistributedCountDecentralizedLateHierarchy.lf index b0159ceac2..ab02b16187 100644 --- a/test/Python/src/federated/DistributedCountDecentralizedLateHierarchy.lf +++ b/test/Python/src/federated/DistributedCountDecentralizedLateHierarchy.lf @@ -25,17 +25,17 @@ reactor ImportantActuator { reaction(inp) {= current_tag = lf.tag() print(f"ImportantActuator: At tag ({lf.tag().time}, {lf.tag().microstep}) received {inp.value}. " - f"Intended tag is ({inp.intended_tag.time - lf.time.start()}, {inp.intended_tag.microstep}).") + f"Intended tag is ({inp.intended_tag.time - lf.time.start()}, {inp.intended_tag.microstep}).") if lf.tag() == Tag((SEC(1) * self.c) + + lf.time.start(), 0): - self.success += 1 # Message was on-time + self.success += 1 # Message was on-time else: - self.sys.stderr.write("Normal reaction was invoked, but current tag doesn't match expected tag.") - self.sys.exit(1) + self.sys.stderr.write("Normal reaction was invoked, but current tag doesn't match expected tag.") + self.sys.exit(1) self.c += 1 =} STP(0) {= current_tag = lf.tag() print(f"ImportantActuator: At tag ({lf.time.logical_elapsed()}, {lf.tag().microstep}), message has violated the STP offset " - f"by ({lf.tag().time - inp.intended_tag.time}, {lf.tag().microstep - inp.intended_tag.microstep}).") + f"by ({lf.tag().time - inp.intended_tag.time}, {lf.tag().microstep - inp.intended_tag.microstep}).") self.success_stp_violation += 1 self.c += 1 =} @@ -46,10 +46,10 @@ reactor ImportantActuator { reaction(shutdown) {= if (self.success + self.success_stp_violation) != 5: - self.sys.stderr.write("Failed to detect STP violation in messages.") - self.sys.exit(1) + self.sys.stderr.write("Failed to detect STP violation in messages.") + self.sys.exit(1) else: - print(f"Successfully detected STP violations ({self.success_stp_violation} violations, {self.success} on-time).") + print(f"Successfully detected STP violations ({self.success_stp_violation} violations, {self.success} on-time).") =} } diff --git a/test/Python/src/federated/DistributedCountPhysical.lf b/test/Python/src/federated/DistributedCountPhysical.lf index af59f4da8f..a55dcf06dd 100644 --- a/test/Python/src/federated/DistributedCountPhysical.lf +++ b/test/Python/src/federated/DistributedCountPhysical.lf @@ -31,18 +31,18 @@ reactor Print { elapsed_time = lf.time.logical_elapsed() print("At time {}, received {}.".format(elapsed_time, in_.value)) if in_.value != self.c: - self.sys.stderr.write("ERROR: Expected to receive {}.\n".format(self.c)) - self.sys.exit(1) + self.sys.stderr.write("ERROR: Expected to receive {}.\n".format(self.c)) + self.sys.exit(1) if not (elapsed_time > (SEC(1) * self.c) + MSEC(200)): - self.sys.stderr.write("ERROR: Expected received time to be strictly greater than {}. Got {}.\n".format(MSEC(200) * self.c, elapsed_time)) - self.sys.exit(3) + self.sys.stderr.write("ERROR: Expected received time to be strictly greater than {}. Got {}.\n".format(MSEC(200) * self.c, elapsed_time)) + self.sys.exit(3) self.c += 1 =} reaction(shutdown) {= if (self.c != 1): - self.sys.stderr.write("ERROR: Expected to receive 1 item. Received {}.\n".format(self.c)) - self.sys.exit(2) + self.sys.stderr.write("ERROR: Expected to receive 1 item. Received {}.\n".format(self.c)) + self.sys.exit(2) print("SUCCESS: Successfully received 1 item."); =} } diff --git a/test/Python/src/federated/DistributedCountPhysicalAfterDelay.lf b/test/Python/src/federated/DistributedCountPhysicalAfterDelay.lf index dd753fca44..f18f5dc997 100644 --- a/test/Python/src/federated/DistributedCountPhysicalAfterDelay.lf +++ b/test/Python/src/federated/DistributedCountPhysicalAfterDelay.lf @@ -31,18 +31,18 @@ reactor Print { elapsed_time = lf.time.logical_elapsed() print("At time {}, received {}.".format(elapsed_time, in_.value)) if in_.value != self.c: - self.sys.stderr.write("ERROR: Expected to receive {}.\n".format(self.c)) - self.sys.exit(1) + self.sys.stderr.write("ERROR: Expected to receive {}.\n".format(self.c)) + self.sys.exit(1) if not (elapsed_time > (SEC(1) * self.c) + MSEC(200)): - self.sys.stderr.write("ERROR: Expected received time to be strictly greater than {}. Got {}.\n".format(MSEC(200) * self.c, elapsed_time)) - self.sys.exit(3) + self.sys.stderr.write("ERROR: Expected received time to be strictly greater than {}. Got {}.\n".format(MSEC(200) * self.c, elapsed_time)) + self.sys.exit(3) self.c += 1 =} reaction(shutdown) {= if (self.c != 1): - self.sys.stderr.write("ERROR: Expected to receive 1 item. Received {}.\n".format(self.c)) - self.sys.exit(2) + self.sys.stderr.write("ERROR: Expected to receive 1 item. Received {}.\n".format(self.c)) + self.sys.exit(2) print("SUCCESS: Successfully received 1 item."); =} } diff --git a/test/Python/src/federated/DistributedCountPhysicalDecentralized.lf b/test/Python/src/federated/DistributedCountPhysicalDecentralized.lf index 49041a5c7a..71048dfa38 100644 --- a/test/Python/src/federated/DistributedCountPhysicalDecentralized.lf +++ b/test/Python/src/federated/DistributedCountPhysicalDecentralized.lf @@ -32,18 +32,18 @@ reactor Print { elapsed_time = lf.time.logical_elapsed() print("At time {}, received {}.".format(elapsed_time, in_.value)) if in_.value != self.c: - self.sys.stderr.write("ERROR: Expected to receive {}.\n".format(self.c)) - self.sys.exit(1) + self.sys.stderr.write("ERROR: Expected to receive {}.\n".format(self.c)) + self.sys.exit(1) if not (elapsed_time > (SEC(1) * self.c) + MSEC(200)): - self.sys.stderr.write("ERROR: Expected received time to be strictly greater than {}.\n".format(MSEC(200) * self.c)) - self.sys.exit(3) + self.sys.stderr.write("ERROR: Expected received time to be strictly greater than {}.\n".format(MSEC(200) * self.c)) + self.sys.exit(3) self.c += 1 =} reaction(shutdown) {= if self.c != 1: - self.sys.stderr.write("ERROR: Expected to receive 1 item. Received {}.\n".format(self.c)) - self.sys.exit(2) + self.sys.stderr.write("ERROR: Expected to receive 1 item. Received {}.\n".format(self.c)) + self.sys.exit(2) print("SUCCESS: Successfully received 1 item.") =} } diff --git a/test/Python/src/federated/DistributedDoublePort.lf b/test/Python/src/federated/DistributedDoublePort.lf index 3e0d25c4a0..3c09373ad1 100644 --- a/test/Python/src/federated/DistributedDoublePort.lf +++ b/test/Python/src/federated/DistributedDoublePort.lf @@ -35,8 +35,8 @@ reactor Print { current_tag = lf.tag() print("At tag ({}, {}), received in_ = {} and in2 = {}.".format(current_tag.time, current_tag.microstep, in_.value, in2.value)) if in_.is_present and in2.is_present: - self.sys.stderr.write("ERROR: invalid logical simultaneity.") - self.sys.exit(1) + self.sys.stderr.write("ERROR: invalid logical simultaneity.") + self.sys.exit(1) =} reaction(shutdown) {= print("SUCCESS: messages were at least one microstep apart.") =} diff --git a/test/Python/src/federated/DistributedLoopedAction.lf b/test/Python/src/federated/DistributedLoopedAction.lf index c278f04922..550284dfac 100644 --- a/test/Python/src/federated/DistributedLoopedAction.lf +++ b/test/Python/src/federated/DistributedLoopedAction.lf @@ -9,7 +9,7 @@ target Python { import Sender from "../lib/LoopedActionSender.lf" -reactor Receiver(take_a_break_after = 10, break_interval = 400 msec) { +reactor Receiver(take_a_break_after=10, break_interval = 400 msec) { preamble {= import sys =} input in_ state received_messages = 0 @@ -20,24 +20,24 @@ reactor Receiver(take_a_break_after = 10, break_interval = 400 msec) { # but forces the logical time to advance Comment this line for a more sensible log output. reaction(in_) {= print("At tag ({}, {}) received value {}.".format( - lf.time.logical_elapsed(), - lf.tag().microstep, - in_.value - ) + lf.time.logical_elapsed(), + lf.tag().microstep, + in_.value + ) ) self.total_received_messages += 1 if in_.value != self.received_messages: - self.sys.stderr.write("ERROR: received messages out of order.\n") - # exit(1); + self.sys.stderr.write("ERROR: received messages out of order.\n") + # exit(1); self.received_messages += 1 if lf.time.logical_elapsed() != self.breaks * self.break_interval: - self.sys.stderr.write("ERROR: received messages at an incorrect time: {}.\n".format(lf.time.logical_elapsed())) - # exit(2); + self.sys.stderr.write("ERROR: received messages at an incorrect time: {}.\n".format(lf.time.logical_elapsed())) + # exit(2); if self.received_messages == self.take_a_break_after: - # Sender is taking a break; - self.breaks += 1 - self.received_messages = 0 + # Sender is taking a break; + self.breaks += 1 + self.received_messages = 0 =} reaction(t) {= @@ -47,8 +47,8 @@ reactor Receiver(take_a_break_after = 10, break_interval = 400 msec) { reaction(shutdown) {= print(((SEC(1)/self.break_interval)+1) * self.take_a_break_after) if self.breaks != 3 or (self.total_received_messages != ((SEC(1)//self.break_interval)+1) * self.take_a_break_after): - self.sys.stderr.write("ERROR: test failed.\n") - exit(4) + self.sys.stderr.write("ERROR: test failed.\n") + exit(4) print("SUCCESS: Successfully received all messages from the sender.") =} } diff --git a/test/Python/src/federated/DistributedLoopedPhysicalAction.lf b/test/Python/src/federated/DistributedLoopedPhysicalAction.lf index fa72e4c264..51d73727dc 100644 --- a/test/Python/src/federated/DistributedLoopedPhysicalAction.lf +++ b/test/Python/src/federated/DistributedLoopedPhysicalAction.lf @@ -13,7 +13,7 @@ target Python { keepalive: true } -reactor Sender(take_a_break_after = 10, break_interval = 550 msec) { +reactor Sender(take_a_break_after=10, break_interval = 550 msec) { output out physical action act state sent_messages = 0 @@ -23,15 +23,15 @@ reactor Sender(take_a_break_after = 10, break_interval = 550 msec) { out.set(self.sent_messages) self.sent_messages += 1 if self.sent_messages < self.take_a_break_after: - act.schedule(0) + act.schedule(0) else: - # Take a break - self.sent_messages = 0 - act.schedule(self.break_interval) + # Take a break + self.sent_messages = 0 + act.schedule(self.break_interval) =} } -reactor Receiver(take_a_break_after = 10, break_interval = 550 msec) { +reactor Receiver(take_a_break_after=10, break_interval = 550 msec) { preamble {= import sys =} input in_ state received_messages = 0 @@ -47,20 +47,20 @@ reactor Receiver(take_a_break_after = 10, break_interval = 550 msec) { reaction(in_) {= current_tag = lf.tag() print("At tag ({}, {}) received {}".format( - current_tag.time - self.base_logical_time, - current_tag.microstep, - in_.value) - ) + current_tag.time - self.base_logical_time, + current_tag.microstep, + in_.value) + ) self.total_received_messages += 1 if in_.value != self.received_messages: - self.sys.stderr.write("Expected {}.".format(self.received_messages - 1)) - self.sys.exit(1) + self.sys.stderr.write("Expected {}.".format(self.received_messages - 1)) + self.sys.exit(1) self.received_messages += 1 if self.received_messages == self.take_a_break_after: - # Sender is taking a break; - self.breaks += 1 - self.received_messages = 0 + # Sender is taking a break; + self.breaks += 1 + self.received_messages = 0 =} reaction(t) {= @@ -69,8 +69,8 @@ reactor Receiver(take_a_break_after = 10, break_interval = 550 msec) { reaction(shutdown) {= if self.breaks != 2 or (self.total_received_messages != ((SEC(1)//self.break_interval)+1) * self.take_a_break_after): - self.sys.stderr.write("Test failed. Breaks: {}, Messages: {}.".format(self.breaks, self.total_received_messages)) - self.sys.exit(1) + self.sys.stderr.write("Test failed. Breaks: {}, Messages: {}.".format(self.breaks, self.total_received_messages)) + self.sys.exit(1) print("SUCCESS: Successfully received all messages from the sender.") =} } diff --git a/test/Python/src/federated/DistributedMultiport.lf b/test/Python/src/federated/DistributedMultiport.lf index bd1f24820d..6c67e0e90f 100644 --- a/test/Python/src/federated/DistributedMultiport.lf +++ b/test/Python/src/federated/DistributedMultiport.lf @@ -11,8 +11,8 @@ reactor Source { reaction(t) -> out {= for i in range(len(out)): - out[i].set(self.count) - self.count += 1 + out[i].set(self.count) + self.count += 1 =} } @@ -23,18 +23,18 @@ reactor Destination { reaction(in_) {= for i in range(len(in_)): - if in_[i].is_present: - print("Received {}.".format(in_[i].value)) - if in_[i].value != self.count: - self.sys.stderr.write("Expected {}.\n".format(self.count)) - self.sys.exit(1) - self.count += 1 + if in_[i].is_present: + print("Received {}.".format(in_[i].value)) + if in_[i].value != self.count: + self.sys.stderr.write("Expected {}.\n".format(self.count)) + self.sys.exit(1) + self.count += 1 =} reaction(shutdown) {= if self.count == 0: - self.sys.stderr.write("No data received.") - self.sys.exit(1) + self.sys.stderr.write("No data received.") + self.sys.exit(1) =} } diff --git a/test/Python/src/federated/DistributedMultiportToBank.lf b/test/Python/src/federated/DistributedMultiportToBank.lf index b9b65686ef..c94e4ec49b 100644 --- a/test/Python/src/federated/DistributedMultiportToBank.lf +++ b/test/Python/src/federated/DistributedMultiportToBank.lf @@ -10,7 +10,7 @@ reactor Source { reaction(t) -> out {= for i in range(len(out)): - out[i].set(self.count) + out[i].set(self.count) self.count += 1 =} } @@ -23,15 +23,15 @@ reactor Destination { reaction(in_) {= print("Received {}.".format(in_.value)) if self.count != in_.value: - self.sys.stderr.write("Expected {}.\n".format(self.count)) - self.sys.exit(1) + self.sys.stderr.write("Expected {}.\n".format(self.count)) + self.sys.exit(1) self.count += 1 =} reaction(shutdown) {= if self.count == 0: - self.sys.stderr.write("No data received.") - self.sys.exit(1) + self.sys.stderr.write("No data received.") + self.sys.exit(1) =} } diff --git a/test/Python/src/federated/DistributedMultiportToken.lf b/test/Python/src/federated/DistributedMultiportToken.lf index bd380f22fe..800ac23e9c 100644 --- a/test/Python/src/federated/DistributedMultiportToken.lf +++ b/test/Python/src/federated/DistributedMultiportToken.lf @@ -12,13 +12,13 @@ reactor Source { reaction(t) -> out {= for i in range(len(out)): - self.count += 1 - out[i].set("Hello {}".format(self.count)) - print("MessageGenerator: At time {}, send message: {}.".format( - lf.time.logical_elapsed(), - out[i].value - ) + self.count += 1 + out[i].set("Hello {}".format(self.count)) + print("MessageGenerator: At time {}, send message: {}.".format( + lf.time.logical_elapsed(), + out[i].value ) + ) =} } @@ -27,8 +27,8 @@ reactor Destination { reaction(in_) {= for i in range(len(in_)): - if in_[i].is_present: - print("Received {}.".format(in_[i].value)) + if in_[i].is_present: + print("Received {}.".format(in_[i].value)) =} } diff --git a/test/Python/src/federated/DistributedNoReact.lf b/test/Python/src/federated/DistributedNoReact.lf index 39f51b609a..e28f5ae253 100644 --- a/test/Python/src/federated/DistributedNoReact.lf +++ b/test/Python/src/federated/DistributedNoReact.lf @@ -4,8 +4,8 @@ target Python { preamble {= class C: - def __init__(self): - pass + def __init__(self): + pass =} reactor A { diff --git a/test/Python/src/federated/DistributedSendClass.lf b/test/Python/src/federated/DistributedSendClass.lf index 4ff870ae06..9f77259b37 100644 --- a/test/Python/src/federated/DistributedSendClass.lf +++ b/test/Python/src/federated/DistributedSendClass.lf @@ -2,8 +2,8 @@ target Python preamble {= class C: - def __init__(self): - pass + def __init__(self): + pass =} reactor A { diff --git a/test/Python/src/federated/DistributedStop.lf b/test/Python/src/federated/DistributedStop.lf index 04d4ebc37d..0171a2bbfb 100644 --- a/test/Python/src/federated/DistributedStop.lf +++ b/test/Python/src/federated/DistributedStop.lf @@ -16,74 +16,74 @@ reactor Sender { reaction(t, act) -> out, act {= tag = lf.tag() print("Sending 42 at ({}, {}).".format( - lf.time.logical_elapsed(), - tag.microstep)) + lf.time.logical_elapsed(), + tag.microstep)) out.set(42) if tag.microstep == 0: - # Instead of having a separate reaction - # for 'act' like Stop.lf, we trigger the - # same reaction to test request_stop() being - # called multiple times - act.schedule(0) + # Instead of having a separate reaction + # for 'act' like Stop.lf, we trigger the + # same reaction to test request_stop() being + # called multiple times + act.schedule(0) if lf.time.logical_elapsed() == USEC(1): - # Call request_stop() both at (1 usec, 0) and - # (1 usec, 1) - print("Requesting stop at ({}, {}).".format( - lf.time.logical_elapsed(), - lf.tag().microstep)) - request_stop() + # Call request_stop() both at (1 usec, 0) and + # (1 usec, 1) + print("Requesting stop at ({}, {}).".format( + lf.time.logical_elapsed(), + lf.tag().microstep)) + request_stop() _1usec1 = Tag(time=USEC(1) + lf.time.start(), microstep=1) if lf.tag_compare(lf.tag(), _1usec1) == 0: - # The reaction was invoked at (1 usec, 1) as expected - self.reaction_invoked_correctly = True + # The reaction was invoked at (1 usec, 1) as expected + self.reaction_invoked_correctly = True elif lf.tag_compare(lf.tag(), _1usec1) > 0: - # The reaction should not have been invoked at tags larger than (1 usec, 1) - sys.stderr.write("ERROR: Invoked reaction(t, act) at tag bigger than shutdown.\n") - sys.exit(1) + # The reaction should not have been invoked at tags larger than (1 usec, 1) + sys.stderr.write("ERROR: Invoked reaction(t, act) at tag bigger than shutdown.\n") + sys.exit(1) =} reaction(shutdown) {= if lf.time.logical_elapsed() != USEC(1) or lf.tag().microstep != 1: - sys.stderr.write("ERROR: Sender failed to stop the federation in time. Stopping at ({}, {}).\n".format( - lf.time.logical_elapsed(), - lf.tag().microstep)) - sys.exit(1) + sys.stderr.write("ERROR: Sender failed to stop the federation in time. Stopping at ({}, {}).\n".format( + lf.time.logical_elapsed(), + lf.tag().microstep)) + sys.exit(1) elif not self.reaction_invoked_correctly: - sys.stderr.write("ERROR: Sender reaction(t, act) was not invoked at (1 usec, 1). Stopping at ({}, {}).\n".format( - lf.time.logical_elapsed(), - lf.tag().microstep)) - sys.exit(1) + sys.stderr.write("ERROR: Sender reaction(t, act) was not invoked at (1 usec, 1). Stopping at ({}, {}).\n".format( + lf.time.logical_elapsed(), + lf.tag().microstep)) + sys.exit(1) print("SUCCESS: Successfully stopped the federation at ({}, {}).".format( - lf.time.logical_elapsed(), - lf.tag().microstep)) + lf.time.logical_elapsed(), + lf.tag().microstep)) =} } reactor Receiver( - stp_offset = 10 msec # Used in the decentralized variant of the test -) { + # Used in the decentralized variant of the test + stp_offset = 10 msec) { input in_ state reaction_invoked_correctly = False reaction(in_) {= tag = lf.tag() print("Received {} at ({}, {}).".format( - in_.value, - lf.time.logical_elapsed(), - lf.tag().microstep)) + in_.value, + lf.time.logical_elapsed(), + lf.tag().microstep)) if lf.time.logical_elapsed() == USEC(1): - print("Requesting stop at ({}, {}).".format( - lf.time.logical_elapsed(), - lf.tag().microstep)) - request_stop() - # The receiver should receive a message at tag - # (1 usec, 1) and trigger this reaction - self.reaction_invoked_correctly = True + print("Requesting stop at ({}, {}).".format( + lf.time.logical_elapsed(), + lf.tag().microstep)) + request_stop() + # The receiver should receive a message at tag + # (1 usec, 1) and trigger this reaction + self.reaction_invoked_correctly = True _1usec1 = Tag(time=USEC(1) + lf.time.start(), microstep=1) if lf.tag_compare(lf.tag(), _1usec1) > 0: - self.reaction_invoked_correctly = False + self.reaction_invoked_correctly = False =} reaction(shutdown) {= @@ -91,18 +91,18 @@ reactor Receiver( # Therefore, the shutdown events must occur at (1000, 0) on the # receiver. if lf.time.logical_elapsed() != USEC(1) or lf.tag().microstep != 1: - sys.stderr.write("Error: Receiver failed to stop the federation at the right time. Stopping at ({}, {}).\n".format( - lf.time.logical_elapsed(), - lf.tag().microstep)) - sys.exit(1) + sys.stderr.write("Error: Receiver failed to stop the federation at the right time. Stopping at ({}, {}).\n".format( + lf.time.logical_elapsed(), + lf.tag().microstep)) + sys.exit(1) elif not self.reaction_invoked_correctly: - sys.stderr.write("Error: Receiver reaction(in) was not invoked the correct number of times. Stopping at ({}, {}).\n".format( - lf.time.logical_elapsed(), - lf.tag().microstep)) - sys.exit(1) + sys.stderr.write("Error: Receiver reaction(in) was not invoked the correct number of times. Stopping at ({}, {}).\n".format( + lf.time.logical_elapsed(), + lf.tag().microstep)) + sys.exit(1) print("SUCCESS: Successfully stopped the federation at ({}, {}).".format( - lf.time.logical_elapsed(), - lf.tag().microstep)) + lf.time.logical_elapsed(), + lf.tag().microstep)) =} } diff --git a/test/Python/src/federated/DistributedStopZero.lf b/test/Python/src/federated/DistributedStopZero.lf index 6f18e14c5f..d933b9ce68 100644 --- a/test/Python/src/federated/DistributedStopZero.lf +++ b/test/Python/src/federated/DistributedStopZero.lf @@ -18,28 +18,28 @@ reactor Sender { reaction(t) -> out {= tag = lf.tag() print("Sending 42 at ({}, {}).".format( - tag.time, - tag.microstep)) + tag.time, + tag.microstep)) out.set(42) zero = Tag(time=self.startup_logical_time, microstep=0) if lf.tag_compare(lf.tag(), zero) == 0: - # Request stop at (0,0) - print("Requesting stop at ({}, {}).".format( - lf.time.logical_elapsed(), - lf.tag().microstep)) - request_stop() + # Request stop at (0,0) + print("Requesting stop at ({}, {}).".format( + lf.time.logical_elapsed(), + lf.tag().microstep)) + request_stop() =} reaction(shutdown) {= tag = lf.tag() if tag.time != USEC(0) or tag.microstep != 1: - sys.stderr.write("ERROR: Sender failed to stop the federation in time. Stopping at ({}, {}).\n".format( - tag.time, - tag.microstep)) - sys.exit(1) + sys.stderr.write("ERROR: Sender failed to stop the federation in time. Stopping at ({}, {}).\n".format( + tag.time, + tag.microstep)) + sys.exit(1) print("SUCCESS: Successfully stopped the federation at ({}, {}).".format( - tag.time, - tag.microstep)) + tag.time, + tag.microstep)) =} } @@ -52,16 +52,16 @@ reactor Receiver { reaction(in_) {= tag = lf.tag() print("Received {} at ({}, {}).\n".format( - in_.value, - tag.time, - tag.microstep)) + in_.value, + tag.time, + tag.microstep)) zero = Tag(time=self.startup_logical_time, microstep=0) if lf.tag_compare(lf.tag(), zero) == 0: - # Request stop at (0,0) - print("Requesting stop at ({}, {}).".format( - tag.time, - tag.microstep)) - request_stop() + # Request stop at (0,0) + print("Requesting stop at ({}, {}).".format( + tag.time, + tag.microstep)) + request_stop() =} reaction(shutdown) {= @@ -70,13 +70,13 @@ reactor Receiver { # receiver. tag = lf.tag() if tag.time != USEC(0) or tag.microstep != 1: - sys.stderr.write("ERROR: Receiver failed to stop the federation in time. Stopping at ({}, {}).\n".format( - tag.time, - tag.microstep)) - sys.exit(1) + sys.stderr.write("ERROR: Receiver failed to stop the federation in time. Stopping at ({}, {}).\n".format( + tag.time, + tag.microstep)) + sys.exit(1) print("SUCCESS: Successfully stopped the federation at ({}, {}).\n".format( - tag.time, - tag.microstep)) + tag.time, + tag.microstep)) =} } diff --git a/test/Python/src/federated/DistributedStructParallel.lf b/test/Python/src/federated/DistributedStructParallel.lf index 332f315bec..e20bb21030 100644 --- a/test/Python/src/federated/DistributedStructParallel.lf +++ b/test/Python/src/federated/DistributedStructParallel.lf @@ -13,9 +13,9 @@ preamble {= import hello =} federated reactor { s = new Source() c1 = new Print() - c2 = new Print(scale = 3) - p1 = new Check(expected = 84) - p2 = new Check(expected = 126) + c2 = new Print(scale=3) + p1 = new Check(expected=84) + p2 = new Check(expected=126) s.out -> c1._in s.out -> c2._in c1.out -> p1._in diff --git a/test/Python/src/federated/DistributedStructScale.lf b/test/Python/src/federated/DistributedStructScale.lf index 5156de1644..1551035c29 100644 --- a/test/Python/src/federated/DistributedStructScale.lf +++ b/test/Python/src/federated/DistributedStructScale.lf @@ -12,7 +12,7 @@ preamble {= import hello =} federated reactor { s = new Source() c = new Print() - p = new TestInput(expected = 84) + p = new TestInput(expected=84) s.out -> c._in c.out -> p._in } diff --git a/test/Python/src/federated/HelloDistributed.lf b/test/Python/src/federated/HelloDistributed.lf index 303af7b7bd..7bbfa49368 100644 --- a/test/Python/src/federated/HelloDistributed.lf +++ b/test/Python/src/federated/HelloDistributed.lf @@ -25,16 +25,16 @@ reactor Destination { reaction(_in) {= print(f"At logical time {lf.time.logical_elapsed()}, destination received {_in.value}") if _in.value != "Hello World!": - sys.stderr.write("ERROR: Expected to receive 'Hello World!'\n"); - exit(1) + sys.stderr.write("ERROR: Expected to receive 'Hello World!'\n"); + exit(1) self.received = True =} reaction(shutdown) {= print("Shutdown invoked.") if self.received is not True: - sys.stderr.write("ERROR: Destination did not receive the message.") - exit(1) + sys.stderr.write("ERROR: Destination did not receive the message.") + exit(1) =} } diff --git a/test/Python/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf b/test/Python/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf index 732311e6d2..3d4564fc45 100644 --- a/test/Python/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf +++ b/test/Python/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf @@ -13,7 +13,7 @@ target Python { timeout: 5 sec } -reactor Contained(incr = 1) { +reactor Contained(incr=1) { timer t(0, 1 sec) input inp state count = 0 @@ -25,18 +25,18 @@ reactor Contained(incr = 1) { reaction(t) {= if self.received_count != self.count: - self.sys.stderr.write("reaction(t) was invoked before reaction(in). Precedence order was not kept.") - self.sys.exit(1) + self.sys.stderr.write("reaction(t) was invoked before reaction(in). Precedence order was not kept.") + self.sys.exit(1) =} } -reactor Looper(incr = 1, delay = 0 msec) { +reactor Looper(incr=1, delay = 0 msec) { input inp output out state count = 0 timer t(0, 1 sec) - c = new Contained(incr = incr) + c = new Contained(incr=incr) inp -> c.inp reaction(t) -> out {= @@ -53,14 +53,14 @@ reactor Looper(incr = 1, delay = 0 msec) { reaction(shutdown) {= print("******* Shutdown invoked.") if self.count != 6 * self.incr: - self.sys.stderr.write("Failed to receive all six expected inputs.") - self.sys.exit(1) + self.sys.stderr.write("Failed to receive all six expected inputs.") + self.sys.exit(1) =} } -federated reactor(delay = 0) { +federated reactor(delay=0) { left = new Looper() - right = new Looper(incr = -1) + right = new Looper(incr=-1) left.out -> right.inp right.out -> left.inp } diff --git a/test/Python/src/federated/ParallelDestinations.lf b/test/Python/src/federated/ParallelDestinations.lf index 4c65ba4351..a1bce28382 100644 --- a/test/Python/src/federated/ParallelDestinations.lf +++ b/test/Python/src/federated/ParallelDestinations.lf @@ -16,8 +16,8 @@ reactor Source { federated reactor { s = new Source() - t1 = new TestCount(num_inputs = 3) - t2 = new TestCount(num_inputs = 3) + t1 = new TestCount(num_inputs=3) + t2 = new TestCount(num_inputs=3) s.out -> t1.in_, t2.in_ } diff --git a/test/Python/src/federated/ParallelSources.lf b/test/Python/src/federated/ParallelSources.lf index 222cb6dab1..6dd258d82d 100644 --- a/test/Python/src/federated/ParallelSources.lf +++ b/test/Python/src/federated/ParallelSources.lf @@ -9,8 +9,8 @@ import TestCount from "../lib/TestCount.lf" reactor Destination { input[2] in_ - t1 = new TestCount(num_inputs = 3) - t2 = new TestCount(num_inputs = 3) + t1 = new TestCount(num_inputs=3) + t2 = new TestCount(num_inputs=3) in_ -> t1.in_, t2.in_ } diff --git a/test/Python/src/federated/ParallelSourcesMultiport.lf b/test/Python/src/federated/ParallelSourcesMultiport.lf index 553b1f95ee..194205b77e 100644 --- a/test/Python/src/federated/ParallelSourcesMultiport.lf +++ b/test/Python/src/federated/ParallelSourcesMultiport.lf @@ -17,9 +17,9 @@ reactor Source { reactor Destination1 { input[3] in_ - t1 = new TestCount(num_inputs = 3) - t2 = new TestCount(num_inputs = 3) - t3 = new TestCount(num_inputs = 3) + t1 = new TestCount(num_inputs=3) + t2 = new TestCount(num_inputs=3) + t3 = new TestCount(num_inputs=3) in_ -> t1.in_, t2.in_, t3.in_ } @@ -28,7 +28,7 @@ federated reactor { s1 = new Source() s2 = new Source() d1 = new Destination1() - t4 = new TestCount(num_inputs = 3) + t4 = new TestCount(num_inputs=3) s1.out, s2.out -> d1.in_, t4.in_ } diff --git a/test/Python/src/federated/PhysicalSTP.lf b/test/Python/src/federated/PhysicalSTP.lf index a51319c6b3..20d61df25b 100644 --- a/test/Python/src/federated/PhysicalSTP.lf +++ b/test/Python/src/federated/PhysicalSTP.lf @@ -6,7 +6,7 @@ target Python { import Count from "../lib/Count.lf" -reactor Print(STP_offset = 0) { +reactor Print(STP_offset=0) { preamble {= import sys =} input in_ state c = 1 @@ -16,15 +16,15 @@ reactor Print(STP_offset = 0) { print("At time {}, received {}".format(elapsed_time, in_.value)) print(f"Physical time of arrival: {in_.physical_time_of_arrival}") if in_.value != self.c: - self.sys.stderr.write("Expected to receive {}.\n".format(self.c)) - self.sys.exit(1) + self.sys.stderr.write("Expected to receive {}.\n".format(self.c)) + self.sys.exit(1) STP_discrepency = lf.time.logical() + self.STP_offset - in_.physical_time_of_arrival if STP_discrepency < 0: - print("The message has violated the STP offset by {} in physical time.".format(-1 * STP_discrepency)) - self.c += 1 + print("The message has violated the STP offset by {} in physical time.".format(-1 * STP_discrepency)) + self.c += 1 else: - self.sys.stderr.write("Message arrived {} early.\n".format(STP_discrepency)) - self.sys.exit(1) + self.sys.stderr.write("Message arrived {} early.\n".format(STP_discrepency)) + self.sys.exit(1) =} STP(STP_offset) {= # This STP handler should never be invoked because the only source of event # for Print is the Count reactor. @@ -34,8 +34,8 @@ reactor Print(STP_offset = 0) { reaction(shutdown) {= if self.c != 3: - self.sys.stderr.write("Expected to receive 2 items but got {}.\n".format(self.c)) - self.sys.exit(1) + self.sys.stderr.write("Expected to receive 2 items but got {}.\n".format(self.c)) + self.sys.exit(1) =} } diff --git a/test/Python/src/federated/PingPongDistributed.lf b/test/Python/src/federated/PingPongDistributed.lf index d977b6956b..4bd0cde285 100644 --- a/test/Python/src/federated/PingPongDistributed.lf +++ b/test/Python/src/federated/PingPongDistributed.lf @@ -19,7 +19,7 @@ */ target Python -reactor Ping(count = 10) { +reactor Ping(count=10) { input receive output send state pingsLeft = count @@ -33,13 +33,13 @@ reactor Ping(count = 10) { reaction(receive) -> serve {= if self.pingsLeft > 0: - serve.schedule(0) + serve.schedule(0) else: - request_stop() + request_stop() =} } -reactor Pong(expected = 10) { +reactor Pong(expected=10) { preamble {= import sys =} input receive @@ -51,20 +51,20 @@ reactor Pong(expected = 10) { print("At logical time {}, Pong received {}.\n".format(lf.time.logical_elapsed(), receive.value)) send.set(receive.value) if self.count == self.expected: - request_stop() + request_stop() =} reaction(shutdown) {= if self.count != self.expected: - print("Pong expected to receive {} inputs, but it received {}.\n".format(self.expected, self.count), file=self.sys.stderr) - self.sys.exit(1) + print("Pong expected to receive {} inputs, but it received {}.\n".format(self.expected, self.count), file=self.sys.stderr) + self.sys.exit(1) print("Pong received {} pings.\n".format(self.count)) =} } -federated reactor(count = 10) { - ping = new Ping(count = count) - pong = new Pong(expected = count) +federated reactor(count=10) { + ping = new Ping(count=count) + pong = new Pong(expected=count) ping.send ~> pong.receive pong.send ~> ping.receive } diff --git a/test/Python/src/federated/failing/ClockSync.lf b/test/Python/src/federated/failing/ClockSync.lf index d418c476c3..258e0b9853 100644 --- a/test/Python/src/federated/failing/ClockSync.lf +++ b/test/Python/src/federated/failing/ClockSync.lf @@ -8,66 +8,66 @@ # reason for failing: clock-sync and clock-sync-options not supported in the # python target target Python { - coordination: decentralized, - timeout: 10 sec, - clock-sync: on, # Turn on runtime clock synchronization. - clock-sync-options: { - # Forces all federates to perform clock sync. - local-federates-on: true, - # Collect useful statistics like average network delay - collect-stats: true, - # and the standard deviation for the network delay over one clock - # synchronization cycle. Generates a warning if the standard deviation - # is higher than the clock sync guard. Artificially offsets clocks by - # multiples of 200 msec. - test-offset: 200 msec, - # Period with which runtime clock sync is performed. - period: 5 msec, - # Number of messages exchanged to perform clock sync. - trials: 10, - # Attenuation applied to runtime clock sync adjustments. - attenuation: 10 - } + coordination: decentralized, + timeout: 10 sec, + clock-sync: on, # Turn on runtime clock synchronization. + clock-sync-options: { + # Forces all federates to perform clock sync. + local-federates-on: true, + # Collect useful statistics like average network delay + collect-stats: true, + # and the standard deviation for the network delay over one clock + # synchronization cycle. Generates a warning if the standard deviation + # is higher than the clock sync guard. Artificially offsets clocks by + # multiples of 200 msec. + test-offset: 200 msec, + # Period with which runtime clock sync is performed. + period: 5 msec, + # Number of messages exchanged to perform clock sync. + trials: 10, + # Attenuation applied to runtime clock sync adjustments. + attenuation: 10 + } } /** Reactor that outputs periodically. */ reactor Ticker(period(1600 msec)) { - output out + output out - timer tick(0, period) + timer tick(0, period) - reaction(tick) -> out {= SET(out, 42); =} + reaction(tick) -> out {= SET(out, 42); =} } /** Print a message when an input arrives. */ reactor Printer { - input in_ + input in_ - reaction(startup) {= - interval_t offset = _lf_time_physical_clock_offset + _lf_time_test_physical_clock_offset; - lf_print("Clock sync error at startup is %lld ns.", offset); - =} + reaction(startup) {= + interval_t offset = _lf_time_physical_clock_offset + _lf_time_test_physical_clock_offset; + lf_print("Clock sync error at startup is %lld ns.", offset); + =} - reaction(in_) {= lf_print("Received %d.", in->value); =} + reaction(in_) {= lf_print("Received %d.", in->value); =} - reaction(shutdown) {= - interval_t offset = _lf_time_physical_clock_offset + _lf_time_test_physical_clock_offset; - lf_print("Clock sync error at shutdown is %lld ns.", offset); - // Error out if the offset is bigger than 100 msec. - if (offset > MSEC(100)) { - lf_error_print("Offset exceeds test threshold of 100 msec."); - exit(1); - } - =} + reaction(shutdown) {= + interval_t offset = _lf_time_physical_clock_offset + _lf_time_test_physical_clock_offset; + lf_print("Clock sync error at shutdown is %lld ns.", offset); + // Error out if the offset is bigger than 100 msec. + if (offset > MSEC(100)) { + lf_error_print("Offset exceeds test threshold of 100 msec."); + exit(1); + } + =} } reactor Federate { - source = new Ticker() - play = new Printer() - source.out -> play.in_ + source = new Ticker() + play = new Printer() + source.out -> play.in_ } federated reactor ClockSync { - fed1 = new Federate() - fed2 = new Federate() + fed1 = new Federate() + fed2 = new Federate() } diff --git a/test/Python/src/federated/failing/DistributedLoopedActionDecentralized.lf b/test/Python/src/federated/failing/DistributedLoopedActionDecentralized.lf index 687e5b146b..183225148f 100644 --- a/test/Python/src/federated/failing/DistributedLoopedActionDecentralized.lf +++ b/test/Python/src/federated/failing/DistributedLoopedActionDecentralized.lf @@ -15,53 +15,53 @@ */ # reason for failing: in_.intended_tag are not supported in python target target Python { - timeout: 1 sec, - coordination: decentralized + timeout: 1 sec, + coordination: decentralized } import Sender from "../lib/LoopedActionSender.lf" import Receiver from "DistributedLoopedAction.lf" reactor STPReceiver( - take_a_break_after(10), - break_interval(400 msec), - stp_offset(0) + take_a_break_after(10), + break_interval(400 msec), + stp_offset(0) ) { - input inp - state last_time_updated_stp(0) - receiver = new Receiver(take_a_break_after = 10, break_interval = 400 msec) - timer t(0, 1 msec) # Force advancement of logical time + input inp + state last_time_updated_stp(0) + receiver = new Receiver(take_a_break_after = 10, break_interval = 400 msec) + timer t(0, 1 msec) # Force advancement of logical time - reaction(inp) -> receiver.in_ {= - print(f"Received {inp.value}.") - receiver.in_.set(inp.value) - =} STP(stp_offset) {= - print(f"Received {inp.value} late.") - current_tag = lf.tag() - print(f"STP violation of " - f"({current_tag.time - inp.intended_tag.time}, " - f"{current_tag.microstep - inp.intended_tag.microstep}) " - "perceived on the input.") - receiver.inp.set(inp.value) - # Only update the STP offset once per - # time step. - if current_tag.time != self.last_time_updated_stp : - print(f"Raising the STP offset by {MSEC(10)}.") - lf_set_stp_offset(MSEC(10)) - self.last_time_updated_stp = current_tag.time - =} + reaction(inp) -> receiver.in_ {= + print(f"Received {inp.value}.") + receiver.in_.set(inp.value) + =} STP(stp_offset) {= + print(f"Received {inp.value} late.") + current_tag = lf.tag() + print(f"STP violation of " + f"({current_tag.time - inp.intended_tag.time}, " + f"{current_tag.microstep - inp.intended_tag.microstep}) " + "perceived on the input.") + receiver.inp.set(inp.value) + # Only update the STP offset once per + # time step. + if current_tag.time != self.last_time_updated_stp : + print(f"Raising the STP offset by {MSEC(10)}.") + lf_set_stp_offset(MSEC(10)) + self.last_time_updated_stp = current_tag.time + =} - reaction(t) {= - # Do nothing - =} + reaction(t) {= + # Do nothing + =} } federated reactor DistributedLoopedActionDecentralized { - sender = new Sender(take_a_break_after = 10, break_interval = 400 msec) - stpReceiver = new STPReceiver( - take_a_break_after = 10, - break_interval = 400 msec - ) + sender = new Sender(take_a_break_after = 10, break_interval = 400 msec) + stpReceiver = new STPReceiver( + take_a_break_after = 10, + break_interval = 400 msec + ) - sender.out -> stpReceiver.inp + sender.out -> stpReceiver.inp } diff --git a/test/Python/src/federated/failing/DistributedNetworkOrder.lf b/test/Python/src/federated/failing/DistributedNetworkOrder.lf index 7dbcb5b699..274f87948e 100644 --- a/test/Python/src/federated/failing/DistributedNetworkOrder.lf +++ b/test/Python/src/federated/failing/DistributedNetworkOrder.lf @@ -10,57 +10,57 @@ */ # reason for failing: send_timed_message() is not not supported in python target target Python { - timeout: 1 sec + timeout: 1 sec } reactor Sender { - output out - timer t(0, 1 msec) + output out + timer t(0, 1 msec) - reaction(t) {= - int payload = 1; - if (lf.time.logical_elapsed() == 0LL) { - send_timed_message(MSEC(10), MSG_TYPE_TAGGED_MESSAGE, 0, 1, "federate 1", sizeof(int), - (unsigned char*)&payload); - } else if (lf.time.logical_elapsed() == MSEC(5)) { - payload = 2; - send_timed_message(MSEC(5), MSG_TYPE_TAGGED_MESSAGE, 0, 1, "federate 1", sizeof(int), - (unsigned char*)&payload); - } - =} + reaction(t) {= + int payload = 1; + if (lf.time.logical_elapsed() == 0LL) { + send_timed_message(MSEC(10), MSG_TYPE_TAGGED_MESSAGE, 0, 1, "federate 1", sizeof(int), + (unsigned char*)&payload); + } else if (lf.time.logical_elapsed() == MSEC(5)) { + payload = 2; + send_timed_message(MSEC(5), MSG_TYPE_TAGGED_MESSAGE, 0, 1, "federate 1", sizeof(int), + (unsigned char*)&payload); + } + =} } reactor Receiver { - input in_ - state success(0) + input in_ + state success(0) - reaction(in_) {= - tag_t current_tag = lf.tag(); - if (current_tag.time == (start_time + MSEC(10))) { - if (current_tag.microstep == 0 && in_->value == 1) { - self->success++; - } else if (current_tag.microstep == 1 && in_->value == 2) { - self->success++; - } - } - printf("Received %d at tag (%lld, %u).\n", - in_->value, - current_tag.time, - current_tag.microstep); - =} + reaction(in_) {= + tag_t current_tag = lf.tag(); + if (current_tag.time == (start_time + MSEC(10))) { + if (current_tag.microstep == 0 && in_->value == 1) { + self->success++; + } else if (current_tag.microstep == 1 && in_->value == 2) { + self->success++; + } + } + printf("Received %d at tag (%lld, %u).\n", + in_->value, + current_tag.time, + current_tag.microstep); + =} - reaction(shutdown) {= - if (self->success != 2) { - fprintf(stderr, "ERROR: Failed to receive messages.\n"); - exit(1); - } - printf("SUCCESS.\n"); - =} + reaction(shutdown) {= + if (self->success != 2) { + fprintf(stderr, "ERROR: Failed to receive messages.\n"); + exit(1); + } + printf("SUCCESS.\n"); + =} } federated reactor DistributedNetworkOrder { - sender = new Sender() - receiver = new Receiver() + sender = new Sender() + receiver = new Receiver() - sender.out -> receiver.in_ + sender.out -> receiver.in_ } diff --git a/test/Python/src/federated/failing/LoopDistributedCentralized.lf b/test/Python/src/federated/failing/LoopDistributedCentralized.lf index 6618107bf7..c6045238cf 100644 --- a/test/Python/src/federated/failing/LoopDistributedCentralized.lf +++ b/test/Python/src/federated/failing/LoopDistributedCentralized.lf @@ -7,65 +7,65 @@ # reason for failing: lf_comma_separated_time() not supported in the python # target target Python { - coordination: centralized, - coordination-options: { - advance-message-interval: 100 msec - }, - timeout: 5 sec + coordination: centralized, + coordination-options: { + advance-message-interval: 100 msec + }, + timeout: 5 sec } preamble {= - #include // Defines sleep() - bool stop = false; - // Thread to trigger an action once every second. - void* ping(void* actionref) { - while(!stop) { - lf_print("Scheduling action."); - schedule(actionref, 0); - sleep(1); - } - return NULL; + #include // Defines sleep() + bool stop = false; + // Thread to trigger an action once every second. + void* ping(void* actionref) { + while(!stop) { + lf_print("Scheduling action."); + schedule(actionref, 0); + sleep(1); } + return NULL; + } =} reactor Looper(incr(1), delay(0 msec)) { - input in_ - output out - physical action a(delay) - state count(0) + input in_ + output out + physical action a(delay) + state count(0) - reaction(startup) -> a {= - // Start the thread that listens for Enter or Return. - lf_thread_t thread_id; - lf_print("Starting thread."); - lf_thread_create(&thread_id, &ping, a); - =} + reaction(startup) -> a {= + // Start the thread that listens for Enter or Return. + lf_thread_t thread_id; + lf_print("Starting thread."); + lf_thread_create(&thread_id, &ping, a); + =} - reaction(a) -> out {= - SET(out, self->count); - self->count += self->incr; - =} + reaction(a) -> out {= + SET(out, self->count); + self->count += self->incr; + =} - reaction(in_) {= - instant_t time_lag = lf.time.physical() - lf.time.logical(); - char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 - lf_comma_separated_time(time_buffer, time_lag); - lf_print("Received %d. Logical time is behind physical time by %s nsec.", in_->value, time_buffer); - =} + reaction(in_) {= + instant_t time_lag = lf.time.physical() - lf.time.logical(); + char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + lf_comma_separated_time(time_buffer, time_lag); + lf_print("Received %d. Logical time is behind physical time by %s nsec.", in_->value, time_buffer); + =} - reaction(shutdown) {= - lf_print("******* Shutdown invoked."); - // Stop the thread that is scheduling actions. - stop = true; - if (self->count != 5 * self->incr) { - lf_print_error_and_exit("Failed to receive all five expected inputs."); - } - =} + reaction(shutdown) {= + lf_print("******* Shutdown invoked."); + // Stop the thread that is scheduling actions. + stop = true; + if (self->count != 5 * self->incr) { + lf_print_error_and_exit("Failed to receive all five expected inputs."); + } + =} } federated reactor LoopDistributedCentralized(delay(0)) { - left = new Looper() - right = new Looper(incr = -1) - left.out -> right.in_ - right.out -> left.in_ + left = new Looper() + right = new Looper(incr = -1) + left.out -> right.in_ + right.out -> left.in_ } diff --git a/test/Python/src/federated/failing/LoopDistributedCentralizedPrecedence.lf b/test/Python/src/federated/failing/LoopDistributedCentralizedPrecedence.lf index 12367332f4..009ff54981 100644 --- a/test/Python/src/federated/failing/LoopDistributedCentralizedPrecedence.lf +++ b/test/Python/src/federated/failing/LoopDistributedCentralizedPrecedence.lf @@ -8,51 +8,51 @@ # reason for failing: lf_comma_separated_time() not supported in the python # target target Python { - flags: "-Wall", - coordination: centralized, - coordination-options: { - advance-message-interval: 100 msec - }, - timeout: 5 sec + flags: "-Wall", + coordination: centralized, + coordination-options: { + advance-message-interval: 100 msec + }, + timeout: 5 sec } reactor Looper(incr = 1, delay = 0 msec) { - input in_ - output out - state count = 0 - state received_count = 0 - timer t(0, 1 sec) + input in_ + output out + state count = 0 + state received_count = 0 + timer t(0, 1 sec) - reaction(t) -> out {= - SET(out, self->count); - self->count += self->incr; - =} + reaction(t) -> out {= + SET(out, self->count); + self->count += self->incr; + =} - reaction(in_) {= - instant_t time_lag = lf.time.physical() - lf.time.logical(); - char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 - lf_comma_separated_time(time_buffer, time_lag); - lf_print("Received %d. Logical time is behind physical time by %s nsec.", in_->value, time_buffer); - self->received_count = self->count; - =} + reaction(in_) {= + instant_t time_lag = lf.time.physical() - lf.time.logical(); + char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + lf_comma_separated_time(time_buffer, time_lag); + lf_print("Received %d. Logical time is behind physical time by %s nsec.", in_->value, time_buffer); + self->received_count = self->count; + =} - reaction(t) {= - if (self->received_count != self->count) { - lf_print_error_and_exit("reaction(t) was invoked before reaction(in_). Precedence order was not kept."); - } - =} + reaction(t) {= + if (self->received_count != self->count) { + lf_print_error_and_exit("reaction(t) was invoked before reaction(in_). Precedence order was not kept."); + } + =} - reaction(shutdown) {= - lf_print("******* Shutdown invoked."); - if (self->count != 6 * self->incr) { - lf_print_error_and_exit("Failed to receive all six expected inputs."); - } - =} + reaction(shutdown) {= + lf_print("******* Shutdown invoked."); + if (self->count != 6 * self->incr) { + lf_print_error_and_exit("Failed to receive all six expected inputs."); + } + =} } federated reactor(delay = 0) { - left = new Looper() - right = new Looper(incr = -1) - left.out -> right.in_ - right.out -> left.in_ + left = new Looper() + right = new Looper(incr = -1) + left.out -> right.in_ + right.out -> left.in_ } diff --git a/test/Python/src/federated/failing/LoopDistributedDecentralized.lf b/test/Python/src/federated/failing/LoopDistributedDecentralized.lf index 529a7a11cf..801f2937b8 100644 --- a/test/Python/src/federated/failing/LoopDistributedDecentralized.lf +++ b/test/Python/src/federated/failing/LoopDistributedDecentralized.lf @@ -7,73 +7,73 @@ # reason for failing: lf_comma_separated_time() not supported in the python # target target Python { - coordination: decentralized, - timeout: 5 sec + coordination: decentralized, + timeout: 5 sec } preamble {= - #include // Defines sleep() - bool stop = false; - // Thread to trigger an action once every second. - void* ping(void* actionref) { - while(!stop) { - lf_print("Scheduling action."); - schedule(actionref, 0); - sleep(1); - } - return NULL; + #include // Defines sleep() + bool stop = false; + // Thread to trigger an action once every second. + void* ping(void* actionref) { + while(!stop) { + lf_print("Scheduling action."); + schedule(actionref, 0); + sleep(1); } + return NULL; + } =} reactor Looper(incr(1), delay(0 msec), stp_offset(0)) { - input in_ - output out - physical action a(stp_offset) - state count(0) + input in_ + output out + physical action a(stp_offset) + state count(0) - reaction(startup) -> a {= - // Start the thread that listens for Enter or Return. - lf_thread_t thread_id; - lf_print("Starting thread."); - lf_thread_create(&thread_id, &ping, a); - =} + reaction(startup) -> a {= + // Start the thread that listens for Enter or Return. + lf_thread_t thread_id; + lf_print("Starting thread."); + lf_thread_create(&thread_id, &ping, a); + =} - reaction(a) -> out {= - lf_print("Setting out."); - SET(out, self->count); - self->count += self->incr; - =} + reaction(a) -> out {= + lf_print("Setting out."); + SET(out, self->count); + self->count += self->incr; + =} - reaction(in_) {= - instant_t time_lag = lf.time.physical() - lf.time.logical(); - char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 - lf_comma_separated_time(time_buffer, time_lag); - lf_print("Received %d. Logical time is behind physical time by %s nsec.", in_->value, time_buffer); - =} STP(stp_offset) {= - instant_t time_lag = lf.time.physical() - lf.time.logical(); - char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 - lf_comma_separated_time(time_buffer, time_lag); - lf_print("STP offset was violated. Received %d. Logical time is behind physical time by %s nsec.", in_->value, time_buffer); - =} deadline(10 msec) {= - instant_t time_lag = lf.time.physical() - lf.time.logical(); - char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 - lf_comma_separated_time(time_buffer, time_lag); - lf_print("Deadline miss. Received %d. Logical time is behind physical time by %s nsec.", in_->value, time_buffer); - =} + reaction(in_) {= + instant_t time_lag = lf.time.physical() - lf.time.logical(); + char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + lf_comma_separated_time(time_buffer, time_lag); + lf_print("Received %d. Logical time is behind physical time by %s nsec.", in_->value, time_buffer); + =} STP(stp_offset) {= + instant_t time_lag = lf.time.physical() - lf.time.logical(); + char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + lf_comma_separated_time(time_buffer, time_lag); + lf_print("STP offset was violated. Received %d. Logical time is behind physical time by %s nsec.", in_->value, time_buffer); + =} deadline(10 msec) {= + instant_t time_lag = lf.time.physical() - lf.time.logical(); + char time_buffer[28]; // 28 bytes is enough for the largest 64 bit number: 9,223,372,036,854,775,807 + lf_comma_separated_time(time_buffer, time_lag); + lf_print("Deadline miss. Received %d. Logical time is behind physical time by %s nsec.", in_->value, time_buffer); + =} - reaction(shutdown) {= - lf_print("******* Shutdown invoked."); - // Stop the thread that is scheduling actions. - stop = true; - if (self->count != 5 * self->incr) { - lf_print_error_and_exit("Failed to receive all five expected inputs."); - } - =} + reaction(shutdown) {= + lf_print("******* Shutdown invoked."); + // Stop the thread that is scheduling actions. + stop = true; + if (self->count != 5 * self->incr) { + lf_print_error_and_exit("Failed to receive all five expected inputs."); + } + =} } federated reactor LoopDistributedDecentralized(delay(0)) { - left = new Looper(stp_offset = 900 usec) - right = new Looper(incr = -1, stp_offset = 2400 usec) - left.out -> right.in_ - right.out -> left.in_ + left = new Looper(stp_offset = 900 usec) + right = new Looper(incr = -1, stp_offset = 2400 usec) + left.out -> right.in_ + right.out -> left.in_ } diff --git a/test/Python/src/federated/failing/LoopDistributedDouble.lf b/test/Python/src/federated/failing/LoopDistributedDouble.lf index 4ccee4acd6..396f205255 100644 --- a/test/Python/src/federated/failing/LoopDistributedDouble.lf +++ b/test/Python/src/federated/failing/LoopDistributedDouble.lf @@ -6,84 +6,84 @@ */ # reason for failing: current tag struct not supported in the python target target Python { - coordination: centralized, - timeout: 5 sec + coordination: centralized, + timeout: 5 sec } preamble {= - #include // Defines sleep() - stop = False - # Thread to trigger an action once every second. - void* ping(void* actionref) { - while(!stop) { - lf_print("Scheduling action."); - schedule(actionref, 0); - sleep(1); - } - return NULL; + #include // Defines sleep() + stop = False + # Thread to trigger an action once every second. + void* ping(void* actionref) { + while(!stop) { + lf_print("Scheduling action."); + schedule(actionref, 0); + sleep(1); } + return NULL; + } =} reactor Looper(incr = 1, delay = 0 msec) { - input in_ - input in2 - output out - output out2 - physical action a(delay) - state count = 0 - timer t(0, 1 sec) + input in_ + input in2 + output out + output out2 + physical action a(delay) + state count = 0 + timer t(0, 1 sec) - reaction(startup) -> a {= - # Start the thread that listens for Enter or Return. - lf_thread_t thread_id; - lf_print("Starting thread."); - lf_thread_create(&thread_id, &ping, a); - =} + reaction(startup) -> a {= + # Start the thread that listens for Enter or Return. + lf_thread_t thread_id; + lf_print("Starting thread."); + lf_thread_create(&thread_id, &ping, a); + =} - reaction(a) -> out, out2 {= - if (self->count%2 == 0) { - SET(out, self->count); - } else { - SET(out2, self->count); - } - self->count += self->incr; - =} + reaction(a) -> out, out2 {= + if (self->count%2 == 0) { + SET(out, self->count); + } else { + SET(out2, self->count); + } + self->count += self->incr; + =} - reaction(in_) {= - lf_print("Received %d at logical time (%lld, %d).", - in->value, - current_tag.time - start_time, current_tag.microstep - ); - =} + reaction(in_) {= + lf_print("Received %d at logical time (%lld, %d).", + in->value, + current_tag.time - start_time, current_tag.microstep + ); + =} - reaction(in2) {= - lf_print("Received %d on in2 at logical time (%lld, %d).", - in2->value, - current_tag.time - start_time, current_tag.microstep - ); - =} + reaction(in2) {= + lf_print("Received %d on in2 at logical time (%lld, %d).", + in2->value, + current_tag.time - start_time, current_tag.microstep + ); + =} - reaction(t) {= - lf_print("Timer triggered at logical time (%lld, %d).", - current_tag.time - start_time, current_tag.microstep - ); - =} + reaction(t) {= + lf_print("Timer triggered at logical time (%lld, %d).", + current_tag.time - start_time, current_tag.microstep + ); + =} - reaction(shutdown) {= - lf_print("******* Shutdown invoked."); - // Stop the thread that is scheduling actions. - stop = true; - if (self->count != 5 * self->incr) { - lf_print_error_and_exit("Failed to receive all five expected inputs."); - } - =} + reaction(shutdown) {= + lf_print("******* Shutdown invoked."); + // Stop the thread that is scheduling actions. + stop = true; + if (self->count != 5 * self->incr) { + lf_print_error_and_exit("Failed to receive all five expected inputs."); + } + =} } federated reactor(delay = 0) { - left = new Looper() - right = new Looper(incr = -1) - left.out -> right.in_ - right.out -> left.in_ - right.out2 -> left.in2 - left.out2 -> right.in2 + left = new Looper() + right = new Looper(incr = -1) + left.out -> right.in_ + right.out -> left.in_ + right.out2 -> left.in2 + left.out2 -> right.in2 } diff --git a/test/Python/src/federated/failing/TopLevelArtifacts.lf b/test/Python/src/federated/failing/TopLevelArtifacts.lf index 1a13726c6c..07ba6e9c85 100644 --- a/test/Python/src/federated/failing/TopLevelArtifacts.lf +++ b/test/Python/src/federated/failing/TopLevelArtifacts.lf @@ -10,47 +10,47 @@ // reason for failing: strange error during compile time. lfc seeems to treat this file as C target. target Python { - timeout: 1 msec + timeout: 1 msec }; import Count from "../lib/Count.lf"; import TestCount from "../lib/TestCount.lf"; federated reactor { - preamble {= - import sys - =} - input in_; - output out; - state successes(0); - reaction (startup) {= - self.successes += 1; - =} - timer t(0, 1 sec); - reaction (t) -> act {= - self.successes += 1; - act.schedule(0); - =} - logical action act(0); - reaction (act) in_ -> out {= - self.successes += 1; - if in_.is_present: - self.sys.stderr.write("Input is present in the top-level reactor!\n"); - self.sys.exit(1); - out.set(1); - if out.value != 1: - self.sys.stderr.write("Ouput has unexpected value {}!\n".format(out.value)); - self.sys.exit(1); - =} + preamble {= + import sys + =} + input in_; + output out; + state successes(0); + reaction (startup) {= + self.successes += 1; + =} + timer t(0, 1 sec); + reaction (t) -> act {= + self.successes += 1; + act.schedule(0); + =} + logical action act(0); + reaction (act) in_ -> out {= + self.successes += 1; + if in_.is_present: + self.sys.stderr.write("Input is present in the top-level reactor!\n"); + self.sys.exit(1); + out.set(1); + if out.value != 1: + self.sys.stderr.write("Ouput has unexpected value {}!\n".format(out.value)); + self.sys.exit(1); + =} - c = new Count(); - tc = new TestCount(); - c.out -> tc.in_; + c = new Count(); + tc = new TestCount(); + c.out -> tc.in_; - reaction (shutdown) {= - if self->successes != 3: - self.sys.stderr.write("Failed to properly execute top-level reactions\n"); - self.sys.exit(1); - print("SUCCESS!"); - =} + reaction (shutdown) {= + if self->successes != 3: + self.sys.stderr.write("Failed to properly execute top-level reactions\n"); + self.sys.exit(1); + print("SUCCESS!"); + =} } diff --git a/test/Python/src/lib/Count.lf b/test/Python/src/lib/Count.lf index 2f86fabf60..e1d0aaa996 100644 --- a/test/Python/src/lib/Count.lf +++ b/test/Python/src/lib/Count.lf @@ -1,6 +1,6 @@ target Python -reactor Count(offset = 0, period = 1 sec) { +reactor Count(offset=0, period = 1 sec) { state count = 1 output out timer t(offset, period) diff --git a/test/Python/src/lib/ImportedAgain.lf b/test/Python/src/lib/ImportedAgain.lf index cabbf73f0a..3b5622e6aa 100644 --- a/test/Python/src/lib/ImportedAgain.lf +++ b/test/Python/src/lib/ImportedAgain.lf @@ -9,7 +9,7 @@ reactor ImportedAgain { reaction(x) {= print("Received: " + str(x.value)) if (x.value != 42): - print("ERROR: Expected input to be 42. Got: " + x.value) - exit(1) + print("ERROR: Expected input to be 42. Got: " + x.value) + exit(1) =} } diff --git a/test/Python/src/lib/LoopedActionSender.lf b/test/Python/src/lib/LoopedActionSender.lf index e3b7dfa961..3056f3ed76 100644 --- a/test/Python/src/lib/LoopedActionSender.lf +++ b/test/Python/src/lib/LoopedActionSender.lf @@ -10,7 +10,7 @@ target Python * @param break_interval: Determines how long the reactor should take a break after sending * take_a_break_after messages. */ -reactor Sender(take_a_break_after = 10, break_interval = 400 msec) { +reactor Sender(take_a_break_after=10, break_interval = 400 msec) { output out logical action act state sent_messages = 0 @@ -20,10 +20,10 @@ reactor Sender(take_a_break_after = 10, break_interval = 400 msec) { out.set(self.sent_messages) self.sent_messages += 1 if self.sent_messages < self.take_a_break_after: - act.schedule(0) + act.schedule(0) else: - # Take a break - self.sent_messages=0; - act.schedule(self.break_interval) + # Take a break + self.sent_messages=0; + act.schedule(self.break_interval) =} } diff --git a/test/Python/src/lib/Test.lf b/test/Python/src/lib/Test.lf index 6cbc45bfcb..6490d51338 100644 --- a/test/Python/src/lib/Test.lf +++ b/test/Python/src/lib/Test.lf @@ -7,8 +7,8 @@ reactor TestDouble(expected(1.0, 1.0, 1.0, 1.0)) { reaction(t_in) {= print("Received: ", t_in.value) if t_in.value != self.expected[self.count]: - sys.stderr.write("ERROR: Expected {:f}.\n".format(self.expected[self.count])) - exit(1) + sys.stderr.write("ERROR: Expected {:f}.\n".format(self.expected[self.count])) + exit(1) self.count += 1 =} } diff --git a/test/Python/src/lib/TestCount.lf b/test/Python/src/lib/TestCount.lf index a079ff2e37..28dcf74ba0 100644 --- a/test/Python/src/lib/TestCount.lf +++ b/test/Python/src/lib/TestCount.lf @@ -8,7 +8,7 @@ */ target Python -reactor TestCount(start = 1, stride = 1, num_inputs = 1) { +reactor TestCount(start=1, stride=1, num_inputs=1) { preamble {= import sys =} state count = start state inputs_received = 0 @@ -17,8 +17,8 @@ reactor TestCount(start = 1, stride = 1, num_inputs = 1) { reaction(in_) {= print("Received {}.".format(in_.value)) if in_.value != self.count: - print("Expected {}.".format(self.count)) - self.sys.exit(1) + print("Expected {}.".format(self.count)) + self.sys.exit(1) self.count += self.stride; self.inputs_received += 1; =} @@ -26,7 +26,7 @@ reactor TestCount(start = 1, stride = 1, num_inputs = 1) { reaction(shutdown) {= print("Shutdown invoked.") if self.inputs_received != self.num_inputs: - print("Expected to receive {} inputs, but got {}.".format(self.num_inputs, self.inputs_received)) - self.sys.exit(1) + print("Expected to receive {} inputs, but got {}.".format(self.num_inputs, self.inputs_received)) + self.sys.exit(1) =} } diff --git a/test/Python/src/lib/TestCountMultiport.lf b/test/Python/src/lib/TestCountMultiport.lf index d5b0a635cd..0514bc2472 100644 --- a/test/Python/src/lib/TestCountMultiport.lf +++ b/test/Python/src/lib/TestCountMultiport.lf @@ -10,7 +10,7 @@ */ target Python -reactor TestCountMultiport(start = 1, stride = 1, num_inputs = 1, width = 2) { +reactor TestCountMultiport(start=1, stride=1, num_inputs=1, width=2) { preamble {= import sys =} state count = start state inputs_received = 0 @@ -18,24 +18,24 @@ reactor TestCountMultiport(start = 1, stride = 1, num_inputs = 1, width = 2) { reaction(inp) {= for i in range(in_width): - if not inp[i].is_present: - print("No input on channel {}.".format(i)) - self.sys.exit(1) - print("Received {} on channel {}.".format(inp[i].value, i)) - if inp[i].value != self.count: - print("Expected {}.".format(self.count)) - self.sys.exit(1) - self.count += self.stride + if not inp[i].is_present: + print("No input on channel {}.".format(i)) + self.sys.exit(1) + print("Received {} on channel {}.".format(inp[i].value, i)) + if inp[i].value != self.count: + print("Expected {}.".format(self.count)) + self.sys.exit(1) + self.count += self.stride self.inputs_received += 1 =} reaction(shutdown) {= print("Shutdown invoked.") if self.inputs_received != self.num_inputs: - print("Expected to receive {} inputs, but only got {}.".format( - self.num_inputs, - self.inputs_received - )) - self.sys.exit(1) + print("Expected to receive {} inputs, but only got {}.".format( + self.num_inputs, + self.inputs_received + )) + self.sys.exit(1) =} } diff --git a/test/Python/src/modal_models/BanksCount3ModesComplex.lf b/test/Python/src/modal_models/BanksCount3ModesComplex.lf index af97eec07b..757331dd7d 100644 --- a/test/Python/src/modal_models/BanksCount3ModesComplex.lf +++ b/test/Python/src/modal_models/BanksCount3ModesComplex.lf @@ -50,19 +50,19 @@ main reactor { timer stepper(0, 250 msec) counters = new[2] MetaCounter() test = new TraceTesting(events_size = 16, trace = ( // keep-format - 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 250000000,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 250000000,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 250000000,1,1,1,1,1,1,1,1,0,3,0,3,0,3,0,3,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, - 250000000,1,2,1,2,1,2,1,2,0,3,0,3,0,3,0,3,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0, - 250000000,1,3,1,3,1,3,1,3,1,1,1,1,1,1,1,1,0,2,0,2,0,2,0,2,0,0,0,0,0,0,0,0, - 250000000,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, - 250000000,1,2,1,2,1,2,1,2,0,1,0,1,0,1,0,1,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0, - 250000000,1,3,1,3,1,3,1,3,1,2,1,2,1,2,1,2,0,2,0,2,0,2,0,2,0,0,0,0,0,0,0,0, - 250000000,1,1,1,1,1,1,1,1,0,2,0,2,0,2,0,2,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, - 250000000,1,2,1,2,1,2,1,2,0,2,0,2,0,2,0,2,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0, - 250000000,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,0,2,0,2,0,2,0,2,0,0,0,0,0,0,0,0, - 250000000,1,1,1,1,1,1,1,1,0,3,0,3,0,3,0,3,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0 + 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 250000000,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 250000000,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 250000000,1,1,1,1,1,1,1,1,0,3,0,3,0,3,0,3,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, + 250000000,1,2,1,2,1,2,1,2,0,3,0,3,0,3,0,3,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0, + 250000000,1,3,1,3,1,3,1,3,1,1,1,1,1,1,1,1,0,2,0,2,0,2,0,2,0,0,0,0,0,0,0,0, + 250000000,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, + 250000000,1,2,1,2,1,2,1,2,0,1,0,1,0,1,0,1,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0, + 250000000,1,3,1,3,1,3,1,3,1,2,1,2,1,2,1,2,0,2,0,2,0,2,0,2,0,0,0,0,0,0,0,0, + 250000000,1,1,1,1,1,1,1,1,0,2,0,2,0,2,0,2,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0, + 250000000,1,2,1,2,1,2,1,2,0,2,0,2,0,2,0,2,1,2,1,2,1,2,1,2,0,0,0,0,0,0,0,0, + 250000000,1,3,1,3,1,3,1,3,1,3,1,3,1,3,1,3,0,2,0,2,0,2,0,2,0,0,0,0,0,0,0,0, + 250000000,1,1,1,1,1,1,1,1,0,3,0,3,0,3,0,3,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0 ), training = False) counters.always, counters.mode1, counters.mode2, counters.never -> test.events @@ -70,6 +70,6 @@ main reactor { # Trigger reaction(stepper) -> counters.next {= for i in range(len(counters)): - counters[i].next.set(True) + counters[i].next.set(True) =} } diff --git a/test/Python/src/modal_models/BanksCount3ModesSimple.lf b/test/Python/src/modal_models/BanksCount3ModesSimple.lf index 503a5b99eb..36c69879c0 100644 --- a/test/Python/src/modal_models/BanksCount3ModesSimple.lf +++ b/test/Python/src/modal_models/BanksCount3ModesSimple.lf @@ -11,15 +11,15 @@ main reactor { timer stepper(0, 250 msec) counters = new[3] CounterCycle() test = new TraceTesting(events_size = 3, trace = ( // keep-format - 0,1,1,1,1,1,1, - 250000000,1,2,1,2,1,2, - 250000000,1,3,1,3,1,3, - 250000000,1,1,1,1,1,1, - 250000000,1,2,1,2,1,2, - 250000000,1,3,1,3,1,3, - 250000000,1,1,1,1,1,1, - 250000000,1,2,1,2,1,2, - 250000000,1,3,1,3,1,3 + 0,1,1,1,1,1,1, + 250000000,1,2,1,2,1,2, + 250000000,1,3,1,3,1,3, + 250000000,1,1,1,1,1,1, + 250000000,1,2,1,2,1,2, + 250000000,1,3,1,3,1,3, + 250000000,1,1,1,1,1,1, + 250000000,1,2,1,2,1,2, + 250000000,1,3,1,3,1,3 ), training = False) counters.count -> test.events @@ -27,6 +27,6 @@ main reactor { # Trigger reaction(stepper) -> counters.next {= for counter in counters: - counter.next.set(True) + counter.next.set(True) =} } diff --git a/test/Python/src/modal_models/BanksModalStateReset.lf b/test/Python/src/modal_models/BanksModalStateReset.lf index c81f8eea3e..a52b0fb2c6 100644 --- a/test/Python/src/modal_models/BanksModalStateReset.lf +++ b/test/Python/src/modal_models/BanksModalStateReset.lf @@ -14,25 +14,25 @@ main reactor { reset1 = new[2] ResetReaction() reset2 = new[2] AutoReset() test = new TraceTesting(events_size = 16, trace = ( // keep-format - 0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, - 250000000,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0, 0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0, - 250000000,0,0,0,0,0,0,0,0,1,2,1,2,0,0,0,0, 0,0,0,0,0,0,0,0,1,2,1,2,0,0,0,0, - 250000000,0,0,0,0,0,0,0,0,1,3,1,3,0,0,0,0, 0,0,0,0,0,0,0,0,1,3,1,3,0,0,0,0, - 250000000,1,1,1,1,1,0,1,0,1,4,1,4,0,0,0,0, 1,1,1,1,1,0,1,0,1,4,1,4,0,0,0,0, - 0,0,1,0,1,0,0,0,0,0,4,0,4,1,-2,1,-2, 0,1,0,1,0,0,0,0,0,4,0,4,1,-2,1,-2, - 250000000,0,1,0,1,0,0,0,0,0,4,0,4,1,-1,1,-1, 0,1,0,1,0,0,0,0,0,4,0,4,1,-1,1,-1, - 250000000,0,1,0,1,0,0,0,0,0,4,0,4,1,0,1,0, 0,1,0,1,0,0,0,0,0,4,0,4,1,0,1,0, - 250000000,0,1,0,1,0,0,0,0,0,4,0,4,1,1,1,1, 0,1,0,1,0,0,0,0,0,4,0,4,1,1,1,1, - 250000000,1,1,1,1,1,1,1,1,0,4,0,4,1,2,1,2, 1,1,1,1,1,1,1,1,0,4,0,4,1,2,1,2, - 250000000,0,1,0,1,0,1,0,1,1,5,1,5,0,2,0,2, 0,1,0,1,0,1,0,1,1,5,1,5,0,2,0,2, - 250000000,0,1,0,1,0,1,0,1,1,6,1,6,0,2,0,2, 0,1,0,1,0,1,0,1,1,6,1,6,0,2,0,2, - 250000000,0,1,0,1,0,1,0,1,1,7,1,7,0,2,0,2, 0,1,0,1,0,1,0,1,1,7,1,7,0,2,0,2, - 250000000,1,1,1,1,1,2,1,2,1,8,1,8,0,2,0,2, 1,1,1,1,1,2,1,2,1,8,1,8,0,2,0,2, - 0,0,1,0,1,0,2,0,2,0,8,0,8,1,-2,1,-2, 0,1,0,1,0,2,0,2,0,8,0,8,1,-2,1,-2, - 250000000,0,1,0,1,0,2,0,2,0,8,0,8,1,-1,1,-1, 0,1,0,1,0,2,0,2,0,8,0,8,1,-1,1,-1, - 250000000,0,1,0,1,0,2,0,2,0,8,0,8,1,0,1,0, 0,1,0,1,0,2,0,2,0,8,0,8,1,0,1,0, - 250000000,0,1,0,1,0,2,0,2,0,8,0,8,1,1,1,1, 0,1,0,1,0,2,0,2,0,8,0,8,1,1,1,1, - 250000000,1,1,1,1,1,3,1,3,0,8,0,8,1,2,1,2, 1,1,1,1,1,3,1,3,0,8,0,8,1,2,1,2 + 0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0, + 250000000,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0, 0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0, + 250000000,0,0,0,0,0,0,0,0,1,2,1,2,0,0,0,0, 0,0,0,0,0,0,0,0,1,2,1,2,0,0,0,0, + 250000000,0,0,0,0,0,0,0,0,1,3,1,3,0,0,0,0, 0,0,0,0,0,0,0,0,1,3,1,3,0,0,0,0, + 250000000,1,1,1,1,1,0,1,0,1,4,1,4,0,0,0,0, 1,1,1,1,1,0,1,0,1,4,1,4,0,0,0,0, + 0,0,1,0,1,0,0,0,0,0,4,0,4,1,-2,1,-2, 0,1,0,1,0,0,0,0,0,4,0,4,1,-2,1,-2, + 250000000,0,1,0,1,0,0,0,0,0,4,0,4,1,-1,1,-1, 0,1,0,1,0,0,0,0,0,4,0,4,1,-1,1,-1, + 250000000,0,1,0,1,0,0,0,0,0,4,0,4,1,0,1,0, 0,1,0,1,0,0,0,0,0,4,0,4,1,0,1,0, + 250000000,0,1,0,1,0,0,0,0,0,4,0,4,1,1,1,1, 0,1,0,1,0,0,0,0,0,4,0,4,1,1,1,1, + 250000000,1,1,1,1,1,1,1,1,0,4,0,4,1,2,1,2, 1,1,1,1,1,1,1,1,0,4,0,4,1,2,1,2, + 250000000,0,1,0,1,0,1,0,1,1,5,1,5,0,2,0,2, 0,1,0,1,0,1,0,1,1,5,1,5,0,2,0,2, + 250000000,0,1,0,1,0,1,0,1,1,6,1,6,0,2,0,2, 0,1,0,1,0,1,0,1,1,6,1,6,0,2,0,2, + 250000000,0,1,0,1,0,1,0,1,1,7,1,7,0,2,0,2, 0,1,0,1,0,1,0,1,1,7,1,7,0,2,0,2, + 250000000,1,1,1,1,1,2,1,2,1,8,1,8,0,2,0,2, 1,1,1,1,1,2,1,2,1,8,1,8,0,2,0,2, + 0,0,1,0,1,0,2,0,2,0,8,0,8,1,-2,1,-2, 0,1,0,1,0,2,0,2,0,8,0,8,1,-2,1,-2, + 250000000,0,1,0,1,0,2,0,2,0,8,0,8,1,-1,1,-1, 0,1,0,1,0,2,0,2,0,8,0,8,1,-1,1,-1, + 250000000,0,1,0,1,0,2,0,2,0,8,0,8,1,0,1,0, 0,1,0,1,0,2,0,2,0,8,0,8,1,0,1,0, + 250000000,0,1,0,1,0,2,0,2,0,8,0,8,1,1,1,1, 0,1,0,1,0,2,0,2,0,8,0,8,1,1,1,1, + 250000000,1,1,1,1,1,3,1,3,0,8,0,8,1,2,1,2, 1,1,1,1,1,3,1,3,0,8,0,8,1,2,1,2 ), training = False) reset1.mode_switch, @@ -47,11 +47,11 @@ main reactor { # Trigger mode change (separately because of #1278) reaction(stepper) -> reset1.next {= for i in range(len(reset1)): - reset1[i].next.set(True) + reset1[i].next.set(True) =} reaction(stepper) -> reset2.next {= for i in range(len(reset2)): - reset2[i].next.set(True) + reset2[i].next.set(True) =} } diff --git a/test/Python/src/modal_models/ConvertCaseTest.lf b/test/Python/src/modal_models/ConvertCaseTest.lf index b6723f12d8..f063da7e34 100644 --- a/test/Python/src/modal_models/ConvertCaseTest.lf +++ b/test/Python/src/modal_models/ConvertCaseTest.lf @@ -53,7 +53,7 @@ reactor Converter { character = raw.value.upper() converted.set(character) if character == ' ': - Lower.set() + Lower.set() =} } @@ -62,12 +62,12 @@ reactor Converter { character = raw.value.lower() converted.set(character) if character == ' ': - Upper.set() + Upper.set() =} } } -reactor InputFeeder(message = "") { +reactor InputFeeder(message="") { output character state idx = 0 @@ -75,8 +75,8 @@ reactor InputFeeder(message = "") { reaction(t) -> character {= if self.idx < len(self.message): - character.set(self.message[self.idx]) - self.idx += 1 + character.set(self.message[self.idx]) + self.idx += 1 =} } @@ -91,18 +91,18 @@ main reactor { feeder.character -> history_processor.character test = new TraceTesting(events_size = 2, trace = ( // keep-format - 0, True, 'H', True, 'H', - 250000000, True, 'E', True, 'E', - 250000000, True, 'L', True, 'L', - 250000000, True, '_', True, '_', - 250000000, True, 'O', True, 'O', - 250000000, True, ' ', True, ' ', - 250000000, True, 'w', True, 'w', - 250000000, True, '_', True, '_', - 250000000, True, 'R', True, 'r', - 250000000, True, 'L', True, 'l', - 250000000, True, 'D', True, 'd', - 250000000, True, '_', True, '_' + 0, True, 'H', True, 'H', + 250000000, True, 'E', True, 'E', + 250000000, True, 'L', True, 'L', + 250000000, True, '_', True, '_', + 250000000, True, 'O', True, 'O', + 250000000, True, ' ', True, ' ', + 250000000, True, 'w', True, 'w', + 250000000, True, '_', True, '_', + 250000000, True, 'R', True, 'r', + 250000000, True, 'L', True, 'l', + 250000000, True, 'D', True, 'd', + 250000000, True, '_', True, '_' ), training = False) reset_processor.converted, history_processor.converted -> test.events diff --git a/test/Python/src/modal_models/Count3Modes.lf b/test/Python/src/modal_models/Count3Modes.lf index 5815c0bb99..8d67270300 100644 --- a/test/Python/src/modal_models/Count3Modes.lf +++ b/test/Python/src/modal_models/Count3Modes.lf @@ -43,15 +43,15 @@ main reactor { print(f"{counter.count.value}") if counter.count.is_present is not True: - sys.stderr.write("ERROR: Missing mode change.\n") - exit(1) + sys.stderr.write("ERROR: Missing mode change.\n") + exit(1) elif counter.count.value != self.expected_value: - sys.stderr.write("ERROR: Wrong mode.\n") - exit(2) + sys.stderr.write("ERROR: Wrong mode.\n") + exit(2) if self.expected_value == 3: - self.expected_value = 1 + self.expected_value = 1 else: - self.expected_value += 1 + self.expected_value += 1 =} } diff --git a/test/Python/src/modal_models/ModalActions.lf b/test/Python/src/modal_models/ModalActions.lf index 73f565c62a..5218a1428e 100644 --- a/test/Python/src/modal_models/ModalActions.lf +++ b/test/Python/src/modal_models/ModalActions.lf @@ -66,21 +66,21 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 5, trace = ( // keep-format - 0,0,0,1,1,0,0,0,0,0,0, - 500000000,0,0,0,1,1,1,0,0,0,0, - 250000000,0,0,1,1,0,1,0,0,0,0, - 250000000,1,1,0,1,0,1,0,0,0,0, - 0,0,1,0,1,0,1,1,1,0,0, - 500000000,0,1,0,1,0,1,0,1,1,1, - 250000000,0,1,0,1,0,1,1,1,0,1, - 250000000,1,1,0,1,0,1,0,1,0,1, - 250000000,0,1,0,1,1,1,0,1,0,1, - 250000000,0,1,1,1,0,1,0,1,0,1, - 500000000,1,1,0,1,1,1,0,1,0,1, - 0,0,1,0,1,0,1,1,1,0,1, - 500000000,0,1,0,1,0,1,0,1,1,1, - 250000000,0,1,0,1,0,1,1,1,0,1, - 250000000,1,1,0,1,0,1,0,1,0,1 + 0,0,0,1,1,0,0,0,0,0,0, + 500000000,0,0,0,1,1,1,0,0,0,0, + 250000000,0,0,1,1,0,1,0,0,0,0, + 250000000,1,1,0,1,0,1,0,0,0,0, + 0,0,1,0,1,0,1,1,1,0,0, + 500000000,0,1,0,1,0,1,0,1,1,1, + 250000000,0,1,0,1,0,1,1,1,0,1, + 250000000,1,1,0,1,0,1,0,1,0,1, + 250000000,0,1,0,1,1,1,0,1,0,1, + 250000000,0,1,1,1,0,1,0,1,0,1, + 500000000,1,1,0,1,1,1,0,1,0,1, + 0,0,1,0,1,0,1,1,1,0,1, + 500000000,0,1,0,1,0,1,0,1,1,1, + 250000000,0,1,0,1,0,1,1,1,0,1, + 250000000,1,1,0,1,0,1,0,1,0,1 ), training = False) modal.mode_switch, diff --git a/test/Python/src/modal_models/ModalAfter.lf b/test/Python/src/modal_models/ModalAfter.lf index f6290e9bee..f5e8141e00 100644 --- a/test/Python/src/modal_models/ModalAfter.lf +++ b/test/Python/src/modal_models/ModalAfter.lf @@ -19,8 +19,8 @@ reactor Modal { output consumed2 initial mode One { - producer1 = new Producer(mode_id = 1) - consumer1 = new Consumer(mode_id = 1) + producer1 = new Producer(mode_id=1) + consumer1 = new Consumer(mode_id=1) producer1.product -> produced1 producer1.product -> consumer1.product after 500 msec consumer1.report -> consumed1 @@ -32,8 +32,8 @@ reactor Modal { } mode Two { - producer2 = new Producer(mode_id = 2) - consumer2 = new Consumer(mode_id = 2) + producer2 = new Producer(mode_id=2) + consumer2 = new Consumer(mode_id=2) producer2.product -> produced2 producer2.product -> consumer2.product after 500 msec consumer2.report -> consumed2 @@ -45,7 +45,7 @@ reactor Modal { } } -reactor Producer(mode_id = 0) { +reactor Producer(mode_id=0) { output product timer t(0, 750 msec) @@ -56,7 +56,7 @@ reactor Producer(mode_id = 0) { =} } -reactor Consumer(mode_id = 0) { +reactor Consumer(mode_id=0) { input product output report @@ -71,21 +71,21 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 5, trace = ( // keep-format - 0,0,0,1,1,0,0,0,0,0,0, - 500000000,0,0,0,1,1,1,0,0,0,0, - 250000000,0,0,1,1,0,1,0,0,0,0, - 250000000,1,1,0,1,0,1,0,0,0,0, - 0,0,1,0,1,0,1,1,1,0,0, - 500000000,0,1,0,1,0,1,0,1,1,1, - 250000000,0,1,0,1,0,1,1,1,0,1, - 250000000,1,1,0,1,0,1,0,1,0,1, - 250000000,0,1,0,1,1,1,0,1,0,1, - 250000000,0,1,1,1,0,1,0,1,0,1, - 500000000,1,1,0,1,1,1,0,1,0,1, - 0,0,1,0,1,0,1,1,1,0,1, - 500000000,0,1,0,1,0,1,0,1,1,1, - 250000000,0,1,0,1,0,1,1,1,0,1, - 250000000,1,1,0,1,0,1,0,1,0,1 + 0,0,0,1,1,0,0,0,0,0,0, + 500000000,0,0,0,1,1,1,0,0,0,0, + 250000000,0,0,1,1,0,1,0,0,0,0, + 250000000,1,1,0,1,0,1,0,0,0,0, + 0,0,1,0,1,0,1,1,1,0,0, + 500000000,0,1,0,1,0,1,0,1,1,1, + 250000000,0,1,0,1,0,1,1,1,0,1, + 250000000,1,1,0,1,0,1,0,1,0,1, + 250000000,0,1,0,1,1,1,0,1,0,1, + 250000000,0,1,1,1,0,1,0,1,0,1, + 500000000,1,1,0,1,1,1,0,1,0,1, + 0,0,1,0,1,0,1,1,1,0,1, + 500000000,0,1,0,1,0,1,0,1,1,1, + 250000000,0,1,0,1,0,1,1,1,0,1, + 250000000,1,1,0,1,0,1,0,1,0,1 ), training = False) modal.mode_switch, modal.produced1, modal.consumed1, modal.produced2, modal.consumed2 diff --git a/test/Python/src/modal_models/ModalCycleBreaker.lf b/test/Python/src/modal_models/ModalCycleBreaker.lf index f790373131..2475366927 100644 --- a/test/Python/src/modal_models/ModalCycleBreaker.lf +++ b/test/Python/src/modal_models/ModalCycleBreaker.lf @@ -32,8 +32,8 @@ reactor Modal { reaction(in1) -> reset(Two) {= if in1.value % 5 == 4: - Two.set() - print("Switching to mode Two") + Two.set() + print("Switching to mode Two") =} } } @@ -54,15 +54,15 @@ main reactor { counter = new Counter(period = 100 msec) modal = new Modal() test = new TraceTesting(events_size = 1, trace = ( // keep-format - 0,1,0, - 100000000,1,1, - 100000000,1,2, - 100000000,1,3, - 100000000,1,4, - 200000000,1,6, - 100000000,1,7, - 100000000,1,8, - 100000000,1,9 + 0,1,0, + 100000000,1,1, + 100000000,1,2, + 100000000,1,3, + 100000000,1,4, + 200000000,1,6, + 100000000,1,7, + 100000000,1,8, + 100000000,1,9 ), training = False) counter.value -> modal.in1 diff --git a/test/Python/src/modal_models/ModalNestedReactions.lf b/test/Python/src/modal_models/ModalNestedReactions.lf index 82fbbd5275..5f30da93b8 100644 --- a/test/Python/src/modal_models/ModalNestedReactions.lf +++ b/test/Python/src/modal_models/ModalNestedReactions.lf @@ -51,14 +51,14 @@ main reactor { print(counter.count.value) if counter.count.is_present is not True: - sys.stderr.write("ERROR: Missing mode change.\n") - exit(1) + sys.stderr.write("ERROR: Missing mode change.\n") + exit(1) elif counter.only_in_two.is_present and (counter.count.value != 2): - sys.stderr.write("ERROR: Indirectly nested reaction was not properly deactivated.\n") - exit(2) + sys.stderr.write("ERROR: Indirectly nested reaction was not properly deactivated.\n") + exit(2) elif counter.only_in_two.is_present is not True and (counter.count.value == 2): - sys.stderr.write("ERROR: Missing output from indirectly nested reaction.\n") - exit(3) + sys.stderr.write("ERROR: Missing output from indirectly nested reaction.\n") + exit(3) =} reaction(counter.never) {= diff --git a/test/Python/src/modal_models/ModalStartupShutdown.lf b/test/Python/src/modal_models/ModalStartupShutdown.lf index e464f79c42..8dc7eb8dd1 100644 --- a/test/Python/src/modal_models/ModalStartupShutdown.lf +++ b/test/Python/src/modal_models/ModalStartupShutdown.lf @@ -112,17 +112,17 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 11, trace = ( // keep-format - 0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 500000000,1,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,2,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 500000000,1,3,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 500000000,1,4,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,4,0,1,0,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0, - 500000000,1,4,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0, - 0,0,4,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0, - 500000000,1,4,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0, - 0,0,4,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0, - 500000000,1,4,0,1,0,1,1,1,1,1,0,1,0,1,1,1,0,0,0,0,0,0 + 0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 500000000,1,2,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,2,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 500000000,1,3,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 500000000,1,4,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,4,0,1,0,1,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0, + 500000000,1,4,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0, + 0,0,4,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0, + 500000000,1,4,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0, + 0,0,4,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0, + 500000000,1,4,0,1,0,1,1,1,1,1,0,1,0,1,1,1,0,0,0,0,0,0 ), training = False) modal.mode_switch, diff --git a/test/Python/src/modal_models/ModalStateReset.lf b/test/Python/src/modal_models/ModalStateReset.lf index 76f94b259b..5de6b61e35 100644 --- a/test/Python/src/modal_models/ModalStateReset.lf +++ b/test/Python/src/modal_models/ModalStateReset.lf @@ -64,25 +64,25 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 4, trace = ( // keep-format - 0,0,0,0,0,1,0,0,0, - 250000000,0,0,0,0,1,1,0,0, - 250000000,0,0,0,0,1,2,0,0, - 250000000,0,0,0,0,1,3,0,0, - 250000000,1,1,1,0,1,4,0,0, - 0,0,1,0,0,0,4,1,-2, - 250000000,0,1,0,0,0,4,1,-1, - 250000000,0,1,0,0,0,4,1,0, - 250000000,0,1,0,0,0,4,1,1, - 250000000,1,1,1,1,0,4,1,2, - 250000000,0,1,0,1,1,5,0,2, - 250000000,0,1,0,1,1,6,0,2, - 250000000,0,1,0,1,1,7,0,2, - 250000000,1,1,1,2,1,8,0,2, - 0,0,1,0,2,0,8,1,-2, - 250000000,0,1,0,2,0,8,1,-1, - 250000000,0,1,0,2,0,8,1,0, - 250000000,0,1,0,2,0,8,1,1, - 250000000,1,1,1,3,0,8,1,2 + 0,0,0,0,0,1,0,0,0, + 250000000,0,0,0,0,1,1,0,0, + 250000000,0,0,0,0,1,2,0,0, + 250000000,0,0,0,0,1,3,0,0, + 250000000,1,1,1,0,1,4,0,0, + 0,0,1,0,0,0,4,1,-2, + 250000000,0,1,0,0,0,4,1,-1, + 250000000,0,1,0,0,0,4,1,0, + 250000000,0,1,0,0,0,4,1,1, + 250000000,1,1,1,1,0,4,1,2, + 250000000,0,1,0,1,1,5,0,2, + 250000000,0,1,0,1,1,6,0,2, + 250000000,0,1,0,1,1,7,0,2, + 250000000,1,1,1,2,1,8,0,2, + 0,0,1,0,2,0,8,1,-2, + 250000000,0,1,0,2,0,8,1,-1, + 250000000,0,1,0,2,0,8,1,0, + 250000000,0,1,0,2,0,8,1,1, + 250000000,1,1,1,3,0,8,1,2 ), training = False) modal.mode_switch, modal.count0, modal.count1, modal.count2 -> test.events diff --git a/test/Python/src/modal_models/ModalStateResetAuto.lf b/test/Python/src/modal_models/ModalStateResetAuto.lf index ab09f7f325..492d02f234 100644 --- a/test/Python/src/modal_models/ModalStateResetAuto.lf +++ b/test/Python/src/modal_models/ModalStateResetAuto.lf @@ -60,25 +60,25 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 4, trace = ( // keep-format - 0,0,0,0,0,1,0,0,0, - 250000000,0,0,0,0,1,1,0,0, - 250000000,0,0,0,0,1,2,0,0, - 250000000,0,0,0,0,1,3,0,0, - 250000000,1,1,1,0,1,4,0,0, - 0,0,1,0,0,0,4,1,-2, - 250000000,0,1,0,0,0,4,1,-1, - 250000000,0,1,0,0,0,4,1,0, - 250000000,0,1,0,0,0,4,1,1, - 250000000,1,1,1,1,0,4,1,2, - 250000000,0,1,0,1,1,5,0,2, - 250000000,0,1,0,1,1,6,0,2, - 250000000,0,1,0,1,1,7,0,2, - 250000000,1,1,1,2,1,8,0,2, - 0,0,1,0,2,0,8,1,-2, - 250000000,0,1,0,2,0,8,1,-1, - 250000000,0,1,0,2,0,8,1,0, - 250000000,0,1,0,2,0,8,1,1, - 250000000,1,1,1,3,0,8,1,2 + 0,0,0,0,0,1,0,0,0, + 250000000,0,0,0,0,1,1,0,0, + 250000000,0,0,0,0,1,2,0,0, + 250000000,0,0,0,0,1,3,0,0, + 250000000,1,1,1,0,1,4,0,0, + 0,0,1,0,0,0,4,1,-2, + 250000000,0,1,0,0,0,4,1,-1, + 250000000,0,1,0,0,0,4,1,0, + 250000000,0,1,0,0,0,4,1,1, + 250000000,1,1,1,1,0,4,1,2, + 250000000,0,1,0,1,1,5,0,2, + 250000000,0,1,0,1,1,6,0,2, + 250000000,0,1,0,1,1,7,0,2, + 250000000,1,1,1,2,1,8,0,2, + 0,0,1,0,2,0,8,1,-2, + 250000000,0,1,0,2,0,8,1,-1, + 250000000,0,1,0,2,0,8,1,0, + 250000000,0,1,0,2,0,8,1,1, + 250000000,1,1,1,3,0,8,1,2 ), training = False) modal.mode_switch, modal.count0, modal.count1, modal.count2 -> test.events diff --git a/test/Python/src/modal_models/ModalTimers.lf b/test/Python/src/modal_models/ModalTimers.lf index 9f92a876fb..f752e025d8 100644 --- a/test/Python/src/modal_models/ModalTimers.lf +++ b/test/Python/src/modal_models/ModalTimers.lf @@ -47,17 +47,17 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 3, trace = ( // keep-format - 0,0,0,1,1,0,0, - 750000000,0,0,1,1,0,0, - 250000000,1,1,0,1,0,0, - 0,0,1,0,1,1,1, - 750000000,0,1,0,1,1,1, - 250000000,1,1,0,1,0,1, - 500000000,0,1,1,1,0,1, - 500000000,1,1,0,1,0,1, - 0,0,1,0,1,1,1, - 750000000,0,1,0,1,1,1, - 250000000,1,1,0,1,0,1 + 0,0,0,1,1,0,0, + 750000000,0,0,1,1,0,0, + 250000000,1,1,0,1,0,0, + 0,0,1,0,1,1,1, + 750000000,0,1,0,1,1,1, + 250000000,1,1,0,1,0,1, + 500000000,0,1,1,1,0,1, + 500000000,1,1,0,1,0,1, + 0,0,1,0,1,1,1, + 750000000,0,1,0,1,1,1, + 250000000,1,1,0,1,0,1 ), training = False) modal.mode_switch, modal.timer1, modal.timer2 -> test.events diff --git a/test/Python/src/modal_models/MultipleOutputFeeder_2Connections.lf b/test/Python/src/modal_models/MultipleOutputFeeder_2Connections.lf index 9eebec636f..47e9c0b783 100644 --- a/test/Python/src/modal_models/MultipleOutputFeeder_2Connections.lf +++ b/test/Python/src/modal_models/MultipleOutputFeeder_2Connections.lf @@ -45,23 +45,23 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 1, trace = ( // keep-format - 0,1,0, - 250000000,1,1, - 250000000,1,2, - 0,1,0, - 100000000,1,1, - 100000000,1,2, - 100000000,1,3, - 100000000,1,4, - 100000000,1,5, - 250000000,1,3, - 250000000,1,4, - 0,1,0, - 100000000,1,1, - 100000000,1,2, - 100000000,1,3, - 100000000,1,4, - 100000000,1,5 + 0,1,0, + 250000000,1,1, + 250000000,1,2, + 0,1,0, + 100000000,1,1, + 100000000,1,2, + 100000000,1,3, + 100000000,1,4, + 100000000,1,5, + 250000000,1,3, + 250000000,1,4, + 0,1,0, + 100000000,1,1, + 100000000,1,2, + 100000000,1,3, + 100000000,1,4, + 100000000,1,5 ), training = False) modal.count -> test.events diff --git a/test/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf b/test/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf index 1b1c0429a1..5d77127f86 100644 --- a/test/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf +++ b/test/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf @@ -46,23 +46,23 @@ main reactor { modal = new Modal() test = new TraceTesting(events_size = 1, trace = ( // keep-format - 0,1,0, - 250000000,1,1, - 250000000,1,2, - 0,1,0, - 100000000,1,10, - 100000000,1,20, - 100000000,1,30, - 100000000,1,40, - 100000000,1,50, - 250000000,1,3, - 250000000,1,4, - 0,1,0, - 100000000,1,10, - 100000000,1,20, - 100000000,1,30, - 100000000,1,40, - 100000000,1,50 + 0,1,0, + 250000000,1,1, + 250000000,1,2, + 0,1,0, + 100000000,1,10, + 100000000,1,20, + 100000000,1,30, + 100000000,1,40, + 100000000,1,50, + 250000000,1,3, + 250000000,1,4, + 0,1,0, + 100000000,1,10, + 100000000,1,20, + 100000000,1,30, + 100000000,1,40, + 100000000,1,50 ), training = False) modal.count -> test.events diff --git a/test/Python/src/modal_models/util/TraceTesting.lf b/test/Python/src/modal_models/util/TraceTesting.lf index 02781b42fe..833ffa0ca6 100644 --- a/test/Python/src/modal_models/util/TraceTesting.lf +++ b/test/Python/src/modal_models/util/TraceTesting.lf @@ -1,7 +1,7 @@ /** Utility reactor to record and test execution traces. */ target Python -reactor TraceTesting(events_size = 0, trace = {= [] =}, training = False) { +reactor TraceTesting(events_size=0, trace = {= [] =}, training=False) { input[events_size] events state last_reaction_time = 0 @@ -16,47 +16,47 @@ reactor TraceTesting(events_size = 0, trace = {= [] =}, training = False) { curr_reaction_delay = lf.time.logical() - self.last_reaction_time if self.training: - # Save the time - self.recorded_events.append(curr_reaction_delay) + # Save the time + self.recorded_events.append(curr_reaction_delay) else: - if self.trace_idx >= len(self.trace): - sys.stderr.write("ERROR: Trace Error: Current execution exceeds given trace.\n") - exit(1) + if self.trace_idx >= len(self.trace): + sys.stderr.write("ERROR: Trace Error: Current execution exceeds given trace.\n") + exit(1) - trace_reaction_delay = self.trace[self.trace_idx] - self.trace_idx += 1 + trace_reaction_delay = self.trace[self.trace_idx] + self.trace_idx += 1 - if curr_reaction_delay != trace_reaction_delay: - sys.stderr.write(f"ERROR: Trace Mismatch: Unexpected reaction timing. (delay: {curr_reaction_delay}, expected: {trace_reaction_delay})\n") - exit(2) + if curr_reaction_delay != trace_reaction_delay: + sys.stderr.write(f"ERROR: Trace Mismatch: Unexpected reaction timing. (delay: {curr_reaction_delay}, expected: {trace_reaction_delay})\n") + exit(2) for i in range(self.events_size): - curr_present = events[i].is_present - curr_value = events[i].value - - if self.training: - # Save the event - self.recorded_events.append(curr_present) - self.recorded_events.append(curr_value) - else: - trace_present = self.trace[self.trace_idx] - self.trace_idx += 1 - trace_value = self.trace[self.trace_idx] - self.trace_idx += 1 - - if trace_present != curr_present: - sys.stderr.write(f"ERROR: Trace Mismatch: Unexpected event presence. (event: {i}, presence: {curr_present}, expected: {trace_present})\n") - exit(3) - elif curr_present and trace_value != curr_value: - sys.stderr.write(f"ERROR: Trace Mismatch: Unexpected event presence. (event: {i}, value: {curr_value}, expected: {trace_value})\n") - exit(4) + curr_present = events[i].is_present + curr_value = events[i].value + + if self.training: + # Save the event + self.recorded_events.append(curr_present) + self.recorded_events.append(curr_value) + else: + trace_present = self.trace[self.trace_idx] + self.trace_idx += 1 + trace_value = self.trace[self.trace_idx] + self.trace_idx += 1 + + if trace_present != curr_present: + sys.stderr.write(f"ERROR: Trace Mismatch: Unexpected event presence. (event: {i}, presence: {curr_present}, expected: {trace_present})\n") + exit(3) + elif curr_present and trace_value != curr_value: + sys.stderr.write(f"ERROR: Trace Mismatch: Unexpected event presence. (event: {i}, value: {curr_value}, expected: {trace_value})\n") + exit(4) self.last_reaction_time = lf.time.logical() =} reaction(shutdown) {= if self.training: - print(f"Recorded event trace ({self.recorded_events_next}):") - print(self.recorded_events) + print(f"Recorded event trace ({self.recorded_events_next}):") + print(self.recorded_events) =} } diff --git a/test/Python/src/multiport/BankIndexInitializer.lf b/test/Python/src/multiport/BankIndexInitializer.lf index 7a717e3c57..babef36a7c 100644 --- a/test/Python/src/multiport/BankIndexInitializer.lf +++ b/test/Python/src/multiport/BankIndexInitializer.lf @@ -3,35 +3,35 @@ target Python preamble {= table = [4, 3, 2, 1] =} -reactor Source(bank_index = 0, value = 0) { +reactor Source(bank_index=0, value=0) { output out reaction(startup) -> out {= out.set(self.value) =} } -reactor Sink(width = 4) { +reactor Sink(width=4) { input[width] _in state received = False reaction(_in) {= for (idx, port) in enumerate(_in): - if port.is_present is True: - print("Received on channel {:d}: {:d}".format(idx, port.value)) - self.received = True - if port.value != 4 - idx: - sys.stderr.write("ERROR: expected {:d}\n".format(4 - idx)) - exit(1) + if port.is_present is True: + print("Received on channel {:d}: {:d}".format(idx, port.value)) + self.received = True + if port.value != 4 - idx: + sys.stderr.write("ERROR: expected {:d}\n".format(4 - idx)) + exit(1) =} reaction(shutdown) {= if self.received is False: - sys.stderr.write("ERROR: Sink received no data\n") - exit(1) + sys.stderr.write("ERROR: Sink received no data\n") + exit(1) =} } -main reactor(width = 4) { +main reactor(width=4) { source = new[width] Source(value = {= table[bank_index] =}) - sink = new Sink(width = width) + sink = new Sink(width=width) source.out -> sink._in } diff --git a/test/Python/src/multiport/BankReactionsInContainer.lf b/test/Python/src/multiport/BankReactionsInContainer.lf index 147eddfef4..b270ef2629 100644 --- a/test/Python/src/multiport/BankReactionsInContainer.lf +++ b/test/Python/src/multiport/BankReactionsInContainer.lf @@ -3,33 +3,33 @@ target Python { timeout: 1 sec } -reactor R(bank_index = 0) { +reactor R(bank_index=0) { output[2] out input[2] inp state received = False reaction(startup) -> out {= for (i, p) in enumerate(out): - value = self.bank_index * 2 + i - p.set(value) - print(f"Inner sending {value} to bank {self.bank_index} channel {i}.") + value = self.bank_index * 2 + i + p.set(value) + print(f"Inner sending {value} to bank {self.bank_index} channel {i}.") =} reaction(inp) {= for (i, p) in enumerate(inp): - if p.is_present: - print(f"Inner received {p.value} in bank {self.bank_index}, channel {i}") - self.received = True - if p.value != (self.bank_index * 2 + i): - sys.stderr.write(f"ERROR: Expected {self.bank_index * 2 + i}.\n") - exit(1) + if p.is_present: + print(f"Inner received {p.value} in bank {self.bank_index}, channel {i}") + self.received = True + if p.value != (self.bank_index * 2 + i): + sys.stderr.write(f"ERROR: Expected {self.bank_index * 2 + i}.\n") + exit(1) =} reaction(shutdown) {= print("Inner shutdown invoked.") if self.received is not True: - sys.stderr.write(f"ERROR: Received no input.") - exit(1) + sys.stderr.write(f"ERROR: Received no input.") + exit(1) =} } @@ -40,27 +40,27 @@ main reactor { reaction(startup) -> s.inp {= count = 0 for i in range(len(s)): - for (j, p) in enumerate(s[i].inp): - print(f"Sending {count} to bank {i} channel {j}.") - p.set(count) - count+=1 + for (j, p) in enumerate(s[i].inp): + print(f"Sending {count} to bank {i} channel {j}.") + p.set(count) + count+=1 =} reaction(s.out) {= for i in range(len(s)): - for (j, p) in enumerate(s[i].out): - if p.is_present: - print(f"Outer received {p.value} on bank {i} channel {j}.") - self.received = True - if p.value != i * 2 + j: - sys.stderr.write(f"ERROR: Expected {i*2+j}.\n") - exit(1) + for (j, p) in enumerate(s[i].out): + if p.is_present: + print(f"Outer received {p.value} on bank {i} channel {j}.") + self.received = True + if p.value != i * 2 + j: + sys.stderr.write(f"ERROR: Expected {i*2+j}.\n") + exit(1) =} reaction(shutdown) {= print("Outer shutdown invoked.") if self.received is not True: - sys.stderr.write(f"ERROR: Received no input.\n") - exit(1) + sys.stderr.write(f"ERROR: Received no input.\n") + exit(1) =} } diff --git a/test/Python/src/multiport/BankToBank.lf b/test/Python/src/multiport/BankToBank.lf index c1924f6a53..2d8d48147e 100644 --- a/test/Python/src/multiport/BankToBank.lf +++ b/test/Python/src/multiport/BankToBank.lf @@ -4,7 +4,7 @@ target Python { fast: true } -reactor Source(bank_index = 0) { +reactor Source(bank_index=0) { timer t(0, 200 msec) output out state s = 0 @@ -15,27 +15,27 @@ reactor Source(bank_index = 0) { =} } -reactor Destination(bank_index = 0) { +reactor Destination(bank_index=0) { state s = 0 input _in reaction(_in) {= print("Destination " + str(self.bank_index) + " received: " + str(_in.value)) if (_in.value != self.s): - sys.stderr.write("ERROR: Expected " + str(self.s)) - exit(1) + sys.stderr.write("ERROR: Expected " + str(self.s)) + exit(1) self.s += self.bank_index =} reaction(shutdown) {= if self.s == 0 and self.bank_index != 0: - sys.stderr.write("ERROR: Destination " + self.bank_index + " received no input!") - exit(1) + sys.stderr.write("ERROR: Destination " + self.bank_index + " received no input!") + exit(1) print("Success.") =} } -main reactor BankToBank(width = 4) { +main reactor BankToBank(width=4) { a = new[width] Source() b = new[width] Destination() a.out -> b._in diff --git a/test/Python/src/multiport/BankToBankMultiport.lf b/test/Python/src/multiport/BankToBankMultiport.lf index ace36af77f..fdeb1d71c5 100644 --- a/test/Python/src/multiport/BankToBankMultiport.lf +++ b/test/Python/src/multiport/BankToBankMultiport.lf @@ -4,47 +4,47 @@ target Python { fast: true } -reactor Source(width = 1) { +reactor Source(width=1) { timer t(0, 200 msec) output[width] out state s = 0 reaction(t) -> out {= for port in out: - port.set(self.s) - self.s += 1 + port.set(self.s) + self.s += 1 =} } -reactor Destination(width = 1) { +reactor Destination(width=1) { state s = 6 input[width] _in reaction(_in) {= sm = 0 for port in _in: - if port.is_present: - sm += port.value + if port.is_present: + sm += port.value print("Sum of received: ", sm) if sm != self.s: - sys.stderr.write("ERROR: Expected {:d}.\n".format(self.s)) - exit(1) + sys.stderr.write("ERROR: Expected {:d}.\n".format(self.s)) + exit(1) self.s += 16 =} reaction(shutdown) {= if self.s <= 6: - sys.stderr.write("ERROR: Destination received no input!\n") - exit(1) + sys.stderr.write("ERROR: Destination received no input!\n") + exit(1) print("Success.") =} } -main reactor BankToBankMultiport(bank_width = 4) { - a = new[bank_width] Source(width = 4) - b = new[bank_width] Destination(width = 4) +main reactor BankToBankMultiport(bank_width=4) { + a = new[bank_width] Source(width=4) + b = new[bank_width] Destination(width=4) a.out -> b._in } diff --git a/test/Python/src/multiport/BankToBankMultiportAfter.lf b/test/Python/src/multiport/BankToBankMultiportAfter.lf index 4f42b8dac2..7b9d98bf29 100644 --- a/test/Python/src/multiport/BankToBankMultiportAfter.lf +++ b/test/Python/src/multiport/BankToBankMultiportAfter.lf @@ -6,8 +6,8 @@ target Python { import Source, Destination from "BankToBankMultiport.lf" -main reactor BankToBankMultiportAfter(bank_width = 4) { - a = new[bank_width] Source(width = 4) - b = new[bank_width] Destination(width = 4) +main reactor BankToBankMultiportAfter(bank_width=4) { + a = new[bank_width] Source(width=4) + b = new[bank_width] Destination(width=4) a.out -> b._in after 200 msec } diff --git a/test/Python/src/multiport/BankToMultiport.lf b/test/Python/src/multiport/BankToMultiport.lf index 45719b6a13..7be7e38e21 100644 --- a/test/Python/src/multiport/BankToMultiport.lf +++ b/test/Python/src/multiport/BankToMultiport.lf @@ -1,35 +1,35 @@ # Test bank of reactors to multiport input with id parameter in the bank. target Python -reactor Source(bank_index = 0) { +reactor Source(bank_index=0) { output out reaction(startup) -> out {= out.set(self.bank_index) =} } -reactor Sink(width = 4) { +reactor Sink(width=4) { input[width] _in state received = False reaction(_in) {= for (idx, port) in enumerate(_in): - if port.is_present is True: - print("Received on channel {:d}: {:d}".format(idx, port.value)) - self.received = True - if port.value != idx: - sys.stderr.write("ERROR: expected {:d}\n".format(idx)) - exit(1) + if port.is_present is True: + print("Received on channel {:d}: {:d}".format(idx, port.value)) + self.received = True + if port.value != idx: + sys.stderr.write("ERROR: expected {:d}\n".format(idx)) + exit(1) =} reaction(shutdown) {= if self.received is False: - sys.stderr.write("ERROR: Sink received no data\n") - exit(1) + sys.stderr.write("ERROR: Sink received no data\n") + exit(1) =} } -main reactor BankToMultiport(width = 5) { +main reactor BankToMultiport(width=5) { source = new[width] Source() - sink = new Sink(width = width) + sink = new Sink(width=width) source.out -> sink._in } diff --git a/test/Python/src/multiport/Broadcast.lf b/test/Python/src/multiport/Broadcast.lf index 09643f3679..ad10435c7b 100644 --- a/test/Python/src/multiport/Broadcast.lf +++ b/test/Python/src/multiport/Broadcast.lf @@ -3,32 +3,32 @@ target Python { fast: true } -reactor Source(value = 42) { +reactor Source(value=42) { output out reaction(startup) -> out {= out.set(self.value) =} } -reactor Destination(bank_index = 0, delay = 0) { +reactor Destination(bank_index=0, delay=0) { input _in state received = False reaction(_in) {= print(f"Destination {self.bank_index} received {_in.value}.") if (_in.value != 42): - sys.stderr.write("ERROR: Expected 42.\n") - exit(1) + sys.stderr.write("ERROR: Expected 42.\n") + exit(1) if lf.time.logical_elapsed() != self.delay: - sys.stderr.write(f"ERROR: Expected to receive input after {self.delay/1000000000} second(s).\n") - exit(2) + sys.stderr.write(f"ERROR: Expected to receive input after {self.delay/1000000000} second(s).\n") + exit(2) self.received = True =} reaction(shutdown) {= if self.received is not True: - sys.stderr.write(f"ERROR: Destination {self.bank_index} received no input!\n") - exit(1) + sys.stderr.write(f"ERROR: Destination {self.bank_index} received no input!\n") + exit(1) print("Success.") =} } diff --git a/test/Python/src/multiport/BroadcastMultipleAfter.lf b/test/Python/src/multiport/BroadcastMultipleAfter.lf index eba9455f39..3d02d21fed 100644 --- a/test/Python/src/multiport/BroadcastMultipleAfter.lf +++ b/test/Python/src/multiport/BroadcastMultipleAfter.lf @@ -5,7 +5,7 @@ target Python { import Source from "Broadcast.lf" -reactor Destination(bank_index = 0, delay = 0) { +reactor Destination(bank_index=0, delay=0) { input _in state received = False @@ -13,27 +13,27 @@ reactor Destination(bank_index = 0, delay = 0) { print(f"Destination {self.bank_index} received {_in.value}.") expected = (self.bank_index % 3) + 1 if (_in.value != expected): - sys.stderr.write("ERROR: Expected 42.\n") - exit(1) + sys.stderr.write("ERROR: Expected 42.\n") + exit(1) if lf.time.logical_elapsed() != self.delay: - sys.stderr.write(f"ERROR: Expected to receive input after {self.delay/1000000000} second(s).\n") - exit(2) + sys.stderr.write(f"ERROR: Expected to receive input after {self.delay/1000000000} second(s).\n") + exit(2) self.received = True =} reaction(shutdown) {= if self.received is not True: - sys.stderr.write(f"ERROR: Destination {self.bank_index} received no input!\n") - exit(1) + sys.stderr.write(f"ERROR: Destination {self.bank_index} received no input!\n") + exit(1) print("Success.") =} } main reactor { - a1 = new Source(value = 1) - a2 = new Source(value = 2) - a3 = new Source(value = 3) + a1 = new Source(value=1) + a2 = new Source(value=2) + a3 = new Source(value=3) b = new[9] Destination(delay = 1 sec) (a1.out, a2.out, a3.out)+ -> b._in after 1 sec } diff --git a/test/Python/src/multiport/MultiportFromBank.lf b/test/Python/src/multiport/MultiportFromBank.lf index f1ca4769ee..447f10154a 100644 --- a/test/Python/src/multiport/MultiportFromBank.lf +++ b/test/Python/src/multiport/MultiportFromBank.lf @@ -5,7 +5,7 @@ target Python { fast: true } -reactor Source(check_override = 0, bank_index = 0) { +reactor Source(check_override=0, bank_index=0) { output out reaction(startup) -> out {= out.set(self.bank_index * self.check_override) =} @@ -17,25 +17,25 @@ reactor Destination { reaction(_in) {= for (idx, port) in enumerate(_in): - print("Destination channel " + str(idx) + " received " + str(port.value)) - if idx != port.value: - sys.stderr.write("ERROR: Expected " + str(idx)) - exit(1) + print("Destination channel " + str(idx) + " received " + str(port.value)) + if idx != port.value: + sys.stderr.write("ERROR: Expected " + str(idx)) + exit(1) self.received = True =} reaction(shutdown) {= if self.received is False: - sys.stderr.write("ERROR: Destination received no input!\n") - exit(1) + sys.stderr.write("ERROR: Destination received no input!\n") + exit(1) print("Success.") =} } main reactor MultiportFromBank { - a = new[3] Source(check_override = 1) + a = new[3] Source(check_override=1) b = new Destination() a.out -> b._in } diff --git a/test/Python/src/multiport/MultiportFromBankHierarchy.lf b/test/Python/src/multiport/MultiportFromBankHierarchy.lf index d47481b817..253de78c1a 100644 --- a/test/Python/src/multiport/MultiportFromBankHierarchy.lf +++ b/test/Python/src/multiport/MultiportFromBankHierarchy.lf @@ -7,7 +7,7 @@ target Python { import Destination from "MultiportFromBank.lf" -reactor Source(bank_index = 0) { +reactor Source(bank_index=0) { output out reaction(startup) -> out {= out.set(self.bank_index) =} diff --git a/test/Python/src/multiport/MultiportFromHierarchy.lf b/test/Python/src/multiport/MultiportFromHierarchy.lf index 342ae198c3..01fcc4d080 100644 --- a/test/Python/src/multiport/MultiportFromHierarchy.lf +++ b/test/Python/src/multiport/MultiportFromHierarchy.lf @@ -11,8 +11,8 @@ reactor Source { reaction(t) -> out {= for port in out: - port.set(self.s) - self.s = self.s + 1 + port.set(self.s) + self.s = self.s + 1 =} } @@ -23,19 +23,19 @@ reactor Destination { reaction(_in) {= sm = 0 for port in _in: - if port.is_present: - sm += port.value + if port.is_present: + sm += port.value print("Sum of received: " + str(sm)) if (sm != self.s): - sys.stderr.write("ERROR: Expected " + str(self.s) + ".\n") - exit(1) + sys.stderr.write("ERROR: Expected " + str(self.s) + ".\n") + exit(1) self.s += 16 =} reaction(shutdown) {= if self.s <= 6: - sys.stderr.write("ERROR: Destination received no input!\n") - exit(1) + sys.stderr.write("ERROR: Destination received no input!\n") + exit(1) print("Success.") =} } diff --git a/test/Python/src/multiport/MultiportFromReaction.lf b/test/Python/src/multiport/MultiportFromReaction.lf index 2b8266cffc..8e3c67161a 100644 --- a/test/Python/src/multiport/MultiportFromReaction.lf +++ b/test/Python/src/multiport/MultiportFromReaction.lf @@ -4,27 +4,27 @@ target Python { fast: true } -reactor Destination(width = 1) { +reactor Destination(width=1) { state s = 6 input[width] _in reaction(_in) {= sm = 0; for port in _in: - if port.is_present: - sm += port.value + if port.is_present: + sm += port.value print("Sum of received: ", sm) if sm != self.s: - sys.stderr.write("ERROR: Expected {:d}.\n".format(self.s)) - exit(1) + sys.stderr.write("ERROR: Expected {:d}.\n".format(self.s)) + exit(1) self.s += 16 =} reaction(shutdown) {= if self.s <= 6: - sys.stderr.write("ERROR: Destination received no input!\n") - exit(1) + sys.stderr.write("ERROR: Destination received no input!\n") + exit(1) print("Success.") =} } @@ -32,14 +32,14 @@ reactor Destination(width = 1) { main reactor MultiportFromReaction { timer t(0, 200 msec) state s = 0 - b = new Destination(width = 4) + b = new Destination(width=4) reaction(t) -> b._in {= for (idx, port) in enumerate(b._in): - print("Before SET, b.in[{:d}].is_present has value {:d}".format(idx, port.is_present)) - port.set(self.s) - self.s += 1 - print("AFTER set, b.in[{:d}].is_present has value {:d}".format(idx, port.is_present)) - print("AFTER set, b.in[{:d}].value has value {:d}".format(idx, port.value)) + print("Before SET, b.in[{:d}].is_present has value {:d}".format(idx, port.is_present)) + port.set(self.s) + self.s += 1 + print("AFTER set, b.in[{:d}].is_present has value {:d}".format(idx, port.is_present)) + print("AFTER set, b.in[{:d}].value has value {:d}".format(idx, port.value)) =} } diff --git a/test/Python/src/multiport/MultiportIn.lf b/test/Python/src/multiport/MultiportIn.lf index 9045be7792..e72b037bab 100644 --- a/test/Python/src/multiport/MultiportIn.lf +++ b/test/Python/src/multiport/MultiportIn.lf @@ -30,20 +30,20 @@ reactor Destination { reaction(_in) {= sum = 0 for port in _in: - sum += port.value + sum += port.value print("Sum of received: " + str(sum)) if sum != self.s: - sys.stderr.write("ERROR: Expected " + str(self.s)) - exit(1) + sys.stderr.write("ERROR: Expected " + str(self.s)) + exit(1) self.s += 4 =} reaction(shutdown) {= if self.s == 0: - sys.stderr.write("ERROR: Destination received no input!") - exit(1) + sys.stderr.write("ERROR: Destination received no input!") + exit(1) print("Success.") =} diff --git a/test/Python/src/multiport/MultiportInParameterized.lf b/test/Python/src/multiport/MultiportInParameterized.lf index 206fa512ac..d9df047b5a 100644 --- a/test/Python/src/multiport/MultiportInParameterized.lf +++ b/test/Python/src/multiport/MultiportInParameterized.lf @@ -23,25 +23,25 @@ reactor Computation { reaction(_in) -> out {= out.set(_in.value) =} } -reactor Destination(width = 1) { +reactor Destination(width=1) { state s = 0 input[width] _in reaction(_in) {= sm = 0 for port in _in: - sm += port.value + sm += port.value print("Sum of received: ", sm) if sm != self.s: - sys.stderr.write("ERROR: Expected {:d}.\n".format(self.s)) - exit(1) + sys.stderr.write("ERROR: Expected {:d}.\n".format(self.s)) + exit(1) self.s += 4 =} reaction(shutdown) {= if self.s == 0: - sys.stderr.write("ERROR: Destination received no input!\n") - exit(1) + sys.stderr.write("ERROR: Destination received no input!\n") + exit(1) print("Success."); =} } @@ -52,7 +52,7 @@ main reactor MultiportInParameterized { t2 = new Computation() t3 = new Computation() t4 = new Computation() - b = new Destination(width = 4) + b = new Destination(width=4) a.out -> t1._in a.out -> t2._in a.out -> t3._in diff --git a/test/Python/src/multiport/MultiportMutableInput.lf b/test/Python/src/multiport/MultiportMutableInput.lf index bfc691d1c2..8be7d7c757 100644 --- a/test/Python/src/multiport/MultiportMutableInput.lf +++ b/test/Python/src/multiport/MultiportMutableInput.lf @@ -12,36 +12,36 @@ reactor Source { } # The scale parameter is just for testing. -reactor Print(scale = 1) { +reactor Print(scale=1) { input[2] _in reaction(_in) {= expected = 42 for (idx, port) in enumerate(_in): - print("Received on channel {:d}: ".format(idx), port.value) - if port.value != expected: - sys.stderr.write("ERROR: Expected {:d}!\n".format(expected)) - exit(1) - expected *= 2 + print("Received on channel {:d}: ".format(idx), port.value) + if port.value != expected: + sys.stderr.write("ERROR: Expected {:d}!\n".format(expected)) + exit(1) + expected *= 2 =} } -reactor Scale(scale = 2) { +reactor Scale(scale=2) { mutable input[2] _in output[2] out reaction(_in) -> out {= for (idx, port) in enumerate(_in): - # Modify the input, allowed because mutable. - port.value *= self.scale - out[idx].set(port.value) + # Modify the input, allowed because mutable. + port.value *= self.scale + out[idx].set(port.value) =} } main reactor MultiportMutableInput { s = new Source() c = new Scale() - p = new Print(scale = 2) + p = new Print(scale=2) s.out -> c._in c.out -> p._in } diff --git a/test/Python/src/multiport/MultiportMutableInputArray.lf b/test/Python/src/multiport/MultiportMutableInputArray.lf index a936910ddd..5ad5b362de 100644 --- a/test/Python/src/multiport/MultiportMutableInputArray.lf +++ b/test/Python/src/multiport/MultiportMutableInputArray.lf @@ -13,34 +13,34 @@ reactor Source { } # The scale parameter is just for testing. -reactor Print(scale = 1) { +reactor Print(scale=1) { input[2] _in reaction(_in) {= for (idx, port) in enumerate(_in): - print("Received on channel ", port.value) - if port.value != [(self.scale*i) for i in range(3*idx,(3*idx)+3)]: - sys.stderr.write("ERROR: Value received by Print does not match expectation!\n") - exit(1) + print("Received on channel ", port.value) + if port.value != [(self.scale*i) for i in range(3*idx,(3*idx)+3)]: + sys.stderr.write("ERROR: Value received by Print does not match expectation!\n") + exit(1) =} } -reactor Scale(scale = 2) { +reactor Scale(scale=2) { mutable input[2] _in output[2] out reaction(_in) -> out {= for (idx, port) in enumerate(_in): - if port.is_present: - port.value = [value*self.scale for value in port.value] - out[idx].set(port.value) + if port.is_present: + port.value = [value*self.scale for value in port.value] + out[idx].set(port.value) =} } main reactor MultiportMutableInputArray { s = new Source() c = new Scale() - p = new Print(scale = 2) + p = new Print(scale=2) s.out -> c._in c.out -> p._in } diff --git a/test/Python/src/multiport/MultiportOut.lf b/test/Python/src/multiport/MultiportOut.lf index 0e84fed165..b84f97989c 100644 --- a/test/Python/src/multiport/MultiportOut.lf +++ b/test/Python/src/multiport/MultiportOut.lf @@ -11,7 +11,7 @@ reactor Source { reaction(t) -> out {= for port in out: - port.set(self.s) + port.set(self.s) self.s+=1 =} @@ -31,21 +31,21 @@ reactor Destination { reaction(_in) {= sum = 0 for port in _in: - if port.is_present: - sum += port.value + if port.is_present: + sum += port.value print("Sum of received: " + str(sum)) if sum != self.s: - sys.stderr.write("ERROR: Expected " + str(self.s)) - exit(1) + sys.stderr.write("ERROR: Expected " + str(self.s)) + exit(1) self.s += 4 =} reaction(shutdown) {= if self.s == 0: - sys.stderr.write("ERROR: Destination received no input!") - exit(1) + sys.stderr.write("ERROR: Destination received no input!") + exit(1) print("Success.") =} diff --git a/test/Python/src/multiport/MultiportToBank.lf b/test/Python/src/multiport/MultiportToBank.lf index 8ac3e28321..e61fdc92b3 100644 --- a/test/Python/src/multiport/MultiportToBank.lf +++ b/test/Python/src/multiport/MultiportToBank.lf @@ -9,26 +9,26 @@ reactor Source { reaction(startup) -> out {= for (idx, port) in enumerate(out): - port.set(idx) + port.set(idx) =} } -reactor Destination(bank_index = 0) { +reactor Destination(bank_index=0) { input _in state received = 0 reaction(_in) {= print("Destination " + str(self.bank_index) + " received " + str(_in.value)) if self.bank_index != _in.value: - sys.stderr.write("ERROR: Expected " + str(self.bank_index)) - exit(1) + sys.stderr.write("ERROR: Expected " + str(self.bank_index)) + exit(1) self.received = True =} reaction(shutdown) {= if self.received is not True: - sys.stderr.write("ERROR: Destination " + str(self.bank_index) + " received no input!\n") - exit(1) + sys.stderr.write("ERROR: Destination " + str(self.bank_index) + " received no input!\n") + exit(1) print("Success.") =} } diff --git a/test/Python/src/multiport/MultiportToBankAfter.lf b/test/Python/src/multiport/MultiportToBankAfter.lf index e48624e853..228770f522 100644 --- a/test/Python/src/multiport/MultiportToBankAfter.lf +++ b/test/Python/src/multiport/MultiportToBankAfter.lf @@ -6,25 +6,25 @@ target Python { import Source from "MultiportToBank.lf" -reactor Destination(bank_index = 0) { +reactor Destination(bank_index=0) { input _in state received = False reaction(_in) {= print("Destination {:d} received {:d}.".format(self.bank_index, _in.value)) if self.bank_index != _in.value: - sys.stderr.write("ERROR: Expected {:d}.\n".format(self.bank_index)) - exit(1) + sys.stderr.write("ERROR: Expected {:d}.\n".format(self.bank_index)) + exit(1) if lf.time.logical_elapsed() != SEC(1): - sys.stderr.write("ERROR: Expected to receive input after one second.\n") - exit(2) + sys.stderr.write("ERROR: Expected to receive input after one second.\n") + exit(2) self.received = True =} reaction(shutdown) {= if self.received is not True: - sys.stderr.write("ERROR: Destination {:d} received no input!\n".format(self.bank_index)) - exit(3) + sys.stderr.write("ERROR: Destination {:d} received no input!\n".format(self.bank_index)) + exit(3) print("Success.") =} } diff --git a/test/Python/src/multiport/MultiportToBankHierarchy.lf b/test/Python/src/multiport/MultiportToBankHierarchy.lf index 8dde25e5da..5e7152bbb2 100644 --- a/test/Python/src/multiport/MultiportToBankHierarchy.lf +++ b/test/Python/src/multiport/MultiportToBankHierarchy.lf @@ -7,22 +7,22 @@ target Python { import Source from "MultiportToBank.lf" -reactor Destination(bank_index = 0) { +reactor Destination(bank_index=0) { input _in state received = False reaction(_in) {= print("Destination {:d} received {:d}.\n".format(self.bank_index, _in.value)) if self.bank_index != _in.value: - sys.stderr.write("ERROR: Expected {:d}.\n".format(self.bank_index)) - exit(1) + sys.stderr.write("ERROR: Expected {:d}.\n".format(self.bank_index)) + exit(1) self.received = True =} reaction(shutdown) {= if self.received is not True: - sys.stderr.write("ERROR: Destination {:d} received no input!\n".format(self.bank_index)) - exit(1) + sys.stderr.write("ERROR: Destination {:d} received no input!\n".format(self.bank_index)) + exit(1) print("Success.") =} } diff --git a/test/Python/src/multiport/MultiportToHierarchy.lf b/test/Python/src/multiport/MultiportToHierarchy.lf index e5820481b5..84b5f36f21 100644 --- a/test/Python/src/multiport/MultiportToHierarchy.lf +++ b/test/Python/src/multiport/MultiportToHierarchy.lf @@ -12,36 +12,36 @@ reactor Source { reaction(t) -> out {= for port in out: - port.set(self.s) - self.s += 1 + port.set(self.s) + self.s += 1 =} } -reactor Destination(width = 4) { +reactor Destination(width=4) { state s = 6 input[width] _in reaction(_in) {= sm = 0 for port in _in: - if port.is_present: - sm += port.value + if port.is_present: + sm += port.value print("Sum of received: ", sm) if sm != self.s: - sys.stderr.write("ERROR: Expected {:d}.\n".format(self.s)) - exit(1) + sys.stderr.write("ERROR: Expected {:d}.\n".format(self.s)) + exit(1) self.s += 16 =} reaction(shutdown) {= if self.s <= 6: - sys.stderr.write("ERROR: Destination received no input!\n") - exit(1) + sys.stderr.write("ERROR: Destination received no input!\n") + exit(1) print("Success.") =} } -reactor Container(width = 4) { +reactor Container(width=4) { input[width] _in dst = new Destination() _in -> dst._in diff --git a/test/Python/src/multiport/MultiportToMultiport.lf b/test/Python/src/multiport/MultiportToMultiport.lf index 33fa418feb..19fdb3b43b 100644 --- a/test/Python/src/multiport/MultiportToMultiport.lf +++ b/test/Python/src/multiport/MultiportToMultiport.lf @@ -6,23 +6,23 @@ target Python { import Destination from "MultiportToHierarchy.lf" -reactor Source(width = 1) { +reactor Source(width=1) { timer t(0, 200 msec) output[width] out state s = 0 reaction(t) -> out {= for i in range(len(out)): - print("Before SET, out[{:d}]->is_present has value %d".format(i), out[i].is_present) - out[i].set(self.s) - self.s += 1 - print("AFTER set, out[{:d}]->is_present has value ".format(i), out[i].is_present) - print("AFTER set, out[{:d}]->value has value ".format(i), out[i].value) + print("Before SET, out[{:d}]->is_present has value %d".format(i), out[i].is_present) + out[i].set(self.s) + self.s += 1 + print("AFTER set, out[{:d}]->is_present has value ".format(i), out[i].is_present) + print("AFTER set, out[{:d}]->value has value ".format(i), out[i].value) =} } main reactor MultiportToMultiport { - a = new Source(width = 4) - b = new Destination(width = 4) + a = new Source(width=4) + b = new Destination(width=4) a.out -> b._in } diff --git a/test/Python/src/multiport/MultiportToMultiport2.lf b/test/Python/src/multiport/MultiportToMultiport2.lf index 2a92c3ef3c..98b7c00817 100644 --- a/test/Python/src/multiport/MultiportToMultiport2.lf +++ b/test/Python/src/multiport/MultiportToMultiport2.lf @@ -1,33 +1,33 @@ # Test multiport to multiport connections. See also MultiportToMultiport. target Python -reactor Source(width = 2) { +reactor Source(width=2) { output[width] out reaction(startup) -> out {= for (idx, port) in enumerate(out): - port.set(idx) + port.set(idx) =} } -reactor Destination(width = 2) { +reactor Destination(width=2) { input[width] _in reaction(_in) {= for (idx, port) in enumerate(_in): - if port.is_present: - print("Received on channel {:d}: ".format(idx), port.value) - # NOTE: For testing purposes, this assumes the specific - # widths instantiated below. - if port.value != idx % 3: - sys.stderr.write("ERROR: expected {:d}!\n".format(idx % 3)) - exit(1) + if port.is_present: + print("Received on channel {:d}: ".format(idx), port.value) + # NOTE: For testing purposes, this assumes the specific + # widths instantiated below. + if port.value != idx % 3: + sys.stderr.write("ERROR: expected {:d}!\n".format(idx % 3)) + exit(1) =} } main reactor MultiportToMultiport2 { - a1 = new Source(width = 3) - a2 = new Source(width = 2) - b = new Destination(width = 5) + a1 = new Source(width=3) + a2 = new Source(width=2) + b = new Destination(width=5) a1.out, a2.out -> b._in } diff --git a/test/Python/src/multiport/MultiportToMultiport2After.lf b/test/Python/src/multiport/MultiportToMultiport2After.lf index 423a3b8b2e..f87d1f530b 100644 --- a/test/Python/src/multiport/MultiportToMultiport2After.lf +++ b/test/Python/src/multiport/MultiportToMultiport2After.lf @@ -3,27 +3,27 @@ target Python import Source from "MultiportToMultiport2.lf" -reactor Destination(width = 2) { +reactor Destination(width=2) { input[width] _in reaction(_in) {= for (idx, port) in enumerate(_in): - if port.is_present: - print("Received on channel {:d}: ".format(idx), port.value) - # NOTE: For testing purposes, this assumes the specific - # widths instantiated below. - if port.value != idx % 3: - sys.stderr.write("ERROR: expected {:d}!\n".format(idx % 3)) - exit(1) + if port.is_present: + print("Received on channel {:d}: ".format(idx), port.value) + # NOTE: For testing purposes, this assumes the specific + # widths instantiated below. + if port.value != idx % 3: + sys.stderr.write("ERROR: expected {:d}!\n".format(idx % 3)) + exit(1) if lf.time.logical_elapsed() != SEC(1): - sys.stderr.write("ERROR: Expected to receive input after one second.\n") - exit(2) + sys.stderr.write("ERROR: Expected to receive input after one second.\n") + exit(2) =} } main reactor MultiportToMultiport2After { - a1 = new Source(width = 3) - a2 = new Source(width = 2) - b = new Destination(width = 5) + a1 = new Source(width=3) + a2 = new Source(width=2) + b = new Destination(width=5) a1.out, a2.out -> b._in after 1 sec } diff --git a/test/Python/src/multiport/MultiportToMultiportArray.lf b/test/Python/src/multiport/MultiportToMultiportArray.lf index 4be3c1b68d..9aca96d365 100644 --- a/test/Python/src/multiport/MultiportToMultiportArray.lf +++ b/test/Python/src/multiport/MultiportToMultiportArray.lf @@ -11,8 +11,8 @@ reactor Source { reaction(t) -> out {= for port in out: - port.set([self.s, self.s + 1, self.s + 2]) - self.s += 3 + port.set([self.s, self.s + 1, self.s + 2]) + self.s += 3 =} } @@ -23,21 +23,21 @@ reactor Destination { reaction(_in) {= sm = 0 for port in _in: - if port.is_present: - sm += sum(port.value) + if port.is_present: + sm += sum(port.value) print("Sum of received: ", sm); if sm != self.s: - sys.stderr.write("ERROR: Expected {:d}.\n".format(self.s)) - exit(1) + sys.stderr.write("ERROR: Expected {:d}.\n".format(self.s)) + exit(1) self.s += 36 =} reaction(shutdown) {= if self.s <= 15: - sys.stderr.write("ERROR: Destination received no input!\n") - exit(1) + sys.stderr.write("ERROR: Destination received no input!\n") + exit(1) print("Success.") =} } diff --git a/test/Python/src/multiport/MultiportToMultiportParameter.lf b/test/Python/src/multiport/MultiportToMultiportParameter.lf index ac6b3663dc..e8da0a80d9 100644 --- a/test/Python/src/multiport/MultiportToMultiportParameter.lf +++ b/test/Python/src/multiport/MultiportToMultiportParameter.lf @@ -7,8 +7,8 @@ target Python { import Source from "MultiportToMultiport.lf" import Destination from "MultiportToHierarchy.lf" -main reactor MultiportToMultiportParameter(width = 4) { - a = new Source(width = width) - b = new Destination(width = width) +main reactor MultiportToMultiportParameter(width=4) { + a = new Source(width=width) + b = new Destination(width=width) a.out -> b._in } diff --git a/test/Python/src/multiport/MultiportToPort.lf b/test/Python/src/multiport/MultiportToPort.lf index cc8efe50d6..db4cde639b 100644 --- a/test/Python/src/multiport/MultiportToPort.lf +++ b/test/Python/src/multiport/MultiportToPort.lf @@ -9,12 +9,12 @@ reactor Source { reaction(startup) -> out {= for (idx, port) in enumerate(out): - print("Source sending ", idx) - port.set(idx) + print("Source sending ", idx) + port.set(idx) =} } -reactor Destination(expected = 0) { +reactor Destination(expected=0) { input _in state received = False @@ -22,14 +22,14 @@ reactor Destination(expected = 0) { print("Received: ", _in.value) self.received = True if _in.value != self.expected: - sys.stderr.write("ERROR: Expected {:d}.\n".format(self.expected)) - exit(1) + sys.stderr.write("ERROR: Expected {:d}.\n".format(self.expected)) + exit(1) =} reaction(shutdown) {= if self.received is not True: - sys.stderr.write("ERROR: Destination received no input!\n") - exit(1) + sys.stderr.write("ERROR: Destination received no input!\n") + exit(1) print("Success.") =} } @@ -37,6 +37,6 @@ reactor Destination(expected = 0) { main reactor MultiportToPort { a = new Source() b1 = new Destination() - b2 = new Destination(expected = 1) + b2 = new Destination(expected=1) a.out -> b1._in, b2._in } diff --git a/test/Python/src/multiport/MultiportToReaction.lf b/test/Python/src/multiport/MultiportToReaction.lf index 811f233038..55f81e21b5 100644 --- a/test/Python/src/multiport/MultiportToReaction.lf +++ b/test/Python/src/multiport/MultiportToReaction.lf @@ -4,38 +4,38 @@ target Python { fast: true } -reactor Source(width = 1) { +reactor Source(width=1) { timer t(0, 200 msec) state s = 0 output[width] out reaction(t) -> out {= for port in out: - port.set(self.s) - self.s += 1 + port.set(self.s) + self.s += 1 =} } main reactor { state s = 6 - b = new Source(width = 4) + b = new Source(width=4) reaction(b.out) {= sm = 0 for port in b.out: - if port.is_present: - sm += port.value + if port.is_present: + sm += port.value print("Sum of received: ", sm) if sm != self.s: - sys.stderr.write("ERROR: Expected {:d}.\n".format(self.s)) - exit(1) + sys.stderr.write("ERROR: Expected {:d}.\n".format(self.s)) + exit(1) self.s += 16 =} reaction(shutdown) {= if self.s <= 6: - sys.stderr.write("ERROR: Destination received no input!\n") - exit(1) + sys.stderr.write("ERROR: Destination received no input!\n") + exit(1) print("Success.") =} } diff --git a/test/Python/src/multiport/NestedBanks.lf b/test/Python/src/multiport/NestedBanks.lf index bc2c08db54..3ed6ed9c4c 100644 --- a/test/Python/src/multiport/NestedBanks.lf +++ b/test/Python/src/multiport/NestedBanks.lf @@ -13,13 +13,13 @@ main reactor { (a.x)+ -> c.z, d.u, e.t } -reactor A(bank_index = 0) { +reactor A(bank_index=0) { output[4] x - b = new[2] B(a_bank_index = bank_index) + b = new[2] B(a_bank_index=bank_index) b.y -> x } -reactor B(a_bank_index = 0, bank_index = 0) { +reactor B(a_bank_index=0, bank_index=0) { output[2] y reaction(startup) -> y {= @@ -29,10 +29,10 @@ reactor B(a_bank_index = 0, bank_index = 0) { =} } -reactor C(bank_index = 0) { +reactor C(bank_index=0) { input[2] z - f = new F(c_bank_index = bank_index) - g = new G(c_bank_index = bank_index) + f = new F(c_bank_index=bank_index) + g = new G(c_bank_index=bank_index) z -> f.w, g.s } @@ -41,10 +41,10 @@ reactor D { reaction(u) {= for (i, p) in enumerate(u): - print(f"d.u[{i}] received {p.value}.") - if p.value != (6 + i): - sys.stderr.write(f"ERROR: Expected {6 + i} but received {p.value}.\n") - exit(1) + print(f"d.u[{i}] received {p.value}.") + if p.value != (6 + i): + sys.stderr.write(f"ERROR: Expected {6 + i} but received {p.value}.\n") + exit(1) =} } @@ -53,28 +53,28 @@ reactor E { reaction(t) {= for (i, p) in enumerate(t): - print(f"e.t[{i}] received {p.value}.") + print(f"e.t[{i}] received {p.value}.") =} } -reactor F(c_bank_index = 0) { +reactor F(c_bank_index=0) { input w reaction(w) {= print(f"c[{self.c_bank_index}].f.w received {w.value}.") if w.value != self.c_bank_index * 2: - sys.stderr.write(f"ERROR: Expected {self.c_bank_index * 2} but received {w.value}.\n") - exit(1) + sys.stderr.write(f"ERROR: Expected {self.c_bank_index * 2} but received {w.value}.\n") + exit(1) =} } -reactor G(c_bank_index = 0) { +reactor G(c_bank_index=0) { input s reaction(s) {= print(f"c[{self.c_bank_index}].g.s received {s.value}.") if s.value != (self.c_bank_index * 2 + 1): - sys.stderr.write(f"ERROR: Expected {self.c_bank_index * 2 + 1} but received {s.value}.\n") - exit(1) + sys.stderr.write(f"ERROR: Expected {self.c_bank_index * 2 + 1} but received {s.value}.\n") + exit(1) =} } diff --git a/test/Python/src/multiport/NestedInterleavedBanks.lf b/test/Python/src/multiport/NestedInterleavedBanks.lf index 5e7967d217..3036069790 100644 --- a/test/Python/src/multiport/NestedInterleavedBanks.lf +++ b/test/Python/src/multiport/NestedInterleavedBanks.lf @@ -4,19 +4,19 @@ */ target Python -reactor A(bank_index = 0, outer_bank_index = 0) { +reactor A(bank_index=0, outer_bank_index=0) { output[2] p reaction(startup) -> p {= for i, port in enumerate(p): - port.set(self.outer_bank_index * 4 + self.bank_index * 2 + i + 1) - print(f"A sending {port.value}.") + port.set(self.outer_bank_index * 4 + self.bank_index * 2 + i + 1) + print(f"A sending {port.value}.") =} } -reactor B(bank_index = 0) { +reactor B(bank_index=0) { output[4] q - a = new[2] A(outer_bank_index = bank_index) + a = new[2] A(outer_bank_index=bank_index) interleaved(a.p) -> q } @@ -26,10 +26,10 @@ reactor C { reaction(i) {= expected = [1, 3, 2, 4, 5, 7, 6, 8] for j, port in enumerate(i): - print(f"C received {port.value}.") - if port.value != expected[j]: - sys.stderr.write(f"ERROR: Expected {expected[j]}.\n") - exit(1) + print(f"C received {port.value}.") + if port.value != expected[j]: + sys.stderr.write(f"ERROR: Expected {expected[j]}.\n") + exit(1) =} } diff --git a/test/Python/src/multiport/PipelineAfter.lf b/test/Python/src/multiport/PipelineAfter.lf index 43048f04ca..307a4122cd 100644 --- a/test/Python/src/multiport/PipelineAfter.lf +++ b/test/Python/src/multiport/PipelineAfter.lf @@ -19,11 +19,11 @@ reactor Sink { reaction(inp) {= print(f"Received {inp.value}") if inp.value != 42: - sys.stderr.write("ERROR: expected 42!\n") - exit(1) + sys.stderr.write("ERROR: expected 42!\n") + exit(1) if lf.time.logical_elapsed() != SEC(1): - sys.stderr.write("ERROR: Expected to receive input after one second.\n") - exit(2) + sys.stderr.write("ERROR: Expected to receive input after one second.\n") + exit(2) =} } diff --git a/test/Python/src/multiport/ReactionsToNested.lf b/test/Python/src/multiport/ReactionsToNested.lf index 1f05d5ba5b..b298a85a95 100644 --- a/test/Python/src/multiport/ReactionsToNested.lf +++ b/test/Python/src/multiport/ReactionsToNested.lf @@ -3,7 +3,7 @@ target Python { timeout: 1 sec } -reactor T(expected = 0) { +reactor T(expected=0) { input z state received = False @@ -11,21 +11,21 @@ reactor T(expected = 0) { print(f"T received {z.value}.") self.received = True if z.value != self.expected: - sys.stderr.write(f"ERROR: Expected {self.response}") - exit(1) + sys.stderr.write(f"ERROR: Expected {self.response}") + exit(1) =} reaction(shutdown) {= if self.received is not True: - sys.stderr.write(f"ERROR: No input received.") - exit(1) + sys.stderr.write(f"ERROR: No input received.") + exit(1) =} } reactor D { input[2] y - t1 = new T(expected = 42) - t2 = new T(expected = 43) + t1 = new T(expected=42) + t2 = new T(expected=43) y -> t1.z, t2.z } diff --git a/test/Python/src/target/AfterNoTypes.lf b/test/Python/src/target/AfterNoTypes.lf index ef92444c34..c2be99ef2c 100644 --- a/test/Python/src/target/AfterNoTypes.lf +++ b/test/Python/src/target/AfterNoTypes.lf @@ -22,21 +22,21 @@ reactor Print { elapsed_time = lf.time.logical_elapsed() print("Result is " + str(x.value)) if x.value != 84: - sys.stderr.write("ERROR: Expected result to be 84.\n") - exit(1) + sys.stderr.write("ERROR: Expected result to be 84.\n") + exit(1) print("Current logical time is: " + str(elapsed_time)) print("Current physical time is: " + str(lf.time.physical_elapsed())) if elapsed_time != self.expected_time: - sys.stderr.write("ERROR: Expected logical time to be " + self.expected_time) - exit(2) + sys.stderr.write("ERROR: Expected logical time to be " + self.expected_time) + exit(2) self.expected_time += SEC(1) =} reaction(shutdown) {= if (self.received == 0): - sys.stderr.write("ERROR: Final reactor received no data.\n") - exit(3) + sys.stderr.write("ERROR: Final reactor received no data.\n") + exit(3) =} } diff --git a/test/Rust/src/ActionImplicitDelay.lf b/test/Rust/src/ActionImplicitDelay.lf index 46b4a4d767..5ae8557a57 100644 --- a/test/Rust/src/ActionImplicitDelay.lf +++ b/test/Rust/src/ActionImplicitDelay.lf @@ -11,9 +11,9 @@ main reactor ActionImplicitDelay { assert_tag_is!(ctx, T0 + (40 * self.count) ms); self.count += 1; if self.count <= 3 { - ctx.schedule(act, Asap); + ctx.schedule(act, Asap); } else { - println!("SUCCESS") + println!("SUCCESS") } =} } diff --git a/test/Rust/src/ActionIsPresent.lf b/test/Rust/src/ActionIsPresent.lf index a581fe7574..f78bd95214 100644 --- a/test/Rust/src/ActionIsPresent.lf +++ b/test/Rust/src/ActionIsPresent.lf @@ -8,17 +8,17 @@ main reactor ActionIsPresent { reaction(startup, a) -> a {= if !ctx.is_present(a) { - assert_tag_is!(ctx, T0); - assert!(!self.tried, "Already tried, is_present does not work properly."); - self.tried = true; - // was triggered by startup - println!("Startup reaction @ {}", ctx.get_tag()); - ctx.schedule(a, after!(1 ns)); + assert_tag_is!(ctx, T0); + assert!(!self.tried, "Already tried, is_present does not work properly."); + self.tried = true; + // was triggered by startup + println!("Startup reaction @ {}", ctx.get_tag()); + ctx.schedule(a, after!(1 ns)); } else { - assert_tag_is!(ctx, T0 + 1 ns); - // was triggered by schedule above - println!("Scheduled reaction @ {}", ctx.get_tag()); - self.success = true; + assert_tag_is!(ctx, T0 + 1 ns); + // was triggered by schedule above + println!("Scheduled reaction @ {}", ctx.get_tag()); + self.success = true; } =} diff --git a/test/Rust/src/ActionIsPresentDouble.lf b/test/Rust/src/ActionIsPresentDouble.lf index 4aec9776be..a33914a1e6 100644 --- a/test/Rust/src/ActionIsPresentDouble.lf +++ b/test/Rust/src/ActionIsPresentDouble.lf @@ -15,7 +15,7 @@ main reactor ActionIsPresentDouble { assert!(ctx.is_present(act0)); assert!(ctx.is_present(act1)); if ctx.get_tag() == tag!(T0 + 100 ms) { - println!("success"); + println!("success"); } =} } diff --git a/test/Rust/src/ActionScheduleMicrostep.lf b/test/Rust/src/ActionScheduleMicrostep.lf index db1210190f..2912cc60ea 100644 --- a/test/Rust/src/ActionScheduleMicrostep.lf +++ b/test/Rust/src/ActionScheduleMicrostep.lf @@ -15,9 +15,9 @@ main reactor ActionScheduleMicrostep { assert_tag_is!(ctx, (T0, self.count)); self.count += 1; if self.count <= 3 { - ctx.schedule(act, Asap); + ctx.schedule(act, Asap); } else { - println!("SUCCESS") + println!("SUCCESS") } =} } diff --git a/test/Rust/src/ActionValues.lf b/test/Rust/src/ActionValues.lf index 8e8fb9f958..714e058195 100644 --- a/test/Rust/src/ActionValues.lf +++ b/test/Rust/src/ActionValues.lf @@ -16,12 +16,12 @@ main reactor ActionValues { println!("At {}, received {:?}", ctx.get_tag(), ctx.get(act)); if ctx.get_tag() == tag!(T0 + 100 ms) { - assert_eq!(Some(100), ctx.get(act)); - self.r1done = true; + assert_eq!(Some(100), ctx.get(act)); + self.r1done = true; } else { - assert_tag_is!(ctx, T0 + 150 ms); - assert_eq!(Some(-100), ctx.get(act)); - self.r2done = true; + assert_tag_is!(ctx, T0 + 150 ms); + assert_eq!(Some(-100), ctx.get(act)); + self.r2done = true; } =} diff --git a/test/Rust/src/ActionValuesCleanup.lf b/test/Rust/src/ActionValuesCleanup.lf index 6ad9bd1b38..1db2759ad6 100644 --- a/test/Rust/src/ActionValuesCleanup.lf +++ b/test/Rust/src/ActionValuesCleanup.lf @@ -11,11 +11,11 @@ main reactor ActionValuesCleanup { #[derive(Clone, Debug)] struct FooDrop { } impl std::ops::Drop for FooDrop { - fn drop(&mut self) { - unsafe { - DROPPED.store(true, Ordering::SeqCst); - } + fn drop(&mut self) { + unsafe { + DROPPED.store(true, Ordering::SeqCst); } + } } =} @@ -27,17 +27,17 @@ main reactor ActionValuesCleanup { reaction(act) -> act {= ctx.use_ref(act, |v| println!("{:?}", v)); if self.count == 0 { - self.count = 1; - assert!(ctx.is_present(act)); - assert!(ctx.use_ref(act, |v| v.is_some())); - ctx.schedule(act, Asap); + self.count = 1; + assert!(ctx.is_present(act)); + assert!(ctx.use_ref(act, |v| v.is_some())); + ctx.schedule(act, Asap); } else if self.count == 1 { - assert!(ctx.is_present(act)); - assert!(ctx.use_ref(act, |v| v.is_none())); - assert!(unsafe { DROPPED.load(Ordering::SeqCst) }); - self.count = 2; + assert!(ctx.is_present(act)); + assert!(ctx.use_ref(act, |v| v.is_none())); + assert!(unsafe { DROPPED.load(Ordering::SeqCst) }); + self.count = 2; } else { - unreachable!(); + unreachable!(); } =} diff --git a/test/Rust/src/CompositionWithPorts.lf b/test/Rust/src/CompositionWithPorts.lf index 94fc2de449..802f8cac21 100644 --- a/test/Rust/src/CompositionWithPorts.lf +++ b/test/Rust/src/CompositionWithPorts.lf @@ -11,10 +11,10 @@ reactor Sink { reaction(inport) {= if let Some(value) = ctx.get(inport) { - println!("received {}", value); - assert_eq!(76600, value); + println!("received {}", value); + assert_eq!(76600, value); } else { - unreachable!(); + unreachable!(); } =} } diff --git a/test/Rust/src/CtorParamMixed.lf b/test/Rust/src/CtorParamMixed.lf index 33c4730eb9..de9a1146bb 100644 --- a/test/Rust/src/CtorParamMixed.lf +++ b/test/Rust/src/CtorParamMixed.lf @@ -14,5 +14,5 @@ reactor Print(value: i32 = 42, name: String = {= "xxx".into() =}, other: bool = } main reactor CtorParamMixed { - p = new Print(other = true, name = {= "x2hr".into() =}) + p = new Print(other=true, name = {= "x2hr".into() =}) } diff --git a/test/Rust/src/CtorParamSimple.lf b/test/Rust/src/CtorParamSimple.lf index 09a3046af3..688efd3ff9 100644 --- a/test/Rust/src/CtorParamSimple.lf +++ b/test/Rust/src/CtorParamSimple.lf @@ -10,5 +10,5 @@ reactor Print(value: i32 = 42) { } main reactor CtorParamSimple { - p = new Print(value = 23) + p = new Print(value=23) } diff --git a/test/Rust/src/DependencyThroughChildPort.lf b/test/Rust/src/DependencyThroughChildPort.lf index 851472503f..c8e8bf1592 100644 --- a/test/Rust/src/DependencyThroughChildPort.lf +++ b/test/Rust/src/DependencyThroughChildPort.lf @@ -9,18 +9,18 @@ reactor Destination { reaction(x, y) {= let tag = ctx.get_tag(); println!( - "Time since start: {}, microstep: {}", - tag.offset_from_t0.as_nanos(), - tag.microstep, + "Time since start: {}, microstep: {}", + tag.offset_from_t0.as_nanos(), + tag.microstep, ); if tag == tag!(T0) { - assert!(ctx.is_present(x)); - assert_eq!(self.exec_count, 0); + assert!(ctx.is_present(x)); + assert_eq!(self.exec_count, 0); } else { - assert_tag_is!(ctx, (T0, 1)); - assert!(ctx.is_present(y)); - assert_eq!(self.exec_count, 1); + assert_tag_is!(ctx, (T0, 1)); + assert!(ctx.is_present(y)); + assert_eq!(self.exec_count, 1); } self.exec_count += 1; =} diff --git a/test/Rust/src/DependencyUseAccessible.lf b/test/Rust/src/DependencyUseAccessible.lf index 6e288af8e8..0654d25f60 100644 --- a/test/Rust/src/DependencyUseAccessible.lf +++ b/test/Rust/src/DependencyUseAccessible.lf @@ -22,15 +22,15 @@ reactor Sink { reaction(clock) in1, in2 {= match ctx.get(clock) { - Some(0) | Some(2) => { - assert_eq!(None, ctx.get(in1)); - assert_eq!(None, ctx.get(in2)); - }, - Some(1) => { - assert_eq!(Some(10), ctx.get(in1)); - assert_eq!(None, ctx.get(in2)); - }, - c => panic!("No such signal expected {:?}", c) + Some(0) | Some(2) => { + assert_eq!(None, ctx.get(in1)); + assert_eq!(None, ctx.get(in2)); + }, + Some(1) => { + assert_eq!(Some(10), ctx.get(in1)); + assert_eq!(None, ctx.get(in2)); + }, + c => panic!("No such signal expected {:?}", c) } =} } diff --git a/test/Rust/src/DependencyUseOnLogicalAction.lf b/test/Rust/src/DependencyUseOnLogicalAction.lf index f1b244901e..49b7e86bb0 100644 --- a/test/Rust/src/DependencyUseOnLogicalAction.lf +++ b/test/Rust/src/DependencyUseOnLogicalAction.lf @@ -27,15 +27,15 @@ main reactor { reaction(clock) a, t {= match ctx.get(clock) { - Some(2) | Some(4) => { - assert!(ctx.is_present(t)); // t is there on even millis - assert!(!ctx.is_present(a)); // - }, - Some(3) | Some(5) => { - assert!(!ctx.is_present(t)); - assert!(ctx.is_present(a)); - }, - it => unreachable!("{:?}", it) + Some(2) | Some(4) => { + assert!(ctx.is_present(t)); // t is there on even millis + assert!(!ctx.is_present(a)); // + }, + Some(3) | Some(5) => { + assert!(!ctx.is_present(t)); + assert!(ctx.is_present(a)); + }, + it => unreachable!("{:?}", it) } self.tick += 1; =} diff --git a/test/Rust/src/NativeListsAndTimes.lf b/test/Rust/src/NativeListsAndTimes.lf index 5d95f2fa07..5401d6d1b9 100644 --- a/test/Rust/src/NativeListsAndTimes.lf +++ b/test/Rust/src/NativeListsAndTimes.lf @@ -2,16 +2,16 @@ target Rust // This test passes if it is successfully compiled into valid target code. reactor Foo( - x: i32 = 0, - y: time = 0, // Units are missing but not required - z = 1 msec, // Type is missing but not required - p: i32[](1, 2, 3, 4), // List of integers - p2: i32[] = {= vec![1] =}, // List of integers with single element - // todo // p2: i32[](1), // List of integers with single element p3: i32[](), // Empty list of - // integers List of time values - q: Vec(1 msec, 2 msec, 3 msec), - g: time[](1 msec, 2 msec) // List of time values -) { + x: i32 = 0, + y: time = 0, // Units are missing but not required + z = 1 msec, // Type is missing but not required + p: i32[](1, 2, 3, 4), // List of integers + p2: i32[] = {= vec![1] =}, // List of integers with single element + // todo // p2: i32[](1), // List of integers with single element p3: i32[](), // Empty list of + // integers List of time values + q: Vec(1 msec, 2 msec, 3 msec), + // List of time values + g: time[](1 msec, 2 msec)) { state s: time = y // Reference to explicitly typed time parameter state t: time = z // Reference to implicitly typed time parameter state v: bool // Uninitialized boolean state variable diff --git a/test/Rust/src/PhysicalActionKeepaliveIsSmart.lf b/test/Rust/src/PhysicalActionKeepaliveIsSmart.lf index a10abd9a7a..96a8aa7b01 100644 --- a/test/Rust/src/PhysicalActionKeepaliveIsSmart.lf +++ b/test/Rust/src/PhysicalActionKeepaliveIsSmart.lf @@ -9,8 +9,8 @@ main reactor { reaction(startup) -> act {= std::thread::spawn(|| { - std::thread::sleep(delay!(1 sec)); - // this is a regular thread which doesn't have a reference to the scheduler + std::thread::sleep(delay!(1 sec)); + // this is a regular thread which doesn't have a reference to the scheduler }); =} diff --git a/test/Rust/src/PhysicalActionWakesSleepingScheduler.lf b/test/Rust/src/PhysicalActionWakesSleepingScheduler.lf index de6a92c72f..d99732ca9c 100644 --- a/test/Rust/src/PhysicalActionWakesSleepingScheduler.lf +++ b/test/Rust/src/PhysicalActionWakesSleepingScheduler.lf @@ -13,8 +13,8 @@ main reactor { reaction(startup) -> act {= let act = act.clone(); ctx.spawn_physical_thread(move |link| { - std::thread::sleep(delay!(20 msec)); - link.schedule_physical(&act, Asap); + std::thread::sleep(delay!(20 msec)); + link.schedule_physical(&act, Asap); }); =} diff --git a/test/Rust/src/PhysicalActionWithKeepalive.lf b/test/Rust/src/PhysicalActionWithKeepalive.lf index a1abdd7743..f69318dfd5 100644 --- a/test/Rust/src/PhysicalActionWithKeepalive.lf +++ b/test/Rust/src/PhysicalActionWithKeepalive.lf @@ -8,8 +8,8 @@ main reactor { reaction(startup) -> act {= let act = act.clone(); ctx.spawn_physical_thread(move |link| { - std::thread::sleep(Duration::from_millis(20)); - link.schedule_physical_with_v(&act, Some(434), Asap); + std::thread::sleep(Duration::from_millis(20)); + link.schedule_physical_with_v(&act, Some(434), Asap); }); =} diff --git a/test/Rust/src/PortRefCleanup.lf b/test/Rust/src/PortRefCleanup.lf index 3704998794..1709ae1618 100644 --- a/test/Rust/src/PortRefCleanup.lf +++ b/test/Rust/src/PortRefCleanup.lf @@ -24,11 +24,11 @@ main reactor { reaction(boxr.out, t2) {= if self.reaction_num == 1 { - assert!(matches!(ctx.get(boxr__out), Some(150))); + assert!(matches!(ctx.get(boxr__out), Some(150))); } else { - assert_eq!(self.reaction_num, 2); - assert!(ctx.get(boxr__out).is_none(), "value should have been cleaned up"); - self.done = true; + assert_eq!(self.reaction_num, 2); + assert!(ctx.get(boxr__out).is_none(), "value should have been cleaned up"); + self.done = true; } self.reaction_num += 1; =} diff --git a/test/Rust/src/PortValueCleanup.lf b/test/Rust/src/PortValueCleanup.lf index 5200956cdc..ea0c9f50a0 100644 --- a/test/Rust/src/PortValueCleanup.lf +++ b/test/Rust/src/PortValueCleanup.lf @@ -16,11 +16,11 @@ reactor Sink { reaction(in, t2) {= if self.reaction_num == 0 { - assert!(matches!(ctx.get(r#in), Some(150))); + assert!(matches!(ctx.get(r#in), Some(150))); } else { - assert_eq!(self.reaction_num, 1); - assert!(ctx.get(r#in).is_none(), "value should have been cleaned up"); - self.done = true; + assert_eq!(self.reaction_num, 1); + assert!(ctx.get(r#in).is_none(), "value should have been cleaned up"); + self.done = true; } self.reaction_num += 1; =} diff --git a/test/Rust/src/Preamble.lf b/test/Rust/src/Preamble.lf index 68e2a2f709..3f195808d7 100644 --- a/test/Rust/src/Preamble.lf +++ b/test/Rust/src/Preamble.lf @@ -3,7 +3,7 @@ target Rust main reactor Preamble { preamble {= fn add_42(i: i32) -> i32 { - return i + 42; + return i + 42; } =} diff --git a/test/Rust/src/SingleFileGeneration.lf b/test/Rust/src/SingleFileGeneration.lf index a3cfdc89f8..c88a4bdcbd 100644 --- a/test/Rust/src/SingleFileGeneration.lf +++ b/test/Rust/src/SingleFileGeneration.lf @@ -14,10 +14,10 @@ reactor Sink { reaction(inport) {= if let Some(value) = ctx.get(inport) { - println!("received {}", value); - assert_eq!(76600, value); + println!("received {}", value); + assert_eq!(76600, value); } else { - unreachable!(); + unreachable!(); } =} } diff --git a/test/Rust/src/Stop.lf b/test/Rust/src/Stop.lf index b70a034c12..49a84a35c9 100644 --- a/test/Rust/src/Stop.lf +++ b/test/Rust/src/Stop.lf @@ -28,11 +28,11 @@ reactor Sender(take_a_break_after: u32 = 10, break_interval: time = 400 msec) { self.sent_messages += 1; if self.sent_messages < self.take_a_break_after { - ctx.schedule(act, Asap); + ctx.schedule(act, Asap); } else { - // Take a break - self.sent_messages = 0; - ctx.schedule(act, After(self.break_interval)); + // Take a break + self.sent_messages = 0; + ctx.schedule(act, After(self.break_interval)); } =} } @@ -45,17 +45,17 @@ reactor Consumer { let current_tag = ctx.get_tag(); if current_tag > tag!(T0 + 10 ms, 9) { - // The reaction should not have been called at tags larger than (10 msec, 9) - panic!("ERROR: Invoked reaction(in) at tag bigger than shutdown."); + // The reaction should not have been called at tags larger than (10 msec, 9) + panic!("ERROR: Invoked reaction(in) at tag bigger than shutdown."); } else if current_tag == tag!(T0 + 10 ms, 8) { - // Call request_stop() at relative tag (10 msec, 8) - println!("Requesting stop."); - ctx.request_stop(Asap); - return; + // Call request_stop() at relative tag (10 msec, 8) + println!("Requesting stop."); + ctx.request_stop(Asap); + return; } else if current_tag == tag!(T0 + 10 ms, 9) { - // Check that this reaction is indeed also triggered at (10 msec, 9) - self.reaction_invoked_correctly = true; - return; + // Check that this reaction is indeed also triggered at (10 msec, 9) + self.reaction_invoked_correctly = true; + return; } println!("Tag is {}.", current_tag); =} @@ -67,12 +67,12 @@ reactor Consumer { // Check to see if shutdown is called at relative tag (10 msec, 9) if current_tag == tag!(T0 + 10 ms, 9) && self.reaction_invoked_correctly { - println!("SUCCESS: successfully enforced stop."); + println!("SUCCESS: successfully enforced stop."); } else if current_tag > tag!(T0 + 10 ms, 9) { - panic!("ERROR: Shutdown invoked at tag {}. Failed to enforce timeout at (T0 + 10ms, 9).", current_tag); + panic!("ERROR: Shutdown invoked at tag {}. Failed to enforce timeout at (T0 + 10ms, 9).", current_tag); } else if !self.reaction_invoked_correctly { - // Check to see if reactions were called correctly - panic!("ERROR: Failed to invoke reaction(in) at tag {}.", current_tag); + // Check to see if reactions were called correctly + panic!("ERROR: Failed to invoke reaction(in) at tag {}.", current_tag); } =} } diff --git a/test/Rust/src/StopAsync.lf b/test/Rust/src/StopAsync.lf index ca2be1c8a6..c212a9689e 100644 --- a/test/Rust/src/StopAsync.lf +++ b/test/Rust/src/StopAsync.lf @@ -3,8 +3,8 @@ target Rust main reactor { reaction(startup) {= ctx.spawn_physical_thread(|ctx| { - std::thread::sleep(delay!(140 msec)); - ctx.request_stop(Asap); + std::thread::sleep(delay!(140 msec)); + ctx.request_stop(Asap); }); =} diff --git a/test/Rust/src/StopTimeoutExact.lf b/test/Rust/src/StopTimeoutExact.lf index 0261e8b0d9..e9c9cc0da0 100644 --- a/test/Rust/src/StopTimeoutExact.lf +++ b/test/Rust/src/StopTimeoutExact.lf @@ -13,7 +13,7 @@ main reactor StopTimeoutExact { reaction(t) {= if ctx.get_tag() == tag!(T0 + 50 ms) { - self.reacted_on_shutdown = true; + self.reacted_on_shutdown = true; } =} diff --git a/test/Rust/src/StructAsState.lf b/test/Rust/src/StructAsState.lf index 574d3ff59f..36828ddf60 100644 --- a/test/Rust/src/StructAsState.lf +++ b/test/Rust/src/StructAsState.lf @@ -5,8 +5,8 @@ target Rust main reactor StructAsState { preamble {= struct Hello { - name: String, - value: i32, + name: String, + value: i32, } =} /** @@ -20,8 +20,8 @@ main reactor StructAsState { reaction(startup) {= println!("State s.name=\"{}\", s.value={}.", self.s.name, self.s.value); if self.s.value != 42 { - eprintln!("FAILED: Expected 42."); - std::process::exit(1); + eprintln!("FAILED: Expected 42."); + std::process::exit(1); } =} } diff --git a/test/Rust/src/StructAsType.lf b/test/Rust/src/StructAsType.lf index 38242be033..867651e8de 100644 --- a/test/Rust/src/StructAsType.lf +++ b/test/Rust/src/StructAsType.lf @@ -6,8 +6,8 @@ reactor Source { preamble {= pub struct Hello { - pub name: String, - pub value: i32, + pub name: String, + pub value: i32, } =} @@ -25,10 +25,10 @@ reactor Print(expected: i32 = 42) { reaction(inp) {= ctx.use_ref_opt(inp, |hello| { - println!("Received: name=\"{}\", value={}.", hello.name, hello.value); - if hello.value != self.expected { - panic!("ERROR: Expected value to be {}.\n", self.expected); - } + println!("Received: name=\"{}\", value={}.", hello.name, hello.value); + if hello.value != self.expected { + panic!("ERROR: Expected value to be {}.\n", self.expected); + } }); =} } diff --git a/test/Rust/src/TimerIsPresent.lf b/test/Rust/src/TimerIsPresent.lf index 18977c42cf..4e675181eb 100644 --- a/test/Rust/src/TimerIsPresent.lf +++ b/test/Rust/src/TimerIsPresent.lf @@ -14,32 +14,32 @@ main reactor { reaction(startup, a, b, c) {= match self.tick { 0 => { // startup - assert_tag_is!(ctx, T0); - assert!(ctx.is_present(a)); - assert!(!ctx.is_present(b)); - assert!(!ctx.is_present(c)); + assert_tag_is!(ctx, T0); + assert!(ctx.is_present(a)); + assert!(!ctx.is_present(b)); + assert!(!ctx.is_present(c)); }, 1 => { // 1 msec - assert_tag_is!(ctx, T0 + 1 ms); - assert!(!ctx.is_present(a)); - assert!(ctx.is_present(b)); - assert!(ctx.is_present(c)); + assert_tag_is!(ctx, T0 + 1 ms); + assert!(!ctx.is_present(a)); + assert!(ctx.is_present(b)); + assert!(ctx.is_present(c)); }, 2 => { // 5 msec (a triggers) - assert_tag_is!(ctx, T0 + 5 ms); - assert!(ctx.is_present(a)); - assert!(!ctx.is_present(b)); - assert!(!ctx.is_present(c)); + assert_tag_is!(ctx, T0 + 5 ms); + assert!(ctx.is_present(a)); + assert!(!ctx.is_present(b)); + assert!(!ctx.is_present(c)); }, 3 => { // 6 msec (b triggers) - assert_tag_is!(ctx, T0 + 6 ms); - assert!(!ctx.is_present(a)); - assert!(ctx.is_present(b)); - assert!(!ctx.is_present(c)); - self.success = true; + assert_tag_is!(ctx, T0 + 6 ms); + assert!(!ctx.is_present(a)); + assert!(ctx.is_present(b)); + assert!(!ctx.is_present(c)); + self.success = true; }, _ => { - unreachable!("unexpected reaction invocation"); + unreachable!("unexpected reaction invocation"); } } self.tick += 1; diff --git a/test/Rust/src/concurrent/AsyncCallback.lf b/test/Rust/src/concurrent/AsyncCallback.lf index 64ced0d2be..c6e42c3909 100644 --- a/test/Rust/src/concurrent/AsyncCallback.lf +++ b/test/Rust/src/concurrent/AsyncCallback.lf @@ -20,18 +20,18 @@ main reactor AsyncCallback(period: time = 10 msec) { let act = act.clone(); let period = self.period; if let Some(old_thread) = self.thread.take() { - old_thread.join().ok(); + old_thread.join().ok(); } // start new thread let new_thread = ctx.spawn_physical_thread(move |ctx| { - // Simulate time passing before a callback occurs - thread::sleep(period); - // Schedule twice. If the action is not physical, these should - // get consolidated into a single action triggering. If it is, - // then they cause two separate triggerings with close but not - // equal time stamps. - ctx.schedule_physical(&act, Asap).ok(); - ctx.schedule_physical(&act, Asap).ok(); + // Simulate time passing before a callback occurs + thread::sleep(period); + // Schedule twice. If the action is not physical, these should + // get consolidated into a single action triggering. If it is, + // then they cause two separate triggerings with close but not + // equal time stamps. + ctx.schedule_physical(&act, Asap).ok(); + ctx.schedule_physical(&act, Asap).ok(); }); self.thread.replace(new_thread); @@ -41,19 +41,19 @@ main reactor AsyncCallback(period: time = 10 msec) { let elapsed_time = ctx.get_elapsed_logical_time(); let i = self.i; println!("Asynchronous callback {}: Assigned logical time greater than start time by {} ms", - i, elapsed_time.as_millis()); + i, elapsed_time.as_millis()); assert!(elapsed_time > self.expected_time,"ERROR: Expected logical time to be larger than {} ms", self.expected_time.as_millis()); self.i += 1; if self.toggle { - self.expected_time += self.period; + self.expected_time += self.period; } self.toggle = !self.toggle; =} reaction(shutdown) {= if let Some(thread) = self.thread.take() { - thread.join().ok(); + thread.join().ok(); } println!("success"); =} diff --git a/test/Rust/src/concurrent/Workers.lf b/test/Rust/src/concurrent/Workers.lf index fd330a73cb..9f2afa1f43 100644 --- a/test/Rust/src/concurrent/Workers.lf +++ b/test/Rust/src/concurrent/Workers.lf @@ -5,9 +5,9 @@ target Rust { main reactor { reaction(startup) {= if (ctx.num_workers() != 16) { - panic!("Expected to have 16 workers."); + panic!("Expected to have 16 workers."); } else { - println!("Using 16 workers."); + println!("Using 16 workers."); } =} } diff --git a/test/Rust/src/generics/CtorParamGeneric.lf b/test/Rust/src/generics/CtorParamGeneric.lf index 44d630a152..2104da5f54 100644 --- a/test/Rust/src/generics/CtorParamGeneric.lf +++ b/test/Rust/src/generics/CtorParamGeneric.lf @@ -2,21 +2,20 @@ target Rust reactor Generic<{= T: Default + Eq + Sync + std::fmt::Debug =}>( - value: T = {= Default::default() =} -) { + value: T = {= Default::default() =}) { input in: T state v: T = value reaction(in) {= ctx.use_ref_opt(r#in, |i| { - assert_eq!(&self.v, i); - println!("success"); + assert_eq!(&self.v, i); + println!("success"); }); =} } main reactor { - p = new Generic(value = 23) + p = new Generic(value=23) reaction(startup) -> p.in {= ctx.set(p__in, 23); =} } diff --git a/test/Rust/src/generics/CtorParamGenericInst.lf b/test/Rust/src/generics/CtorParamGenericInst.lf index 8c5d2522aa..1471178a17 100644 --- a/test/Rust/src/generics/CtorParamGenericInst.lf +++ b/test/Rust/src/generics/CtorParamGenericInst.lf @@ -3,31 +3,29 @@ target Rust reactor Generic2<{= T: Default + Eq + Sync + std::fmt::Debug + Send + 'static =}>( - value: T = {= Default::default() =} -) { + value: T = {= Default::default() =}) { input in: T state v: T = value reaction(in) {= ctx.use_ref_opt(r#in, |i| { - assert_eq!(&self.v, i); - println!("success"); + assert_eq!(&self.v, i); + println!("success"); }); =} } reactor Generic<{= T: Default + Eq + Sync + std::fmt::Debug + Copy + Send + 'static =}>( - value: T = {= Default::default() =} -) { + value: T = {= Default::default() =}) { input in: T - inner = new Generic2(value = value) + inner = new Generic2(value=value) in -> inner.in } main reactor { - p = new Generic(value = 23) + p = new Generic(value=23) reaction(startup) -> p.in {= ctx.set(p__in, 23); =} } diff --git a/test/Rust/src/generics/GenericComplexType.lf b/test/Rust/src/generics/GenericComplexType.lf index 34765ade72..d427f65b25 100644 --- a/test/Rust/src/generics/GenericComplexType.lf +++ b/test/Rust/src/generics/GenericComplexType.lf @@ -9,8 +9,8 @@ reactor R { reaction(in) {= ctx.use_ref(r#in, |a| { - assert_eq!(a, Some(&vec![delay!(20 ms)])); - println!("success"); + assert_eq!(a, Some(&vec![delay!(20 ms)])); + println!("success"); }); =} } diff --git a/test/Rust/src/lib/SomethingWithAPreamble.lf b/test/Rust/src/lib/SomethingWithAPreamble.lf index af5caa871b..cb1cf7a2c6 100644 --- a/test/Rust/src/lib/SomethingWithAPreamble.lf +++ b/test/Rust/src/lib/SomethingWithAPreamble.lf @@ -6,7 +6,7 @@ reactor SomethingWithAPreamble { input a: u32 preamble {= pub fn some_fun() -> u32 { - 4 + 4 } =} } diff --git a/test/Rust/src/multiport/ConnectionToSelfBank.lf b/test/Rust/src/multiport/ConnectionToSelfBank.lf index f80ccecd76..c396bcb5e6 100644 --- a/test/Rust/src/multiport/ConnectionToSelfBank.lf +++ b/test/Rust/src/multiport/ConnectionToSelfBank.lf @@ -16,6 +16,6 @@ reactor Node(bank_index: usize = 0, num_nodes: usize = 4) { } main reactor(num_nodes: usize = 4) { - nodes = new[num_nodes] Node(num_nodes = num_nodes) + nodes = new[num_nodes] Node(num_nodes=num_nodes) (nodes.out)+ -> nodes.in } diff --git a/test/Rust/src/multiport/ConnectionToSelfMultiport.lf b/test/Rust/src/multiport/ConnectionToSelfMultiport.lf index 626b855ddb..3f400dab40 100644 --- a/test/Rust/src/multiport/ConnectionToSelfMultiport.lf +++ b/test/Rust/src/multiport/ConnectionToSelfMultiport.lf @@ -8,7 +8,7 @@ reactor Node(num_nodes: usize = 4) { reaction(startup) -> out {= for (i, out) in out.into_iter().enumerate() { - ctx.set(out, i) + ctx.set(out, i) } =} @@ -20,6 +20,6 @@ reactor Node(num_nodes: usize = 4) { } main reactor(num_nodes: usize = 4) { - nodes = new Node(num_nodes = num_nodes) + nodes = new Node(num_nodes=num_nodes) nodes.out -> nodes.in // todo: (nodes.out)+ -> nodes.in; } diff --git a/test/Rust/src/multiport/FullyConnected.lf b/test/Rust/src/multiport/FullyConnected.lf index 7d28d92c4b..e83a0cac3d 100644 --- a/test/Rust/src/multiport/FullyConnected.lf +++ b/test/Rust/src/multiport/FullyConnected.lf @@ -21,6 +21,6 @@ reactor Right(bank_index: usize = 0, num_nodes: usize = 4) { main reactor(num_nodes: usize = 4) { left = new[num_nodes] Left() - right = new[num_nodes] Right(num_nodes = num_nodes) + right = new[num_nodes] Right(num_nodes=num_nodes) (left.out)+ -> right.in } diff --git a/test/Rust/src/multiport/FullyConnectedAddressable.lf b/test/Rust/src/multiport/FullyConnectedAddressable.lf index 335648f8f9..7163e7da55 100644 --- a/test/Rust/src/multiport/FullyConnectedAddressable.lf +++ b/test/Rust/src/multiport/FullyConnectedAddressable.lf @@ -22,31 +22,31 @@ reactor Node(bank_index: usize = 0, num_nodes: usize = 4) { let mut count = 0; let mut result = 0; for port in inpt { - if let Some(v) = ctx.get(port) { - count += 1; - result = v; - print!("{}, ", result); - } + if let Some(v) = ctx.get(port) { + count += 1; + result = v; + print!("{}, ", result); + } } print!("\n"); let expected = if self.bank_index == 0 { self.num_nodes - 1 } else { self.bank_index - 1 }; if count != 1 || result != expected { - panic!("ERROR: received an unexpected message!"); + panic!("ERROR: received an unexpected message!"); } =} reaction(shutdown) {= if !self.received { - panic!("Error: received no input!"); + panic!("Error: received no input!"); } =} } main reactor(num_nodes: usize = 4) { - nodes1 = new[num_nodes] Node(num_nodes = num_nodes) + nodes1 = new[num_nodes] Node(num_nodes=num_nodes) nodes1.out -> interleaved(nodes1.inpt) - nodes2 = new[num_nodes] Node(num_nodes = num_nodes) + nodes2 = new[num_nodes] Node(num_nodes=num_nodes) interleaved(nodes2.out) -> nodes2.inpt } diff --git a/test/Rust/src/multiport/MultiportFromBank.lf b/test/Rust/src/multiport/MultiportFromBank.lf index 1ff2d375ef..cf66939562 100644 --- a/test/Rust/src/multiport/MultiportFromBank.lf +++ b/test/Rust/src/multiport/MultiportFromBank.lf @@ -15,7 +15,7 @@ reactor Destination(port_width: usize = 2) { reaction(in) {= for (i, port) in r#in.enumerate_set() { - assert_eq!(Some(i), ctx.get(port), "Failed for input in[{}]", i); + assert_eq!(Some(i), ctx.get(port), "Failed for input in[{}]", i); } println!("Success"); =} @@ -23,6 +23,6 @@ reactor Destination(port_width: usize = 2) { main reactor { a = new[4] Source() - b = new Destination(port_width = 4) + b = new Destination(port_width=4) a.out -> b.in } diff --git a/test/Rust/src/multiport/MultiportFromHierarchy.lf b/test/Rust/src/multiport/MultiportFromHierarchy.lf index 6e9afc643f..3648b22999 100644 --- a/test/Rust/src/multiport/MultiportFromHierarchy.lf +++ b/test/Rust/src/multiport/MultiportFromHierarchy.lf @@ -10,8 +10,8 @@ reactor Source { reaction(t) -> out {= for chan in out { - ctx.set(chan, self.s); - self.s += 1; + ctx.set(chan, self.s); + self.s += 1; } =} } diff --git a/test/Rust/src/multiport/MultiportOut.lf b/test/Rust/src/multiport/MultiportOut.lf index 9a7ec7a7e5..baec45b5b6 100644 --- a/test/Rust/src/multiport/MultiportOut.lf +++ b/test/Rust/src/multiport/MultiportOut.lf @@ -10,7 +10,7 @@ reactor Source { reaction(t) -> out {= for i in 0..out.len() { - ctx.set(&mut out[i], self.s); + ctx.set(&mut out[i], self.s); } self.s += 1; =} @@ -36,9 +36,9 @@ reactor Destination { reaction(in) {= let mut sum = 0; for channel in r#in { - if let Some(ci) = ctx.get(channel) { - sum += ci; - } + if let Some(ci) = ctx.get(channel) { + sum += ci; + } } println!("Sum of received: {}", sum); assert_eq!(sum, self.s); diff --git a/test/Rust/src/multiport/MultiportToBank.lf b/test/Rust/src/multiport/MultiportToBank.lf index 1f26de1be6..cd439496fa 100644 --- a/test/Rust/src/multiport/MultiportToBank.lf +++ b/test/Rust/src/multiport/MultiportToBank.lf @@ -6,7 +6,7 @@ reactor Source { reaction(startup) -> out {= for (i, out) in out.into_iter().enumerate() { - ctx.set(out, i) + ctx.set(out, i) } =} } diff --git a/test/Rust/src/multiport/MultiportToBankHierarchy.lf b/test/Rust/src/multiport/MultiportToBankHierarchy.lf index df56ede9b7..cecef15c20 100644 --- a/test/Rust/src/multiport/MultiportToBankHierarchy.lf +++ b/test/Rust/src/multiport/MultiportToBankHierarchy.lf @@ -8,7 +8,7 @@ reactor Source { reaction(startup) -> out {= for (i, out) in out.into_iter().enumerate() { - ctx.set(out, i) + ctx.set(out, i) } =} } diff --git a/test/Rust/src/multiport/MultiportToMultiport.lf b/test/Rust/src/multiport/MultiportToMultiport.lf index c517ff597a..cab65a205a 100644 --- a/test/Rust/src/multiport/MultiportToMultiport.lf +++ b/test/Rust/src/multiport/MultiportToMultiport.lf @@ -6,7 +6,7 @@ reactor Source { reaction(startup) -> out {= for (i, out) in out.into_iter().enumerate() { - ctx.set(out, i) + ctx.set(out, i) } =} } @@ -16,7 +16,7 @@ reactor Sink { reaction(in) {= for (i, port) in r#in.iter().enumerate() { - assert_eq!(Some(i), ctx.get(port), "Failed for input in[{}]", i); + assert_eq!(Some(i), ctx.get(port), "Failed for input in[{}]", i); } println!("Success"); =} diff --git a/test/Rust/src/multiport/MultiportToMultiport2.lf b/test/Rust/src/multiport/MultiportToMultiport2.lf index 217b06b1b4..bc2808a5f0 100644 --- a/test/Rust/src/multiport/MultiportToMultiport2.lf +++ b/test/Rust/src/multiport/MultiportToMultiport2.lf @@ -6,7 +6,7 @@ reactor Source(width: usize = 2) { reaction(startup) -> out {= for (i, out) in out.iter_mut().enumerate() { - ctx.set(out, i) + ctx.set(out, i) } =} } @@ -16,17 +16,17 @@ reactor Destination(width: usize = 2) { reaction(in) {= for (i, v) in r#in.enumerate_values() { - // NOTE: For testing purposes, this assumes the specific - // widths instantiated below. - assert_eq!(v, i % 3, "Failed for input in[{}]", i); + // NOTE: For testing purposes, this assumes the specific + // widths instantiated below. + assert_eq!(v, i % 3, "Failed for input in[{}]", i); } println!("Success"); =} } main reactor MultiportToMultiport2 { - a1 = new Source(width = 3) - a2 = new Source(width = 2) - b = new Destination(width = 5) + a1 = new Source(width=3) + a2 = new Source(width=2) + b = new Destination(width=5) a1.out, a2.out -> b.in } diff --git a/test/Rust/src/multiport/ReadOutputOfContainedBank.lf b/test/Rust/src/multiport/ReadOutputOfContainedBank.lf index 3595fdba21..2d97ad74d7 100644 --- a/test/Rust/src/multiport/ReadOutputOfContainedBank.lf +++ b/test/Rust/src/multiport/ReadOutputOfContainedBank.lf @@ -15,27 +15,27 @@ main reactor { reaction(startup) c.out {= for (i, chan) in c__out.iter().enumerate() { - let result = ctx.get(chan).unwrap(); - println!("Startup reaction reading output of contained reactor: {}", result); - assert_eq!(result, 42 * i); + let result = ctx.get(chan).unwrap(); + println!("Startup reaction reading output of contained reactor: {}", result); + assert_eq!(result, 42 * i); } self.count += 1; =} reaction(c.out) {= for (i, chan) in c__out.iter().enumerate() { - let result = ctx.get(chan).unwrap(); - println!("Reading output of contained reactor: {}", result); - assert_eq!(result, 42 * i); + let result = ctx.get(chan).unwrap(); + println!("Reading output of contained reactor: {}", result); + assert_eq!(result, 42 * i); } self.count += 1; =} reaction(startup, c.out) {= for (i, chan) in c__out.iter().enumerate() { - let result = ctx.get(chan).unwrap(); - println!("Alternate triggering reading output of contained reactor: {}", result); - assert_eq!(result, 42 * i); + let result = ctx.get(chan).unwrap(); + println!("Alternate triggering reading output of contained reactor: {}", result); + assert_eq!(result, 42 * i); } self.count += 1; =} diff --git a/test/Rust/src/multiport/WidthWithParameter.lf b/test/Rust/src/multiport/WidthWithParameter.lf index 22e5b51925..572da15222 100644 --- a/test/Rust/src/multiport/WidthWithParameter.lf +++ b/test/Rust/src/multiport/WidthWithParameter.lf @@ -5,13 +5,13 @@ reactor Some(value: usize = 30) { reaction(startup) -> finished {= for p in finished { - ctx.set(p, ()); + ctx.set(p, ()); } =} } main reactor { - some = new Some(value = 20) + some = new Some(value=20) reaction(some.finished) {= println!("success"); =} } diff --git a/test/Rust/src/multiport/WriteInputOfContainedBank.lf b/test/Rust/src/multiport/WriteInputOfContainedBank.lf index 53fe188559..f44914bd5d 100644 --- a/test/Rust/src/multiport/WriteInputOfContainedBank.lf +++ b/test/Rust/src/multiport/WriteInputOfContainedBank.lf @@ -22,7 +22,7 @@ main reactor { reaction(startup) -> c.inpt {= for i in 0..c__inpt.len() { - ctx.set(&mut c__inpt[i], i * 42); + ctx.set(&mut c__inpt[i], i * 42); } =} } diff --git a/test/TypeScript/src/ActionDelay.lf b/test/TypeScript/src/ActionDelay.lf index abbd0ec3af..18949417d3 100644 --- a/test/TypeScript/src/ActionDelay.lf +++ b/test/TypeScript/src/ActionDelay.lf @@ -31,9 +31,9 @@ reactor Sink { console.log("Logical, physical, and elapsed logical: " + logical + physical + elapsed_logical); const oneHundredMsec = TimeValue.msec(100); if (!elapsed_logical.isEqualTo(oneHundredMsec)) { - util.requestErrorStop("Expected " + oneHundredMsec + " but got " + elapsed_logical); + util.requestErrorStop("Expected " + oneHundredMsec + " but got " + elapsed_logical); } else { - console.log("SUCCESS. Elapsed logical time is " + elapsed_logical); + console.log("SUCCESS. Elapsed logical time is " + elapsed_logical); } =} } diff --git a/test/TypeScript/src/After.lf b/test/TypeScript/src/After.lf index 466f28c969..30edbdb554 100644 --- a/test/TypeScript/src/After.lf +++ b/test/TypeScript/src/After.lf @@ -21,7 +21,7 @@ reactor Print { console.log("Current logical time is: " + elapsed_time); console.log("Current physical time is: " + util.getElapsedPhysicalTime()); if (! elapsed_time.isEqualTo(expected_time)) { - util.requestErrorStop("ERROR: Expected logical time to be " + expected_time); + util.requestErrorStop("ERROR: Expected logical time to be " + expected_time); } expected_time = expected_time.add(TimeValue.sec(1)); =} diff --git a/test/TypeScript/src/ArrayAsParameter.lf b/test/TypeScript/src/ArrayAsParameter.lf index 5e6d8d7f52..ef9ba9f414 100644 --- a/test/TypeScript/src/ArrayAsParameter.lf +++ b/test/TypeScript/src/ArrayAsParameter.lf @@ -10,7 +10,7 @@ reactor Source(sequence: {= Array =} = {= [0, 1, 2] =}) { out = sequence[count]; count++; if (count < sequence.length) { - actions.next.schedule(0, null); + actions.next.schedule(0, null); } =} } @@ -22,7 +22,7 @@ reactor Print { reaction(x) {= console.log("Received: " + x + "."); if (x != count) { - util.requestErrorStop("ERROR: Expected " + count + "."); + util.requestErrorStop("ERROR: Expected " + count + "."); } count++; =} diff --git a/test/TypeScript/src/ArrayAsType.lf b/test/TypeScript/src/ArrayAsType.lf index fdeb482535..c26e3fe02e 100644 --- a/test/TypeScript/src/ArrayAsType.lf +++ b/test/TypeScript/src/ArrayAsType.lf @@ -19,24 +19,24 @@ reactor Print(scale: number = 1) { input x: {= Array =} reaction(x) {= - let count = 0; // For testing. + let count = 0; // For testing. let failed = false; // For testing. let msg = ""; x = x as Array msg += "Received: ["; for (let i = 0; i < 3; i++) { - if (i > 0) msg += ", "; - msg += (x[i]); - // For testing, check whether values match expectation. - if ((x[i]) != scale * count) { - failed = true; - } - count++; // For testing. + if (i > 0) msg += ", "; + msg += (x[i]); + // For testing, check whether values match expectation. + if ((x[i]) != scale * count) { + failed = true; + } + count++; // For testing. } msg += "]"; console.log(msg); if (failed) { - util.requestErrorStop("ERROR: Value received by Print does not match expectation!"); + util.requestErrorStop("ERROR: Value received by Print does not match expectation!"); } =} } diff --git a/test/TypeScript/src/ArrayPrint.lf b/test/TypeScript/src/ArrayPrint.lf index f072536b91..3c94b00b34 100644 --- a/test/TypeScript/src/ArrayPrint.lf +++ b/test/TypeScript/src/ArrayPrint.lf @@ -19,24 +19,24 @@ reactor Print(scale: number = 1) { input x: {= Array =} reaction(x) {= - let count = 0; // For testing. + let count = 0; // For testing. let failed = false; // For testing. let msg = ""; x = x as Array msg += "Received: ["; for (let i = 0; i < 3; i++) { - if (i > 0) msg += ", "; - msg += (x[i]); - // For testing, check whether values match expectation. - if ((x[i]) != scale * count) { - failed = true; - } - count++; // For testing. + if (i > 0) msg += ", "; + msg += (x[i]); + // For testing, check whether values match expectation. + if ((x[i]) != scale * count) { + failed = true; + } + count++; // For testing. } msg += "]"; console.log(msg); if (failed) { - util.requestErrorStop("ERROR: Value received by Print does not match expectation!"); + util.requestErrorStop("ERROR: Value received by Print does not match expectation!"); } =} } diff --git a/test/TypeScript/src/ArrayScale.lf b/test/TypeScript/src/ArrayScale.lf index 581d6d11a2..2ddfa951f3 100644 --- a/test/TypeScript/src/ArrayScale.lf +++ b/test/TypeScript/src/ArrayScale.lf @@ -12,7 +12,7 @@ reactor Scale(scale: number = 2) { reaction(x) -> out {= x = x as Array; for(let i = 0; i < x.length; i++) { - x[i] = x[i] * scale; + x[i] = x[i] * scale; } out = x; =} @@ -21,7 +21,7 @@ reactor Scale(scale: number = 2) { main reactor ArrayScale { s = new Source() c = new Scale() - p = new Print(scale = 2) + p = new Print(scale=2) s.out -> c.x c.out -> p.x } diff --git a/test/TypeScript/src/Composition.lf b/test/TypeScript/src/Composition.lf index 8a5fc8083c..cb108990c4 100644 --- a/test/TypeScript/src/Composition.lf +++ b/test/TypeScript/src/Composition.lf @@ -22,7 +22,7 @@ reactor Test { count++; console.log("Received " + x); if (x != count) { - util.requestErrorStop("FAILURE: Expected " + count); + util.requestErrorStop("FAILURE: Expected " + count); } =} } diff --git a/test/TypeScript/src/CompositionAfter.lf b/test/TypeScript/src/CompositionAfter.lf index b03b8f61f3..7166d750ea 100644 --- a/test/TypeScript/src/CompositionAfter.lf +++ b/test/TypeScript/src/CompositionAfter.lf @@ -23,7 +23,7 @@ reactor Test { count++; console.log("Received " + x); if (x != count) { - util.requestErrorStop("FAILURE: Expected " + count); + util.requestErrorStop("FAILURE: Expected " + count); } =} } diff --git a/test/TypeScript/src/CountTest.lf b/test/TypeScript/src/CountTest.lf index 4953e25567..66a12cfdd1 100644 --- a/test/TypeScript/src/CountTest.lf +++ b/test/TypeScript/src/CountTest.lf @@ -12,7 +12,7 @@ reactor Test { console.log("Received " + c); i++; if (c != i) { - util.requestErrorStop("ERROR: Expected " + i + " but got " + c); + util.requestErrorStop("ERROR: Expected " + i + " but got " + c); } =} } diff --git a/test/TypeScript/src/Deadline.lf b/test/TypeScript/src/Deadline.lf index e6a6037090..df02bceff4 100644 --- a/test/TypeScript/src/Deadline.lf +++ b/test/TypeScript/src/Deadline.lf @@ -12,12 +12,12 @@ reactor Source(period: time = 2 sec) { reaction(t) -> y {= if (2 * Math.floor(count / 2) != count){ - // The count variable is odd. - // Busy wait 0.2 seconds to cause a deadline violation. - let initialElapsedTime = util.getElapsedPhysicalTime(); - console.log("****: " + initialElapsedTime); - while (util.getElapsedPhysicalTime().isEarlierThan(initialElapsedTime.add(TimeValue.msec(400)))); - console.log("****: " + util.getElapsedPhysicalTime()); + // The count variable is odd. + // Busy wait 0.2 seconds to cause a deadline violation. + let initialElapsedTime = util.getElapsedPhysicalTime(); + console.log("****: " + initialElapsedTime); + while (util.getElapsedPhysicalTime().isEarlierThan(initialElapsedTime.add(TimeValue.msec(400)))); + console.log("****: " + util.getElapsedPhysicalTime()); } console.log("Source sends: " + count); y = count; @@ -32,15 +32,15 @@ reactor Destination(timeout: time = 1 sec) { reaction(x) {= console.log("Destination receives: " + x); if (2 * Math.floor(count / 2) != count) { - // The count variable is odd, so the deadline should have been violated. - util.requestErrorStop("ERROR: Failed to detect deadline.") + // The count variable is odd, so the deadline should have been violated. + util.requestErrorStop("ERROR: Failed to detect deadline.") } count++; =} deadline(timeout) {= console.log("Destination deadline handler receives: " + x); if (2 * Math.floor(count / 2) == count) { - // The count variable is even, so the deadline should not have been violated. - util.requestErrorStop("ERROR: Deadline miss handler invoked without deadline violation.") + // The count variable is even, so the deadline should not have been violated. + util.requestErrorStop("ERROR: Deadline miss handler invoked without deadline violation.") } count++; =} diff --git a/test/TypeScript/src/DeadlineHandledAbove.lf b/test/TypeScript/src/DeadlineHandledAbove.lf index 8d4f18976a..94ab8eb3fd 100644 --- a/test/TypeScript/src/DeadlineHandledAbove.lf +++ b/test/TypeScript/src/DeadlineHandledAbove.lf @@ -29,16 +29,16 @@ main reactor DeadlineHandledAbove { reaction(d.deadline_violation) {= if (d.deadline_violation) { - console.log("Output successfully produced by deadline miss handler."); - violation_detected = true; + console.log("Output successfully produced by deadline miss handler."); + violation_detected = true; } =} reaction(shutdown) {= if ( violation_detected) { - console.log("SUCCESS. Test passes."); + console.log("SUCCESS. Test passes."); } else { - util.requestErrorStop("FAILURE. Container did not react to deadline violation.") + util.requestErrorStop("FAILURE. Container did not react to deadline violation.") } =} } diff --git a/test/TypeScript/src/DelayInt.lf b/test/TypeScript/src/DelayInt.lf index 845b6995f5..4cf2b5a8cc 100644 --- a/test/TypeScript/src/DelayInt.lf +++ b/test/TypeScript/src/DelayInt.lf @@ -11,7 +11,7 @@ reactor Delay(delay: time = 100 msec) { reaction(a) -> out {= if (a !== null){ - out = a as number + out = a as number } =} } @@ -34,17 +34,17 @@ reactor Test { let elapsed = current_time.subtract(start_time); console.log("After " + elapsed + " of logical time."); if (!elapsed.isEqualTo(TimeValue.msec(100))) { - util.requestErrorStop("ERROR: Expected elapsed time to be [0, 100000000]. It was " + elapsed) + util.requestErrorStop("ERROR: Expected elapsed time to be [0, 100000000]. It was " + elapsed) } if (x != 42) { - util.requestErrorStop("ERROR: Expected input value to be 42. It was " + x) + util.requestErrorStop("ERROR: Expected input value to be 42. It was " + x) } =} reaction(shutdown) {= console.log("Checking that communication occurred."); if (!received_value) { - util.requestErrorStop("ERROR: No communication occurred!") + util.requestErrorStop("ERROR: No communication occurred!") } =} } diff --git a/test/TypeScript/src/DelayedAction.lf b/test/TypeScript/src/DelayedAction.lf index 72c78396bf..1979003351 100644 --- a/test/TypeScript/src/DelayedAction.lf +++ b/test/TypeScript/src/DelayedAction.lf @@ -17,7 +17,7 @@ main reactor DelayedAction { let expected = TimeValue.sec(count).add(TimeValue.msec(100)); count++; if (!elapsedLogical.isEqualTo(expected)) { - util.requestErrorStop("Failure: expected " + expected + " but got " + elapsedLogical); + util.requestErrorStop("Failure: expected " + expected + " but got " + elapsedLogical); } =} } diff --git a/test/TypeScript/src/DelayedReaction.lf b/test/TypeScript/src/DelayedReaction.lf index 1622b4069c..66a721069b 100644 --- a/test/TypeScript/src/DelayedReaction.lf +++ b/test/TypeScript/src/DelayedReaction.lf @@ -15,7 +15,7 @@ reactor Sink { let elapsed = util.getElapsedLogicalTime(); console.log("Nanoseconds since start: " + elapsed); if (! elapsed.isEqualTo(TimeValue.msec(100))) { - util.requestErrorStop("ERROR: Expected 100 msecs but got" + elapsed) + util.requestErrorStop("ERROR: Expected 100 msecs but got" + elapsed) } =} } diff --git a/test/TypeScript/src/Determinism.lf b/test/TypeScript/src/Determinism.lf index d0fc8db2a5..5b9d6de201 100644 --- a/test/TypeScript/src/Determinism.lf +++ b/test/TypeScript/src/Determinism.lf @@ -14,14 +14,14 @@ reactor Destination { reaction(x, y) {= let sum = 0; if (x !== undefined) { - sum += x; + sum += x; } if (y !== undefined) { - sum += y; + sum += y; } console.log("Received " + sum); if (sum != 2) { - util.requestErrorStop("FAILURE: Expected 2.") + util.requestErrorStop("FAILURE: Expected 2.") } =} } diff --git a/test/TypeScript/src/DoubleInvocation.lf b/test/TypeScript/src/DoubleInvocation.lf index 4f5cd1f2e4..792babadb8 100644 --- a/test/TypeScript/src/DoubleInvocation.lf +++ b/test/TypeScript/src/DoubleInvocation.lf @@ -33,10 +33,10 @@ reactor Print { reaction(position, velocity) {= if (position) { - console.log("Position: " + position); + console.log("Position: " + position); } if (position && position == previous) { - util.requestErrorStop("ERROR: Multiple firings at the same logical time!") + util.requestErrorStop("ERROR: Multiple firings at the same logical time!") } =} } diff --git a/test/TypeScript/src/DoubleReaction.lf b/test/TypeScript/src/DoubleReaction.lf index 303cdb02cc..6d0ad9b5b7 100644 --- a/test/TypeScript/src/DoubleReaction.lf +++ b/test/TypeScript/src/DoubleReaction.lf @@ -24,14 +24,14 @@ reactor Destination { reaction(x, w) {= let sum = 0; if (x) { - sum += x; + sum += x; } if (w) { - sum += w; + sum += w; } console.log("Sum of inputs is: " + sum); if (sum != s) { - util.requestErrorStop("FAILURE: Expected sum to be " + s + ", but it was " + sum) + util.requestErrorStop("FAILURE: Expected sum to be " + s + ", but it was " + sum) } s += 2; =} diff --git a/test/TypeScript/src/DoubleTrigger.lf b/test/TypeScript/src/DoubleTrigger.lf index 1934f41773..961cfdd5fc 100644 --- a/test/TypeScript/src/DoubleTrigger.lf +++ b/test/TypeScript/src/DoubleTrigger.lf @@ -12,13 +12,13 @@ main reactor DoubleTrigger { reaction(t1, t2) {= s++; if (s > 1) { - util.requestErrorStop("FAILURE: Reaction got triggered twice.") + util.requestErrorStop("FAILURE: Reaction got triggered twice.") } =} reaction(shutdown) {= if (s != 1) { - util.reportError("FAILURE: Reaction was never triggered."); + util.reportError("FAILURE: Reaction was never triggered."); } =} } diff --git a/test/TypeScript/src/FloatLiteral.lf b/test/TypeScript/src/FloatLiteral.lf index a7c57397d4..26d58974af 100644 --- a/test/TypeScript/src/FloatLiteral.lf +++ b/test/TypeScript/src/FloatLiteral.lf @@ -10,9 +10,9 @@ main reactor { reaction(startup) {= const F: number = - N * charge; if (Math.abs(F - expected) < Math.abs(minus_epsilon)) { - console.log("The Faraday constant is roughly " + F + "."); + console.log("The Faraday constant is roughly " + F + "."); } else { - util.requestErrorStop("ERROR: Expected " + expected + " but got " + F + "."); + util.requestErrorStop("ERROR: Expected " + expected + " but got " + F + "."); } =} } diff --git a/test/TypeScript/src/Gain.lf b/test/TypeScript/src/Gain.lf index 5ebcf69799..bcb17bd4eb 100644 --- a/test/TypeScript/src/Gain.lf +++ b/test/TypeScript/src/Gain.lf @@ -16,15 +16,15 @@ reactor Test { console.log("Received " + x + "."); received_value = true; if ((x as number) != 2) { - util.requestErrorStop("ERROR: Expected 2!"); + util.requestErrorStop("ERROR: Expected 2!"); } =} reaction(shutdown) {= if (!received_value){ - util.reportError("ERROR: No value received by Test reactor!"); + util.reportError("ERROR: No value received by Test reactor!"); } else { - console.log("Test passes"); + console.log("Test passes"); } =} } diff --git a/test/TypeScript/src/Hello.lf b/test/TypeScript/src/Hello.lf index 05ff305cba..f8bed2cefe 100644 --- a/test/TypeScript/src/Hello.lf +++ b/test/TypeScript/src/Hello.lf @@ -26,18 +26,18 @@ reactor Reschedule(period: time = 2 sec, message: string = "Hello TypeScript") { console.log("***** action " + count + " at time " + util.getCurrentLogicalTime()); // Check the a_has_value variable. if (a) { - util.requestErrorStop("FAILURE: Expected a to be null (not present), but it was non-null."); + util.requestErrorStop("FAILURE: Expected a to be null (not present), but it was non-null."); } let currentTime = util.getCurrentLogicalTime(); if (! currentTime.subtract(previous_time).isEqualTo(TimeValue.msec(200))) { - util.requestErrorStop("FAILURE: Expected 200ms of logical time to elapse but got " + - currentTime.subtract(previous_time)); + util.requestErrorStop("FAILURE: Expected 200ms of logical time to elapse but got " + + currentTime.subtract(previous_time)); } =} } reactor Inside(period: time = 1 sec, message: string = "Composite default message.") { - third_instance = new Reschedule(period = period, message = message) + third_instance = new Reschedule(period=period, message=message) } main reactor Hello { diff --git a/test/TypeScript/src/Hierarchy.lf b/test/TypeScript/src/Hierarchy.lf index 7a7b2d72ee..2672f90f84 100644 --- a/test/TypeScript/src/Hierarchy.lf +++ b/test/TypeScript/src/Hierarchy.lf @@ -28,7 +28,7 @@ reactor Print { x = x as number; console.log("Received: " + x); if (x != 2) { - util.requestErrorStop("Expected 2.") + util.requestErrorStop("Expected 2.") } =} } diff --git a/test/TypeScript/src/Hierarchy2.lf b/test/TypeScript/src/Hierarchy2.lf index 405c9015e8..017c507b73 100644 --- a/test/TypeScript/src/Hierarchy2.lf +++ b/test/TypeScript/src/Hierarchy2.lf @@ -42,7 +42,7 @@ reactor Print { reaction(x) {= x = x as number; if (x != expected) { - util.requestErrorStop("Expected " + expected); + util.requestErrorStop("Expected " + expected); } expected++; =} diff --git a/test/TypeScript/src/Microsteps.lf b/test/TypeScript/src/Microsteps.lf index a04b454a92..c5412a6b06 100644 --- a/test/TypeScript/src/Microsteps.lf +++ b/test/TypeScript/src/Microsteps.lf @@ -8,19 +8,19 @@ reactor Destination { let elapsed = util.getElapsedLogicalTime(); console.log("Time since start: " + elapsed); if (! elapsed.isEqualTo(TimeValue.zero())) { - util.requestErrorStop("Expected elapsed time to be 0, but it was " + elapsed); + util.requestErrorStop("Expected elapsed time to be 0, but it was " + elapsed); } let count = 0; if (x) { - console.log("x is present."); - count++; + console.log("x is present."); + count++; } if (y) { - console.log("y is present."); - count++; + console.log("y is present."); + count++; } if (count != 1) { - util.requestErrorStop("Expected exactly one input to be present but got " + count) + util.requestErrorStop("Expected exactly one input to be present but got " + count) } =} } diff --git a/test/TypeScript/src/MovingAverage.lf b/test/TypeScript/src/MovingAverage.lf index 3ec84cb1a7..f99e436ab7 100644 --- a/test/TypeScript/src/MovingAverage.lf +++ b/test/TypeScript/src/MovingAverage.lf @@ -27,7 +27,7 @@ reactor MovingAverageImpl { // Calculate the output. let sum = x; for (let i = 0; i < 3; i++) { - sum += delay_line[i]; + sum += delay_line[i]; } out = sum/4.0; @@ -37,7 +37,7 @@ reactor MovingAverageImpl { // Update the index for the next input. index++; if (index >= 3) { - index = 0; + index = 0; } =} } @@ -51,7 +51,7 @@ reactor Print { console.log("Received: " + x); let expected = [0.0, 0.25, 0.75, 1.5, 2.5, 3.5]; if (x != expected[count]) { - util.requestErrorStop("ERROR: Expected " + expected[count]) + util.requestErrorStop("ERROR: Expected " + expected[count]) } count++; =} diff --git a/test/TypeScript/src/MultipleContained.lf b/test/TypeScript/src/MultipleContained.lf index d381c2c697..a3ae63b2cf 100644 --- a/test/TypeScript/src/MultipleContained.lf +++ b/test/TypeScript/src/MultipleContained.lf @@ -12,7 +12,7 @@ reactor Contained { in1 = in1 as number; console.log("in1 received " + in1); if (in1 != 42) { - util.requestErrorStop("FAILED: Expected 42.") + util.requestErrorStop("FAILED: Expected 42.") } =} @@ -20,7 +20,7 @@ reactor Contained { in2 = in2 as number; console.log("in2 received " + in2); if (in2 != 42) { - util.requestErrorStop("FAILED: Expected 42.") + util.requestErrorStop("FAILED: Expected 42.") } =} } diff --git a/test/TypeScript/src/NativeListsAndTimes.lf b/test/TypeScript/src/NativeListsAndTimes.lf index 393d7873b9..95cf9e741d 100644 --- a/test/TypeScript/src/NativeListsAndTimes.lf +++ b/test/TypeScript/src/NativeListsAndTimes.lf @@ -2,13 +2,13 @@ target TypeScript // This test passes if it is successfully compiled into valid target code. main reactor( - x: number = 0, - y: time = 0, // Units are missing but not required - z = 1 msec, // Type is missing but not required - p: number[](1, 2, 3, 4), // List of integers - q: TimeValue[](1 msec, 2 msec, 3 msec), // list of time values - g: time[](1 msec, 2 msec) // List of time values -) { + x: number = 0, + y: time = 0, // Units are missing but not required + z = 1 msec, // Type is missing but not required + p: number[](1, 2, 3, 4), // List of integers + q: TimeValue[](1 msec, 2 msec, 3 msec), // list of time values + // List of time values + g: time[](1 msec, 2 msec)) { state s: time = y // Reference to explicitly typed time parameter state t: time = z // Reference to implicitly typed time parameter state v: boolean // Uninitialized boolean state variable diff --git a/test/TypeScript/src/PeriodicDesugared.lf b/test/TypeScript/src/PeriodicDesugared.lf index 82c86ca205..3704668a31 100644 --- a/test/TypeScript/src/PeriodicDesugared.lf +++ b/test/TypeScript/src/PeriodicDesugared.lf @@ -7,10 +7,10 @@ main reactor(offset: time = 0, period: time = 500 msec) { reaction(startup) -> init, recur {= if (offset.isZero()) { - console.log("Hello World!"); - actions.recur.schedule(0, null); + console.log("Hello World!"); + actions.recur.schedule(0, null); } else { - actions.init.schedule(0, null); + actions.init.schedule(0, null); } =} @@ -18,7 +18,7 @@ main reactor(offset: time = 0, period: time = 500 msec) { console.log("Hello World!"); actions.recur.schedule(0, null); if (count > 10) { - util.requestStop(); + util.requestStop(); } count++; =} diff --git a/test/TypeScript/src/PhysicalConnection.lf b/test/TypeScript/src/PhysicalConnection.lf index 6305801f18..495d7bc0e0 100644 --- a/test/TypeScript/src/PhysicalConnection.lf +++ b/test/TypeScript/src/PhysicalConnection.lf @@ -14,7 +14,7 @@ reactor Destination { let time = util.getElapsedLogicalTime(); console.log("Received event at logical time: " + time); if (time.isZero()) { - util.requestErrorStop("ERROR: Logical time should be greater than zero"); + util.requestErrorStop("ERROR: Logical time should be greater than zero"); } =} } diff --git a/test/TypeScript/src/Preamble.lf b/test/TypeScript/src/Preamble.lf index 51cd0a1868..967a47353b 100644 --- a/test/TypeScript/src/Preamble.lf +++ b/test/TypeScript/src/Preamble.lf @@ -5,7 +5,7 @@ target TypeScript { main reactor Preamble { preamble {= function add42( i:number) { - return i + 42; + return i + 42; } =} timer t diff --git a/test/TypeScript/src/ReadOutputOfContainedReactor.lf b/test/TypeScript/src/ReadOutputOfContainedReactor.lf index 0f4b7327f2..9009141181 100644 --- a/test/TypeScript/src/ReadOutputOfContainedReactor.lf +++ b/test/TypeScript/src/ReadOutputOfContainedReactor.lf @@ -14,7 +14,7 @@ main reactor ReadOutputOfContainedReactor { reaction(startup) c.out {= console.log("Startup reaction reading output of contained reactor: " + c.out); if (c.out != 42) { - util.requestErrorStop("FAILURE: expected 42.") + util.requestErrorStop("FAILURE: expected 42.") } count++; =} @@ -22,7 +22,7 @@ main reactor ReadOutputOfContainedReactor { reaction(c.out) {= console.log("Reading output of contained reactor: " + c.out); if (c.out != 42) { - util.requestErrorStop("FAILURE: expected 42.") + util.requestErrorStop("FAILURE: expected 42.") } count++; =} @@ -30,17 +30,17 @@ main reactor ReadOutputOfContainedReactor { reaction(startup, c.out) {= console.log("Alternate triggering reading output of contained reactor: " + c.out); if (c.out != 42) { - util.requestErrorStop("FAILURE: expected 42.") + util.requestErrorStop("FAILURE: expected 42.") } count++; =} reaction(shutdown) {= if (count != 3) { - console.log("Count is: " + count) - util.requestErrorStop("FAILURE: One of the reactions failed to trigger.") + console.log("Count is: " + count) + util.requestErrorStop("FAILURE: One of the reactions failed to trigger.") } else { - console.log("Test passes."); + console.log("Test passes."); } =} } diff --git a/test/TypeScript/src/Schedule.lf b/test/TypeScript/src/Schedule.lf index fa779cc5bd..a6b48a14fb 100644 --- a/test/TypeScript/src/Schedule.lf +++ b/test/TypeScript/src/Schedule.lf @@ -11,9 +11,9 @@ reactor ScheduleLogicalAction { let elapsedTime = util.getElapsedLogicalTime(); console.log("Action triggered at logical time " + elapsedTime + " (sec, nsec) after start."); if (!elapsedTime.isEqualTo(TimeValue.msec(200))) { - util.requestErrorStop("Expected action time to be 200 msec. It was " + elapsedTime + " (sec, nsec).") + util.requestErrorStop("Expected action time to be 200 msec. It was " + elapsedTime + " (sec, nsec).") } else { - console.log("Success! Action time was " + elapsedTime); + console.log("Success! Action time was " + elapsedTime); } =} } diff --git a/test/TypeScript/src/ScheduleLogicalAction.lf b/test/TypeScript/src/ScheduleLogicalAction.lf index 149f84df88..b165588a1b 100644 --- a/test/TypeScript/src/ScheduleLogicalAction.lf +++ b/test/TypeScript/src/ScheduleLogicalAction.lf @@ -30,7 +30,7 @@ reactor print { console.log("Current logical time is: " + elapsed_time); console.log("Current physical time is: " + util.getElapsedPhysicalTime()); if (! elapsed_time.isEqualTo(expected_time)) { - util.requestErrorStop("ERROR: Expected logical time to be " + expected_time); + util.requestErrorStop("ERROR: Expected logical time to be " + expected_time); } expected_time = expected_time.add(TimeValue.msec(500)); =} diff --git a/test/TypeScript/src/SendingInside.lf b/test/TypeScript/src/SendingInside.lf index 9f22e94cc7..16278673a3 100644 --- a/test/TypeScript/src/SendingInside.lf +++ b/test/TypeScript/src/SendingInside.lf @@ -12,7 +12,7 @@ reactor Printer { reaction(x) {= console.log("Inside reactor received: " + x); if ((x as number) != count) { - util.requestErrorStop("FAILURE: Expected " + count) + util.requestErrorStop("FAILURE: Expected " + count) } count++; =} diff --git a/test/TypeScript/src/SendingInside2.lf b/test/TypeScript/src/SendingInside2.lf index a537191e4b..0271112da6 100644 --- a/test/TypeScript/src/SendingInside2.lf +++ b/test/TypeScript/src/SendingInside2.lf @@ -6,7 +6,7 @@ reactor Printer { reaction(x) {= console.log("Inside reactor received:" + x ); if (x != 1) { - util.requestErrorStop("ERROR: Expected 1."); + util.requestErrorStop("ERROR: Expected 1."); } =} } diff --git a/test/TypeScript/src/SendsPointerTest.lf b/test/TypeScript/src/SendsPointerTest.lf index c7b4f2d4f8..2808d2a87b 100644 --- a/test/TypeScript/src/SendsPointerTest.lf +++ b/test/TypeScript/src/SendsPointerTest.lf @@ -19,7 +19,7 @@ reactor Print(expected: {= {value: number} =} = {= { value: 42 } =}) { x = x as {value: number}; console.log("Received: " + JSON.stringify(x)); if (x.value != expected.value) { - util.requestErrorStop("ERROR: Expected x.value to be " + expected.value); + util.requestErrorStop("ERROR: Expected x.value to be " + expected.value); } =} } diff --git a/test/TypeScript/src/SimpleDeadline.lf b/test/TypeScript/src/SimpleDeadline.lf index 56ffd3f64f..3d5fcab3d4 100644 --- a/test/TypeScript/src/SimpleDeadline.lf +++ b/test/TypeScript/src/SimpleDeadline.lf @@ -19,7 +19,7 @@ reactor Print { reaction(x) {= if (x) { - console.log("Output successfully produced by deadline handler."); + console.log("Output successfully produced by deadline handler."); } =} } diff --git a/test/TypeScript/src/SlowingClock.lf b/test/TypeScript/src/SlowingClock.lf index 47d41ce89f..522778f2d7 100644 --- a/test/TypeScript/src/SlowingClock.lf +++ b/test/TypeScript/src/SlowingClock.lf @@ -14,7 +14,7 @@ main reactor SlowingClock { let elapsed_logical_time : TimeValue = util.getElapsedLogicalTime(); console.log("Logical time since start: " + elapsed_logical_time); if (!elapsed_logical_time.isEqualTo(expected_time)) { - util.requestErrorStop("ERROR: Expected time to be: " + expected_time) + util.requestErrorStop("ERROR: Expected time to be: " + expected_time) } actions.a.schedule(interval, null); expected_time = expected_time.add(TimeValue.msec(100)) @@ -24,7 +24,7 @@ main reactor SlowingClock { reaction(shutdown) {= if (!expected_time.isEqualTo(TimeValue.msec(5500))) { - util.requestErrorStop("ERROR: Expected the next expected time to be: " + TimeValue.msec(5500) + "It was: " + expected_time) + util.requestErrorStop("ERROR: Expected the next expected time to be: " + TimeValue.msec(5500) + "It was: " + expected_time) } =} } diff --git a/test/TypeScript/src/SlowingClockPhysical.lf b/test/TypeScript/src/SlowingClockPhysical.lf index e51d34601a..bbf120e8f4 100644 --- a/test/TypeScript/src/SlowingClockPhysical.lf +++ b/test/TypeScript/src/SlowingClockPhysical.lf @@ -24,7 +24,7 @@ main reactor SlowingClockPhysical { let elapsed_logical_time = util.getElapsedLogicalTime(); console.log("Logical time since start: " + elapsed_logical_time); if (elapsed_logical_time.isEarlierThan(expected_time)) { - util.requestErrorStop("ERROR: Expected logical time to be: " + expected_time) + util.requestErrorStop("ERROR: Expected logical time to be: " + expected_time) } interval = interval.add(TimeValue.msec(100)); expected_time = (TimeValue.msec(100)).add(interval); @@ -33,7 +33,7 @@ main reactor SlowingClockPhysical { reaction(shutdown) {= if (expected_time.isEarlierThan(TimeValue.msec(500))) { - util.requestErrorStop("ERROR: Expected the next expected time to be at least: 500 msec. It was: " + expected_time) + util.requestErrorStop("ERROR: Expected the next expected time to be at least: 500 msec. It was: " + expected_time) } =} } diff --git a/test/TypeScript/src/Stop.lf b/test/TypeScript/src/Stop.lf index f23ee09c09..dcc727203a 100644 --- a/test/TypeScript/src/Stop.lf +++ b/test/TypeScript/src/Stop.lf @@ -18,15 +18,15 @@ reactor Consumer { const currentTag = util.getCurrentTag(); const compareTag = util.getStartTag().getLaterTag(TimeValue.msec(10)); if (compareTag.getMicroStepsLater(9).isSmallerThan(currentTag)) { - // The reaction should not have been called at tags larger than (10 msec, 9) - util.requestErrorStop(`ERROR: Invoked reaction(in) at tag bigger than shutdown.`); + // The reaction should not have been called at tags larger than (10 msec, 9) + util.requestErrorStop(`ERROR: Invoked reaction(in) at tag bigger than shutdown.`); } else if (currentTag.isSimultaneousWith(compareTag.getMicroStepsLater(8))) { - // Call util.requestStop() at relative tag (10 msec, 8) - console.log(`Requesting stop.`); - util.requestStop(); + // Call util.requestStop() at relative tag (10 msec, 8) + console.log(`Requesting stop.`); + util.requestStop(); } else if (currentTag.isSimultaneousWith(compareTag.getMicroStepsLater(9))) { - // Check that this reaction is indeed also triggered at (10 msec, 9) - reactionInvokedCorrectly = true; + // Check that this reaction is indeed also triggered at (10 msec, 9) + reactionInvokedCorrectly = true; } =} @@ -35,18 +35,18 @@ reactor Consumer { const compareTag = util.getStartTag().getLaterTag(TimeValue.msec(10)); // Check to see if shutdown is called at relative tag (10 msec, 9) if (currentTag.isSimultaneousWith(compareTag.getMicroStepsLater(9)) && - reactionInvokedCorrectly === true) { - console.log(`SUCCESS: successfully enforced stop.`); + reactionInvokedCorrectly === true) { + console.log(`SUCCESS: successfully enforced stop.`); } else if(!currentTag.isSmallerThan(compareTag.getMicroStepsLater(9)) && - !currentTag.isSimultaneousWith(compareTag.getMicroStepsLater(9))) { - util.requestErrorStop(`ERROR: Shutdown invoked at tag ` - + `(${currentTag.time.subtract(util.getStartTime())}, ` - + `${currentTag.microstep}). Failed to enforce timeout.`); + !currentTag.isSimultaneousWith(compareTag.getMicroStepsLater(9))) { + util.requestErrorStop(`ERROR: Shutdown invoked at tag ` + + `(${currentTag.time.subtract(util.getStartTime())}, ` + + `${currentTag.microstep}). Failed to enforce timeout.`); } else if (reactionInvokedCorrectly === false) { - // Check to see if reactions were called correctly - util.requestErrorStop(`ERROR: Failed to invoke reaction(in) at tag ` - + `(${currentTag.time.subtract(util.getStartTime())}, ` - + `${currentTag.microstep}). Failed to enforce timeout.`); + // Check to see if reactions were called correctly + util.requestErrorStop(`ERROR: Failed to invoke reaction(in) at tag ` + + `(${currentTag.time.subtract(util.getStartTime())}, ` + + `${currentTag.microstep}). Failed to enforce timeout.`); } =} } diff --git a/test/TypeScript/src/Stride.lf b/test/TypeScript/src/Stride.lf index e13252a60a..a8413a6aee 100644 --- a/test/TypeScript/src/Stride.lf +++ b/test/TypeScript/src/Stride.lf @@ -23,7 +23,7 @@ reactor Display { } main reactor Stride { - c = new Count(stride = 2) + c = new Count(stride=2) d = new Display() c.y -> d.x } diff --git a/test/TypeScript/src/StructAsState.lf b/test/TypeScript/src/StructAsState.lf index df15d1abc0..fdac670b9a 100644 --- a/test/TypeScript/src/StructAsState.lf +++ b/test/TypeScript/src/StructAsState.lf @@ -4,8 +4,8 @@ target TypeScript main reactor StructAsState { preamble {= type hello_t = { - name: string ; - value: number; + name: string ; + value: number; } =} state s: hello_t = {= {name: "Earth", value: 42} =} @@ -13,7 +13,7 @@ main reactor StructAsState { reaction(startup) {= console.log("State s.name=" + s.name + ", s.value=" + s.value); if (s.value != 42) { - util.requestErrorStop("FAILED: Expected 42."); + util.requestErrorStop("FAILED: Expected 42."); } =} } diff --git a/test/TypeScript/src/StructAsType.lf b/test/TypeScript/src/StructAsType.lf index bef058e295..56a6a40c9f 100644 --- a/test/TypeScript/src/StructAsType.lf +++ b/test/TypeScript/src/StructAsType.lf @@ -4,8 +4,8 @@ target TypeScript reactor Source { preamble {= type hello_t = { - name: string ; - value: number; + name: string ; + value: number; } =} output out: hello_t @@ -26,7 +26,7 @@ reactor Print(expected: number = 42) { x = x as hello_t; console.log("Received: name = " + x.name + ", value = " + x.value); if (x.value != expected) { - util.requestErrorStop("ERROR: Expected value to be " + expected) + util.requestErrorStop("ERROR: Expected value to be " + expected) } =} } diff --git a/test/TypeScript/src/StructAsTypeDirect.lf b/test/TypeScript/src/StructAsTypeDirect.lf index a2e6425172..0664444cd9 100644 --- a/test/TypeScript/src/StructAsTypeDirect.lf +++ b/test/TypeScript/src/StructAsTypeDirect.lf @@ -4,8 +4,8 @@ target TypeScript reactor Source { preamble {= type hello_t = { - name: string ; - value: number; + name: string ; + value: number; } =} output out: hello_t @@ -26,7 +26,7 @@ reactor Print(expected: number = 42) { x = x as hello_t; console.log("Received: name = " + x.name + ", value = " + x.value); if (x.value != expected) { - util.requestErrorStop("ERROR: Expected value to be " + expected) + util.requestErrorStop("ERROR: Expected value to be " + expected) } =} } diff --git a/test/TypeScript/src/StructPrint.lf b/test/TypeScript/src/StructPrint.lf index 9268100161..397e34a9a0 100644 --- a/test/TypeScript/src/StructPrint.lf +++ b/test/TypeScript/src/StructPrint.lf @@ -5,8 +5,8 @@ target TypeScript reactor Source { preamble {= type hello_t = { - name: string ; - value: number; + name: string ; + value: number; } =} output out: hello_t @@ -25,7 +25,7 @@ reactor Print(expected: number = 42) { x = x as hello_t; console.log("Received: name = " + x.name + ", value = " + x.value); if (x.value != expected) { - util.requestErrorStop("ERROR: Expected value to be " + expected) + util.requestErrorStop("ERROR: Expected value to be " + expected) } =} } diff --git a/test/TypeScript/src/StructScale.lf b/test/TypeScript/src/StructScale.lf index 39e74e42c4..4dc706f42b 100644 --- a/test/TypeScript/src/StructScale.lf +++ b/test/TypeScript/src/StructScale.lf @@ -20,7 +20,7 @@ reactor Scale(scale: number = 2) { main reactor StructScale { s = new Source() c = new Scale() - p = new Print(expected = 84) + p = new Print(expected=84) s.out -> c.x c.out -> p.x } diff --git a/test/TypeScript/src/TestForPreviousOutput.lf b/test/TypeScript/src/TestForPreviousOutput.lf index c088ac1d6d..1ce4057b42 100644 --- a/test/TypeScript/src/TestForPreviousOutput.lf +++ b/test/TypeScript/src/TestForPreviousOutput.lf @@ -9,16 +9,16 @@ reactor Source { // Note: Math.random can't be seeded // Randomly produce an output or not. if (Math.random() > 0.5) { - out = 21; + out = 21; } =} reaction(startup) -> out {= let previous_output = out; if (previous_output) { - out = 2 * previous_output; + out = 2 * previous_output; } else { - out = 42; + out = 42; } =} } @@ -30,7 +30,7 @@ reactor Sink { x = x as number; console.log("Received " + x); if (x != 42) { - util.requestErrorStop("FAILED: Expected 42.") + util.requestErrorStop("FAILED: Expected 42.") } =} } diff --git a/test/TypeScript/src/TimeLimit.lf b/test/TypeScript/src/TimeLimit.lf index c0b818c2e9..42ec3391ae 100644 --- a/test/TypeScript/src/TimeLimit.lf +++ b/test/TypeScript/src/TimeLimit.lf @@ -23,7 +23,7 @@ reactor Destination { reaction(x) {= if (x != s) { - util.requestErrorStop("Error: Expected " + s + " and got " + x + ".") + util.requestErrorStop("Error: Expected " + s + " and got " + x + ".") } s++; =} @@ -33,7 +33,7 @@ reactor Destination { main reactor TimeLimit(period: time = 1 msec) { timer stop(10 sec) - c = new Clock(period = period) + c = new Clock(period=period) d = new Destination() c.y -> d.x diff --git a/test/TypeScript/src/Wcet.lf b/test/TypeScript/src/Wcet.lf index a68e54c877..b715dfd9a4 100644 --- a/test/TypeScript/src/Wcet.lf +++ b/test/TypeScript/src/Wcet.lf @@ -20,9 +20,9 @@ reactor Work { reaction(in1, in2) -> out {= let ret:number; if ((in1 as number) > 10) { - ret = (in2 as number) * (in1 as number); + ret = (in2 as number) * (in1 as number); } else { - ret = (in2 as number) + (in1 as number); + ret = (in2 as number) + (in1 as number); } out = ret; =} diff --git a/test/TypeScript/src/concurrent/AsyncCallback.lf b/test/TypeScript/src/concurrent/AsyncCallback.lf index 82ed9e1872..841bebb31a 100644 --- a/test/TypeScript/src/concurrent/AsyncCallback.lf +++ b/test/TypeScript/src/concurrent/AsyncCallback.lf @@ -7,13 +7,13 @@ target TypeScript { main reactor AsyncCallback { preamble {= function callback(a : Sched) { - // Schedule twice. If the action is not physical, these should - // get consolidated into a single action triggering. If it is, - // then they cause two separate triggerings with close but not - // equal time stamps. The minimum time between these is determined - // by the argument in the physical action definition. - a.schedule(0, null); - a.schedule(0, null); + // Schedule twice. If the action is not physical, these should + // get consolidated into a single action triggering. If it is, + // then they cause two separate triggerings with close but not + // equal time stamps. The minimum time between these is determined + // by the argument in the physical action definition. + a.schedule(0, null); + a.schedule(0, null); } =} timer t(0, 200 msec) @@ -31,16 +31,16 @@ main reactor AsyncCallback { reaction(a) {= let elapsed_time = util.getElapsedLogicalTime(); console.log("Asynchronous callback " + i - + ": Assigned logical time greater than start time by " + elapsed_time + " nsec." + + ": Assigned logical time greater than start time by " + elapsed_time + " nsec." ); if (elapsed_time.isEarlierThan(expected_time)) { - util.requestErrorStop("ERROR: Expected logical time to be larger than " + expected_time + ".") + util.requestErrorStop("ERROR: Expected logical time to be larger than " + expected_time + ".") } if (toggle) { - toggle = false; - expected_time.add(TimeValue.msec(200)); + toggle = false; + expected_time.add(TimeValue.msec(200)); } else { - toggle = true; + toggle = true; } =} } diff --git a/test/TypeScript/src/federated/ChainWithDelay.lf b/test/TypeScript/src/federated/ChainWithDelay.lf index 7c37d47d7f..d9baab73f5 100644 --- a/test/TypeScript/src/federated/ChainWithDelay.lf +++ b/test/TypeScript/src/federated/ChainWithDelay.lf @@ -15,7 +15,7 @@ import TestCount from "../lib/TestCount.lf" federated reactor { c = new Count(period = 1 msec) i = new InternalDelay(delay = 500 usec) - t = new TestCount(numInputs = 3) + t = new TestCount(numInputs=3) c.out -> i.inp i.out -> t.inp } diff --git a/test/TypeScript/src/federated/DistributedCount.lf b/test/TypeScript/src/federated/DistributedCount.lf index 4a17a25a41..49ccfafc09 100644 --- a/test/TypeScript/src/federated/DistributedCount.lf +++ b/test/TypeScript/src/federated/DistributedCount.lf @@ -19,17 +19,17 @@ reactor Print { const elapsedTime = util.getElapsedLogicalTime(); console.log("At time " + elapsedTime + ", received " + inp); if (inp !== c) { - util.requestErrorStop("Expected to receive " + c + "."); + util.requestErrorStop("Expected to receive " + c + "."); } if (!elapsedTime.isEqualTo(TimeValue.msec(200).add(TimeValue.sec(c - 1)))) { - util.requestErrorStop("Expected received time to be " + TimeValue.msec(200).add(TimeValue.sec(c - 1)) + "."); + util.requestErrorStop("Expected received time to be " + TimeValue.msec(200).add(TimeValue.sec(c - 1)) + "."); } c++; =} reaction(shutdown) {= if (c != 6) { - util.reportError("Expected to receive 5 items."); + util.reportError("Expected to receive 5 items."); } =} } diff --git a/test/TypeScript/src/federated/DistributedCountPhysical.lf b/test/TypeScript/src/federated/DistributedCountPhysical.lf index 3b2ccbb022..596c5a6694 100644 --- a/test/TypeScript/src/federated/DistributedCountPhysical.lf +++ b/test/TypeScript/src/federated/DistributedCountPhysical.lf @@ -32,10 +32,10 @@ reactor Print { let elapsedTime = util.getElapsedLogicalTime(); console.log(`At time ${elapsedTime}, received ${inp}.`); if (inp !== c) { - util.requestErrorStop(`ERROR: Expected to receive ${c}.`); + util.requestErrorStop(`ERROR: Expected to receive ${c}.`); } if (!(elapsedTime.isLaterThan(compareTime))) { - util.requestErrorStop(`ERROR: Expected time to be strictly greater than ${compareTime}. Got ${elapsedTime}.`); + util.requestErrorStop(`ERROR: Expected time to be strictly greater than ${compareTime}. Got ${elapsedTime}.`); } compareTime = compareTime.add(TimeValue.sec(1)); c++; @@ -43,7 +43,7 @@ reactor Print { reaction(shutdown) {= if (c !== 1) { - util.requestErrorStop(`ERROR: Expected to receive 1 item. Received ${c}.`); + util.requestErrorStop(`ERROR: Expected to receive 1 item. Received ${c}.`); } console.log("SUCCESS: Successfully received 1 item."); =} diff --git a/test/TypeScript/src/federated/DistributedDoublePort.lf b/test/TypeScript/src/federated/DistributedDoublePort.lf index 4a73da654c..a6bde59ed5 100644 --- a/test/TypeScript/src/federated/DistributedDoublePort.lf +++ b/test/TypeScript/src/federated/DistributedDoublePort.lf @@ -33,9 +33,9 @@ reactor Print { reaction(inp, inp2) {= const elapsedTime = util.getElapsedLogicalTime(); console.log("At tag " + elapsedTime + ", microstep:" + util.getCurrentTag().microstep + - ", received inp = " + inp + " and inp2 = " + inp2 + "."); + ", received inp = " + inp + " and inp2 = " + inp2 + "."); if (inp !== undefined && inp2 !== undefined) { - util.requestErrorStop("ERROR: invalid logical simultaneity."); + util.requestErrorStop("ERROR: invalid logical simultaneity."); } =} diff --git a/test/TypeScript/src/federated/DistributedLoopedAction.lf b/test/TypeScript/src/federated/DistributedLoopedAction.lf index ad3de56c12..7a0a8b3513 100644 --- a/test/TypeScript/src/federated/DistributedLoopedAction.lf +++ b/test/TypeScript/src/federated/DistributedLoopedAction.lf @@ -22,16 +22,16 @@ reactor Receiver(takeBreakAfter: number = 10, breakInterval: time = 400 msec) { console.log("At tag (" + util.getElapsedLogicalTime() + ", " + util.getCurrentTag().microstep + ") received value " + inp); totalReceivedMessages++; if (inp != receivedMessages++) { - util.reportError("ERROR: received messages out of order."); + util.reportError("ERROR: received messages out of order."); } if (!util.getElapsedLogicalTime().isEqualTo(breakInterval.multiply(breaks))) { - util.reportError("ERROR: received messages at an incorrect time: " + util.getElapsedLogicalTime()); + util.reportError("ERROR: received messages at an incorrect time: " + util.getElapsedLogicalTime()); } if (receivedMessages == takeBreakAfter) { - // Sender is taking a break. - breaks++; - receivedMessages = 0; + // Sender is taking a break. + breaks++; + receivedMessages = 0; } =} @@ -41,11 +41,11 @@ reactor Receiver(takeBreakAfter: number = 10, breakInterval: time = 400 msec) { reaction(shutdown) {= if (breaks != 3 || - (totalReceivedMessages != (Math.floor(1000 / breakInterval.toMilliseconds())+1) * takeBreakAfter) + (totalReceivedMessages != (Math.floor(1000 / breakInterval.toMilliseconds())+1) * takeBreakAfter) ) { - util.requestErrorStop("ERROR: test failed. totalReceivedMessages: " + totalReceivedMessages + " and : " + ((1000 /breakInterval.toMilliseconds())+1) * takeBreakAfter); + util.requestErrorStop("ERROR: test failed. totalReceivedMessages: " + totalReceivedMessages + " and : " + ((1000 /breakInterval.toMilliseconds())+1) * takeBreakAfter); } else { - console.log("SUCCESS: Successfully received all messages from the sender."); + console.log("SUCCESS: Successfully received all messages from the sender."); } =} } diff --git a/test/TypeScript/src/federated/DistributedLoopedPhysicalAction.lf b/test/TypeScript/src/federated/DistributedLoopedPhysicalAction.lf index a5d63dc937..fec7fc0145 100644 --- a/test/TypeScript/src/federated/DistributedLoopedPhysicalAction.lf +++ b/test/TypeScript/src/federated/DistributedLoopedPhysicalAction.lf @@ -19,11 +19,11 @@ reactor Sender(takeBreakAfter: number = 10, breakInterval: time = 550 msec) { out = sentMessages; sentMessages++; if (sentMessages < takeBreakAfter) { - actions.act.schedule(0, null); + actions.act.schedule(0, null); } else { - // Take a break - sentMessages = 0; - actions.act.schedule(breakInterval, null); + // Take a break + sentMessages = 0; + actions.act.schedule(breakInterval, null); } =} } @@ -40,13 +40,13 @@ reactor Receiver(takeBreakAfter: number = 10, breakInterval: time = 550 msec) { console.log("At tag (" + util.getElapsedLogicalTime() + ", " + util.getCurrentTag().microstep + ") received value " + inp); totalReceivedMessages++; if (inp != receivedMessages++) { - util.reportError("Expected " + (receivedMessages - 1) + "."); + util.reportError("Expected " + (receivedMessages - 1) + "."); } if (receivedMessages == takeBreakAfter) { - // Sender is taking a break; - breaks++; - receivedMessages = 0; + // Sender is taking a break; + breaks++; + receivedMessages = 0; } =} @@ -56,11 +56,11 @@ reactor Receiver(takeBreakAfter: number = 10, breakInterval: time = 550 msec) { reaction(shutdown) {= if (breaks != 2 || - (totalReceivedMessages != (Math.floor(1000 / breakInterval.toMilliseconds())+1) * takeBreakAfter) + (totalReceivedMessages != (Math.floor(1000 / breakInterval.toMilliseconds())+1) * takeBreakAfter) ) { - util.requestErrorStop("Test failed. Breaks: " + breaks + ", Messages: " + totalReceivedMessages + "."); + util.requestErrorStop("Test failed. Breaks: " + breaks + ", Messages: " + totalReceivedMessages + "."); } else { - console.log("SUCCESS: Successfully received all messages from the sender."); + console.log("SUCCESS: Successfully received all messages from the sender."); } =} } diff --git a/test/TypeScript/src/federated/DistributedStop.lf b/test/TypeScript/src/federated/DistributedStop.lf index 0d8b9f40ba..116111b7dd 100644 --- a/test/TypeScript/src/federated/DistributedStop.lf +++ b/test/TypeScript/src/federated/DistributedStop.lf @@ -14,51 +14,51 @@ reactor Sender { reaction(t, act) -> out, act {= console.log(`Sending 42 at (${util.getElapsedLogicalTime()}, ` - + `${util.getCurrentTag().microstep}).`); + + `${util.getCurrentTag().microstep}).`); out = 42; if (util.getCurrentTag().microstep === 0) { - // Instead of having a separate reaction - // for 'act' like Stop.lf, we trigger the - // same reaction to test util.requestStop() being - // called multiple times - actions.act.schedule(0, null); + // Instead of having a separate reaction + // for 'act' like Stop.lf, we trigger the + // same reaction to test util.requestStop() being + // called multiple times + actions.act.schedule(0, null); } if (util.getElapsedLogicalTime().isEqualTo(TimeValue.usec(1))) { - // Call util.requestStop() both at (1 usec, 0) and - // (1 usec, 1) - console.log(`Requesting stop at (${util.getElapsedLogicalTime()}, ` - + `${util.getCurrentTag().microstep}).`); - util.requestStop(); + // Call util.requestStop() both at (1 usec, 0) and + // (1 usec, 1) + console.log(`Requesting stop at (${util.getElapsedLogicalTime()}, ` + + `${util.getCurrentTag().microstep}).`); + util.requestStop(); } const oneUsec1 = util.getStartTag().getLaterTag(TimeValue.usec(1)).getMicroStepsLater(1); if (oneUsec1.isSimultaneousWith(util.getCurrentTag())) { - // The reaction was invoked at (1 usec, 1) as expected - reaction_invoked_correctly = true; + // The reaction was invoked at (1 usec, 1) as expected + reaction_invoked_correctly = true; } else if (oneUsec1.isSmallerThan(util.getCurrentTag())) { - // The reaction should not have been invoked at tags larger than (1 usec, 1) - util.requestErrorStop("ERROR: Invoked reaction(t, act) at tag bigger than shutdown."); + // The reaction should not have been invoked at tags larger than (1 usec, 1) + util.requestErrorStop("ERROR: Invoked reaction(t, act) at tag bigger than shutdown."); } =} reaction(shutdown) {= if (!util.getElapsedLogicalTime().isEqualTo(TimeValue.usec(1)) || - util.getCurrentTag().microstep !== 1) { - util.requestErrorStop(`ERROR: Sender failed to stop the federation in time.` - + `Stopping at (${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); + util.getCurrentTag().microstep !== 1) { + util.requestErrorStop(`ERROR: Sender failed to stop the federation in time.` + + `Stopping at (${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); } else if (reaction_invoked_correctly === false) { - util.requestErrorStop("ERROR: Sender reaction(t, act) was not invoked at (1usec, 1)." - + `Stopping at (${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep})`); + util.requestErrorStop("ERROR: Sender reaction(t, act) was not invoked at (1usec, 1)." + + `Stopping at (${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep})`); } else { - console.log(`SUCCESS: Successfully stopped the federation at ` - + `(${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); + console.log(`SUCCESS: Successfully stopped the federation at ` + + `(${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); } =} } reactor Receiver( - stp_offset: time = 10 msec // Used in the decentralized variant of the test -) { + // Used in the decentralized variant of the test + stp_offset: time = 10 msec) { input in1: number state reaction_invoked_correctly: boolean = false @@ -66,17 +66,17 @@ reactor Receiver( console.log(`Received ${in1} at (${util.getElapsedLogicalTime()}, ` + `${util.getCurrentTag().microstep}`); if (util.getElapsedLogicalTime().isEqualTo(TimeValue.usec(1))) { - console.log(`Requesting stop at (${util.getElapsedLogicalTime()}, ` - + `${util.getCurrentTag().microstep}`); - util.requestStop(); - // The receiver should receive a message at tag - // (1 usec, 1) and trigger this reaction - reaction_invoked_correctly = true; + console.log(`Requesting stop at (${util.getElapsedLogicalTime()}, ` + + `${util.getCurrentTag().microstep}`); + util.requestStop(); + // The receiver should receive a message at tag + // (1 usec, 1) and trigger this reaction + reaction_invoked_correctly = true; } const oneUsec1 = util.getStartTag().getLaterTag(TimeValue.usec(1)).getMicroStepsLater(1); if (oneUsec1.isSmallerThan(util.getCurrentTag())) { - reaction_invoked_correctly = false; + reaction_invoked_correctly = false; } =} @@ -85,15 +85,15 @@ reactor Receiver( // Therefore, the shutdown events must occur at (1 usec, 0) on the // receiver. if (!util.getElapsedLogicalTime().isEqualTo(TimeValue.usec(1)) || - util.getCurrentTag().microstep !== 1) { - util.requestErrorStop(`ERROR: Receiver failed to stop the federation at the right time. ` - + `Stopping at (${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); + util.getCurrentTag().microstep !== 1) { + util.requestErrorStop(`ERROR: Receiver failed to stop the federation at the right time. ` + + `Stopping at (${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); } else if (reaction_invoked_correctly === false) { - util.requestErrorStop("Receiver reaction(in) was not invoked the correct number of times. " - + `Stopping at (${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep})`); + util.requestErrorStop("Receiver reaction(in) was not invoked the correct number of times. " + + `Stopping at (${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep})`); } console.log(`SUCCESS: Successfully stopped the federation at ` - + `(${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); + + `(${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); =} } diff --git a/test/TypeScript/src/federated/DistributedStopZero.lf b/test/TypeScript/src/federated/DistributedStopZero.lf index 846b98343c..f07fe91756 100644 --- a/test/TypeScript/src/federated/DistributedStopZero.lf +++ b/test/TypeScript/src/federated/DistributedStopZero.lf @@ -13,26 +13,26 @@ reactor Sender { reaction(t) -> out {= console.log(`Sending 42 at ${util.getElapsedLogicalTime()}, ` - + `${util.getCurrentTag().microstep}).`); + + `${util.getCurrentTag().microstep}).`); out = 42; let zero = util.getStartTag(); if (util.getCurrentTag().isSimultaneousWith(zero)) { - // Request stop at ((0 secs, 0 nsecs), 0) - console.log(`Requesting stop at ${util.getElapsedLogicalTime()}, ` - + `${util.getCurrentTag().microstep}).`); - util.requestStop(); + // Request stop at ((0 secs, 0 nsecs), 0) + console.log(`Requesting stop at ${util.getElapsedLogicalTime()}, ` + + `${util.getCurrentTag().microstep}).`); + util.requestStop(); } =} reaction(shutdown) {= if (!util.getElapsedLogicalTime().isEqualTo(TimeValue.usec(0))|| - util.getCurrentTag().microstep !== 1) { - util.requestErrorStop(`ERROR: Sender failed to stop the federation in time. ` - + `Stopping at (${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); + util.getCurrentTag().microstep !== 1) { + util.requestErrorStop(`ERROR: Sender failed to stop the federation in time. ` + + `Stopping at (${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); } console.log(`SUCCESS: Successfully stopped the federation at ` - + `(${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); + + `(${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); =} } @@ -41,13 +41,13 @@ reactor Receiver { reaction(in1) {= console.log(`Received ${in1} at (${util.getElapsedLogicalTime()}, ` - + `${util.getCurrentTag().microstep}).`); + + `${util.getCurrentTag().microstep}).`); let zero = util.getStartTag(); if (util.getCurrentTag().isSimultaneousWith(zero)) { - // Request stop at ((0 secs, 0 nsecs), 0) - console.log(`Requesting stop at ${util.getElapsedLogicalTime()}, ` - + `${util.getCurrentTag().microstep}).`); - util.requestStop(); + // Request stop at ((0 secs, 0 nsecs), 0) + console.log(`Requesting stop at ${util.getElapsedLogicalTime()}, ` + + `${util.getCurrentTag().microstep}).`); + util.requestStop(); } =} @@ -56,12 +56,12 @@ reactor Receiver { // Therefore, the shutdown events must occur at ((0 secs, 0 nsecs), 0) on the // receiver. if (!util.getElapsedLogicalTime().isEqualTo(TimeValue.usec(0)) || - util.getCurrentTag().microstep !== 1) { - util.requestErrorStop(`ERROR: Receiver failed to stop the federation at the right time. ` - + `Stopping at (${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); + util.getCurrentTag().microstep !== 1) { + util.requestErrorStop(`ERROR: Receiver failed to stop the federation at the right time. ` + + `Stopping at (${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); } console.log(`SUCCESS: Successfully stopped the federation at ` - + `(${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); + + `(${util.getElapsedLogicalTime()}, ${util.getCurrentTag().microstep}).`); =} } diff --git a/test/TypeScript/src/federated/HelloDistributed.lf b/test/TypeScript/src/federated/HelloDistributed.lf index b9025ed25b..4936cfae42 100644 --- a/test/TypeScript/src/federated/HelloDistributed.lf +++ b/test/TypeScript/src/federated/HelloDistributed.lf @@ -26,7 +26,7 @@ reactor Destination { reaction(inp) {= console.log(`At logical time ${util.getElapsedLogicalTime()}, destination received: ` + inp); if (inp !== "Hello World!") { - util.requestErrorStop("ERROR: Expected to receive 'Hello World!'"); + util.requestErrorStop("ERROR: Expected to receive 'Hello World!'"); } received = true; =} @@ -34,7 +34,7 @@ reactor Destination { reaction(shutdown) {= console.log("Shutdown invoked."); if (!received) { - util.reportError("Destination did not receive the message."); + util.reportError("Destination did not receive the message."); } =} } diff --git a/test/TypeScript/src/federated/TopLevelArtifacts.lf b/test/TypeScript/src/federated/TopLevelArtifacts.lf index 02864511c0..b7d59ae4b4 100644 --- a/test/TypeScript/src/federated/TopLevelArtifacts.lf +++ b/test/TypeScript/src/federated/TopLevelArtifacts.lf @@ -34,7 +34,7 @@ federated reactor { reaction(shutdown) {= if (successes != 3) { - util.requestErrorStop(`Failed to properly execute top-level reactions`); + util.requestErrorStop(`Failed to properly execute top-level reactions`); } console.log(`SUCCESS!`); =} diff --git a/test/TypeScript/src/federated/failing/DistributedCountPhysicalAfterDelay.lf b/test/TypeScript/src/federated/failing/DistributedCountPhysicalAfterDelay.lf index 035050f348..0ea0befda7 100644 --- a/test/TypeScript/src/federated/failing/DistributedCountPhysicalAfterDelay.lf +++ b/test/TypeScript/src/federated/failing/DistributedCountPhysicalAfterDelay.lf @@ -19,25 +19,25 @@ reactor Print { state c: number = 1 reaction(inp) {= - const elapsedTime = util.getElapsedLogicalTime(); - console.log(`At time ${elapsedTime}, received ${inp}`); - if (inp !== c) { - util.requestErrorStop(`ERROR: Expected to receive ${c}.`); - } - if (!elapsedTime.isLaterThan(TimeValue.msec(600))) { - util.requestErrorStop(`ERROR: Expected received time to be strictly greater than ${TimeValue.msec(600)}`); - } - c++; - console.log(`c = ${c}`); - util.requestStop(); + const elapsedTime = util.getElapsedLogicalTime(); + console.log(`At time ${elapsedTime}, received ${inp}`); + if (inp !== c) { + util.requestErrorStop(`ERROR: Expected to receive ${c}.`); + } + if (!elapsedTime.isLaterThan(TimeValue.msec(600))) { + util.requestErrorStop(`ERROR: Expected received time to be strictly greater than ${TimeValue.msec(600)}`); + } + c++; + console.log(`c = ${c}`); + util.requestStop(); =} reaction(shutdown) {= - if (c !== 2) { - util.requestErrorStop(`ERROR: Expected to receive 1 item. Received ${c - 1}.`); - } else { - console.log("SUCCESS: Successfully received 1 item."); - } + if (c !== 2) { + util.requestErrorStop(`ERROR: Expected to receive 1 item. Received ${c - 1}.`); + } else { + console.log("SUCCESS: Successfully received 1 item."); + } =} } diff --git a/test/TypeScript/src/federated/failing/LoopDistributedCentralized.lf b/test/TypeScript/src/federated/failing/LoopDistributedCentralized.lf index 74f903669f..aebc87d619 100644 --- a/test/TypeScript/src/federated/failing/LoopDistributedCentralized.lf +++ b/test/TypeScript/src/federated/failing/LoopDistributedCentralized.lf @@ -15,44 +15,44 @@ reactor Looper(incr: number = 1, delay: time = 0 msec) { state count: number = 0 preamble {= - let stop = false; - // Function to trigger an action once every second. - function ping(act: any) { - if (!stop) { - console.log("Scheduling action."); - act.schedule(0, null); - setTimeout(ping, 1000, act); - } + let stop = false; + // Function to trigger an action once every second. + function ping(act: any) { + if (!stop) { + console.log("Scheduling action."); + act.schedule(0, null); + setTimeout(ping, 1000, act); } + } =} reaction(startup) -> a {= - // Start the ping function for triggering an action every second. - console.log("Starting ping function."); - ping(actions.a); + // Start the ping function for triggering an action every second. + console.log("Starting ping function."); + ping(actions.a); =} reaction(a) -> out {= - out = count; - count += incr; + out = count; + count += incr; =} reaction(inp) {= - let logical = util.getCurrentLogicalTime(); - let physical = util.getCurrentPhysicalTime(); + let logical = util.getCurrentLogicalTime(); + let physical = util.getCurrentPhysicalTime(); - let time_lag = physical.subtract(logical); + let time_lag = physical.subtract(logical); - console.log("Received " + inp + ". Logical time is behind physical time by " + time_lag + "."); + console.log("Received " + inp + ". Logical time is behind physical time by " + time_lag + "."); =} reaction(shutdown) {= - console.log("******* Shutdown invoked."); - // Stop the ping function that is scheduling actions. - stop = true; - if (count != 5 * incr) { - util.requestErrorStop("Failed to receive all five expected inputs."); - } + console.log("******* Shutdown invoked."); + // Stop the ping function that is scheduling actions. + stop = true; + if (count != 5 * incr) { + util.requestErrorStop("Failed to receive all five expected inputs."); + } =} } diff --git a/test/TypeScript/src/federated/failing/LoopDistributedDouble.lf b/test/TypeScript/src/federated/failing/LoopDistributedDouble.lf index 096496bb2e..081c070048 100644 --- a/test/TypeScript/src/federated/failing/LoopDistributedDouble.lf +++ b/test/TypeScript/src/federated/failing/LoopDistributedDouble.lf @@ -8,7 +8,7 @@ target TypeScript { timeout: 5 sec, keepAlive: true, coordination-options: { - advance-message-interval: 100 msec + advance-message-interval: 100 msec } } @@ -22,51 +22,51 @@ reactor Looper(incr: number = 1, delay: time = 0 msec) { timer t(0, 1 sec) preamble {= - let stop = false; - // Function to trigger an action once every second. - function ping(act: any) { - if (!stop) { - console.log("Scheduling action."); - act.schedule(0, null); - setTimeout(ping, 1000, act); - } + let stop = false; + // Function to trigger an action once every second. + function ping(act: any) { + if (!stop) { + console.log("Scheduling action."); + act.schedule(0, null); + setTimeout(ping, 1000, act); } + } =} reaction(startup) -> a {= - // Start the ping function for triggering an action every second. - console.log("Starting ping function."); - ping(actions.a); + // Start the ping function for triggering an action every second. + console.log("Starting ping function."); + ping(actions.a); =} reaction(a) -> out, out2 {= - if (count % 2 == 0) { - out = count; - } else { - out2 = count; - } - count += incr; + if (count % 2 == 0) { + out = count; + } else { + out2 = count; + } + count += incr; =} reaction(inp) {= - console.log("Received " + inp + " on inp at logical time " + util.getElapsedLogicalTime() + "."); + console.log("Received " + inp + " on inp at logical time " + util.getElapsedLogicalTime() + "."); =} reaction(inp2) {= - console.log("Received " + inp2 + " on inp2 at logical time " + util.getElapsedLogicalTime() + "."); + console.log("Received " + inp2 + " on inp2 at logical time " + util.getElapsedLogicalTime() + "."); =} reaction(t) {= - console.log("Timer triggered at logical time " + util.getElapsedLogicalTime() + "."); + console.log("Timer triggered at logical time " + util.getElapsedLogicalTime() + "."); =} reaction(shutdown) {= - console.log("******* Shutdown invoked."); - // Stop the ping function that is scheduling actions. - stop = true; - if (count != 5 * incr) { - util.requestErrorStop("Failed to receive all five expected inputs."); - } + console.log("******* Shutdown invoked."); + // Stop the ping function that is scheduling actions. + stop = true; + if (count != 5 * incr) { + util.requestErrorStop("Failed to receive all five expected inputs."); + } =} } diff --git a/test/TypeScript/src/federated/failing/PingPongDistributed.lf b/test/TypeScript/src/federated/failing/PingPongDistributed.lf index 146251b382..42cceae73c 100644 --- a/test/TypeScript/src/federated/failing/PingPongDistributed.lf +++ b/test/TypeScript/src/federated/failing/PingPongDistributed.lf @@ -8,18 +8,18 @@ reactor Ping(count: number = 10) { logical action serve reaction(startup, serve) -> send {= - console.log(`At logical time ${util.getElapsedLogicalTime()}, Ping sending ${pingsLeft}`); - send = pingsLeft; - pingsLeft = pingsLeft - 1; + console.log(`At logical time ${util.getElapsedLogicalTime()}, Ping sending ${pingsLeft}`); + send = pingsLeft; + pingsLeft = pingsLeft - 1; =} reaction(receive) -> serve {= - if (pingsLeft > 0){ - actions.serve.schedule(0, null); - } - else{ - util.requestStop(); - } + if (pingsLeft > 0){ + actions.serve.schedule(0, null); + } + else{ + util.requestStop(); + } =} } @@ -29,19 +29,19 @@ reactor Pong(expected: number = 10) { state count: number = 0 reaction(receive) -> send {= - count += 1; - console.log(`At logical time ${util.getElapsedLogicalTime()}, Pong received ${receive}`) - send = receive; - if (count == expected){ - util.requestStop(); - } + count += 1; + console.log(`At logical time ${util.getElapsedLogicalTime()}, Pong received ${receive}`) + send = receive; + if (count == expected){ + util.requestStop(); + } =} reaction(shutdown) {= - if (count != expected){ - util.requestErrorStop(`Pong expected to receive ${expected} inputs, but it received ${count}`); - } - console.log(`Pong received ${count} pings.`); + if (count != expected){ + util.requestErrorStop(`Pong expected to receive ${expected} inputs, but it received ${count}`); + } + console.log(`Pong received ${count} pings.`); =} } diff --git a/test/TypeScript/src/federated/failing/PingPongDistributedPhysical.lf b/test/TypeScript/src/federated/failing/PingPongDistributedPhysical.lf index 53194b7fee..298a7298d4 100644 --- a/test/TypeScript/src/federated/failing/PingPongDistributedPhysical.lf +++ b/test/TypeScript/src/federated/failing/PingPongDistributedPhysical.lf @@ -32,16 +32,16 @@ reactor Ping(count: number = 10) { logical action serve reaction(startup, serve) -> send {= - console.log(`At logical time ${util.getElapsedLogicalTime()}, Ping sending ${pingsLeft}.`); - send = pingsLeft--; + console.log(`At logical time ${util.getElapsedLogicalTime()}, Ping sending ${pingsLeft}.`); + send = pingsLeft--; =} reaction(receive) -> serve {= - if (pingsLeft > 0) { - actions.serve.schedule(0, null); - } else { - util.requestStop(); - } + if (pingsLeft > 0) { + actions.serve.schedule(0, null); + } else { + util.requestStop(); + } =} } @@ -51,19 +51,19 @@ reactor Pong(expected: number = 10) { state count: number = 0 reaction(receive) -> send {= - count++; - console.log(`At logical time ${util.getElapsedLogicalTime()}, Pong receivedd ${receive}.`); - send = receive; - if (count === expected) { - util.requestStop(); - } + count++; + console.log(`At logical time ${util.getElapsedLogicalTime()}, Pong receivedd ${receive}.`); + send = receive; + if (count === expected) { + util.requestStop(); + } =} reaction(shutdown) {= - if (count !== expected) { - util.requestErrorStop(`Pong expected to received ${expected} inputs, but it received ${count}.`); - } - console.log(`Pong received ${count} pings.`); + if (count !== expected) { + util.requestErrorStop(`Pong expected to received ${expected} inputs, but it received ${count}.`); + } + console.log(`Pong received ${count} pings.`); =} } diff --git a/test/TypeScript/src/lib/ImportedAgain.lf b/test/TypeScript/src/lib/ImportedAgain.lf index e10ab4aa53..076ed1a2f1 100644 --- a/test/TypeScript/src/lib/ImportedAgain.lf +++ b/test/TypeScript/src/lib/ImportedAgain.lf @@ -10,7 +10,7 @@ reactor ImportedAgain { reaction(x) {= console.log("Received: " + x); if ((x as number) != 42) { - util.requestErrorStop("ERROR: Expected input to be 42. Got: " + x); + util.requestErrorStop("ERROR: Expected input to be 42. Got: " + x); } =} } diff --git a/test/TypeScript/src/lib/LoopedActionSender.lf b/test/TypeScript/src/lib/LoopedActionSender.lf index 6dcf02dd86..39ce28b348 100644 --- a/test/TypeScript/src/lib/LoopedActionSender.lf +++ b/test/TypeScript/src/lib/LoopedActionSender.lf @@ -21,11 +21,11 @@ reactor Sender(takeBreakAfter: number = 10, breakInterval: time = 400 msec) { out = sentMessages; sentMessages++; if (sentMessages < takeBreakAfter) { - actions.act.schedule(0, null); + actions.act.schedule(0, null); } else { - // Take a break - sentMessages = 0; - actions.act.schedule(breakInterval, null); + // Take a break + sentMessages = 0; + actions.act.schedule(breakInterval, null); } =} } diff --git a/test/TypeScript/src/lib/TestCount.lf b/test/TypeScript/src/lib/TestCount.lf index 92bf656ca8..84865da882 100644 --- a/test/TypeScript/src/lib/TestCount.lf +++ b/test/TypeScript/src/lib/TestCount.lf @@ -16,7 +16,7 @@ reactor TestCount(start: number = 1, stride: number = 1, numInputs: number = 1) reaction(inp) {= console.log("Received " + inp + "."); if (inp != count) { - util.requestErrorStop("Expected " + count + "."); + util.requestErrorStop("Expected " + count + "."); } count += stride; inputsReceived++; @@ -25,7 +25,7 @@ reactor TestCount(start: number = 1, stride: number = 1, numInputs: number = 1) reaction(shutdown) {= console.log("Shutdown invoked."); if (inputsReceived != numInputs) { - util.requestErrorStop("ERROR: Expected to receive " + numInputs + " inputs, but got " + inputsReceived + "."); + util.requestErrorStop("ERROR: Expected to receive " + numInputs + " inputs, but got " + inputsReceived + "."); } =} } diff --git a/test/TypeScript/src/multiport/BankMulticast.lf b/test/TypeScript/src/multiport/BankMulticast.lf index 64a944deea..436f553e6e 100644 --- a/test/TypeScript/src/multiport/BankMulticast.lf +++ b/test/TypeScript/src/multiport/BankMulticast.lf @@ -16,7 +16,7 @@ reactor Foo { c = new Count() c.out -> out - d = new TestCount(numInputs = 4) + d = new TestCount(numInputs=4) inp -> d.inp } @@ -32,6 +32,6 @@ reactor Bar { main reactor { bar = new Bar() - d = new[4] TestCount(numInputs = 4) + d = new[4] TestCount(numInputs=4) bar.out -> d.inp } diff --git a/test/TypeScript/src/multiport/BankMultiportToReaction.lf b/test/TypeScript/src/multiport/BankMultiportToReaction.lf index 96ba348a1c..1dffed020c 100644 --- a/test/TypeScript/src/multiport/BankMultiportToReaction.lf +++ b/test/TypeScript/src/multiport/BankMultiportToReaction.lf @@ -19,22 +19,22 @@ main reactor { reaction(s.out) {= for (let i = 0; i < s.length; i++) { - for (let j = 0; j < s[0].out.length; j++) { - if (s[i].out[j] !== undefined) { - console.log("Received " + (s[i].out[j] as number) + "."); - if (count !== s[i].out[j]) { - util.requestErrorStop("Expected " + count + "."); - } - received = true; - } + for (let j = 0; j < s[0].out.length; j++) { + if (s[i].out[j] !== undefined) { + console.log("Received " + (s[i].out[j] as number) + "."); + if (count !== s[i].out[j]) { + util.requestErrorStop("Expected " + count + "."); + } + received = true; } + } } count++; =} reaction(shutdown) {= if (!received) { - util.reportError("No inputs present."); + util.reportError("No inputs present."); } =} } diff --git a/test/TypeScript/src/multiport/BankReactionsInContainer.lf b/test/TypeScript/src/multiport/BankReactionsInContainer.lf index d3e485e6d1..6004711a7b 100644 --- a/test/TypeScript/src/multiport/BankReactionsInContainer.lf +++ b/test/TypeScript/src/multiport/BankReactionsInContainer.lf @@ -10,29 +10,29 @@ reactor R { reaction(startup) -> out {= for (let i = 0; i < out.length; i++) { - let value = this.getBankIndex() * 2 + i; - out[i] = value; - console.log("Inner sending " + value + " to bank " + - this.getBankIndex() + " channel " + i + "."); + let value = this.getBankIndex() * 2 + i; + out[i] = value; + console.log("Inner sending " + value + " to bank " + + this.getBankIndex() + " channel " + i + "."); } =} reaction(inp) {= for (let i = 0; i < inp.length; i++) { - if (inp[i] !== undefined) { - console.log("Inner received " + inp[i] + " inp bank " + this.getBankIndex() + ", channel " + i); - received = true; - if (inp[i] != this.getBankIndex() * 2 + i) { - util.requestErrorStop("Expected " + this.getBankIndex() * 2 + i + "."); - } + if (inp[i] !== undefined) { + console.log("Inner received " + inp[i] + " inp bank " + this.getBankIndex() + ", channel " + i); + received = true; + if (inp[i] != this.getBankIndex() * 2 + i) { + util.requestErrorStop("Expected " + this.getBankIndex() * 2 + i + "."); } + } } =} reaction(shutdown) {= console.log("Inner shutdown invoked."); if (!received) { - util.reportError("Received no input."); + util.reportError("Received no input."); } =} } @@ -44,31 +44,31 @@ main reactor { reaction(startup) -> s.inp {= let count = 0; for (let i = 0; i < s.length; i++) { - for (let j = 0; j < s[i].inp.length; j++) { - console.log("Sending " + count + " to bank " + i + " channel " + j + "."); - s[i].inp[j] = count++; - } + for (let j = 0; j < s[i].inp.length; j++) { + console.log("Sending " + count + " to bank " + i + " channel " + j + "."); + s[i].inp[j] = count++; + } } =} reaction(s.out) {= for (let j = 0; j < s.length; j++) { - for (let i = 0; i < s[j].out.length; i++) { - if (s[j].out[i] !== undefined) { - console.log("Outer received " + s[j].out[i] + " on bank " + j + " channel " + i + "."); - received = true; - if (s[j].out[i] != j * 2 + i) { - util.requestErrorStop("Expected " + j * 2 + i + "."); - } - } + for (let i = 0; i < s[j].out.length; i++) { + if (s[j].out[i] !== undefined) { + console.log("Outer received " + s[j].out[i] + " on bank " + j + " channel " + i + "."); + received = true; + if (s[j].out[i] != j * 2 + i) { + util.requestErrorStop("Expected " + j * 2 + i + "."); + } } + } } =} reaction(shutdown) {= console.log("Outer shutdown invoked."); if (!received) { - util.reportError("Received no input."); + util.reportError("Received no input."); } =} } diff --git a/test/TypeScript/src/multiport/BankSelfBroadcast.lf b/test/TypeScript/src/multiport/BankSelfBroadcast.lf index f33164b18d..956de7d5a2 100644 --- a/test/TypeScript/src/multiport/BankSelfBroadcast.lf +++ b/test/TypeScript/src/multiport/BankSelfBroadcast.lf @@ -18,23 +18,23 @@ reactor A { reaction(inp) {= for (let i = 0; i < inp.length; i++) { - if (inp[i] !== undefined) { - console.log("Reactor " + this.getBankIndex() + " received " + - inp[i] + " on channel " + i); - if (inp[i] != i) { - util.requestErrorStop("ERROR: Expected " + i); - } - received = true; - } else { - console.log("Reactor " + this.getBankIndex() + " channel " + i + " is absent."); - util.requestErrorStop("ERROR: Expected " + i); + if (inp[i] !== undefined) { + console.log("Reactor " + this.getBankIndex() + " received " + + inp[i] + " on channel " + i); + if (inp[i] != i) { + util.requestErrorStop("ERROR: Expected " + i); } + received = true; + } else { + console.log("Reactor " + this.getBankIndex() + " channel " + i + " is absent."); + util.requestErrorStop("ERROR: Expected " + i); + } } =} reaction(shutdown) {= if (!received) { - util.requestErrorStop("ERROR: No inputs received."); + util.requestErrorStop("ERROR: No inputs received."); } =} } diff --git a/test/TypeScript/src/multiport/BankToBank.lf b/test/TypeScript/src/multiport/BankToBank.lf index cae7581aa1..4dd7c068ed 100644 --- a/test/TypeScript/src/multiport/BankToBank.lf +++ b/test/TypeScript/src/multiport/BankToBank.lf @@ -21,14 +21,14 @@ reactor Destination { reaction(inp) {= console.log("Destination " + this.getBankIndex() + " received: " + inp); if (inp != s) { - util.requestErrorStop("ERROR: Expected " + s + "."); + util.requestErrorStop("ERROR: Expected " + s + "."); } s += this.getBankIndex(); =} reaction(shutdown) {= if (s == 0 && this.getBankIndex() != 0) { - util.requestErrorStop("ERROR: Destination " + this.getBankIndex() + " received no input!"); + util.requestErrorStop("ERROR: Destination " + this.getBankIndex() + " received no input!"); } console.log("Success."); =} diff --git a/test/TypeScript/src/multiport/BankToBankMultiport.lf b/test/TypeScript/src/multiport/BankToBankMultiport.lf index b386ae631a..7c227564b5 100644 --- a/test/TypeScript/src/multiport/BankToBankMultiport.lf +++ b/test/TypeScript/src/multiport/BankToBankMultiport.lf @@ -10,7 +10,7 @@ reactor Source(width: number = 1) { reaction(t) -> out {= for(let i = 0; i < out.length; i++) { - out[i] = s++; + out[i] = s++; } =} } @@ -22,26 +22,26 @@ reactor Destination(width: number = 1) { reaction(inp) {= let sum = 0; for (let i = 0; i < inp.length; i++) { - let val = inp[i]; - if (val !== undefined) sum += val; + let val = inp[i]; + if (val !== undefined) sum += val; } console.log("Sum of received: " + sum + "."); if (sum != s) { - util.requestErrorStop("ERROR: Expected " + s + "."); + util.requestErrorStop("ERROR: Expected " + s + "."); } s += 16; =} reaction(shutdown) {= if (s <= 6) { - util.reportError("ERROR: Destination received no input!"); + util.reportError("ERROR: Destination received no input!"); } console.log("Success."); =} } main reactor BankToBankMultiport(bankWidth: number = 4) { - a = new[bankWidth] Source(width = 4) - b = new[bankWidth] Destination(width = 4) + a = new[bankWidth] Source(width=4) + b = new[bankWidth] Destination(width=4) a.out -> b.inp } diff --git a/test/TypeScript/src/multiport/BankToBankMultiportAfter.lf b/test/TypeScript/src/multiport/BankToBankMultiportAfter.lf index 3c8443398e..9df4638852 100644 --- a/test/TypeScript/src/multiport/BankToBankMultiportAfter.lf +++ b/test/TypeScript/src/multiport/BankToBankMultiportAfter.lf @@ -10,7 +10,7 @@ reactor Source(width: number = 1) { reaction(t) -> out {= for(let i = 0; i < out.length; i++) { - out[i] = s++; + out[i] = s++; } =} } @@ -22,26 +22,26 @@ reactor Destination(width: number = 1) { reaction(inp) {= let sum = 0; for (let i = 0; i < inp.length; i++) { - let val = inp[i]; - if (val !== undefined) sum += val; + let val = inp[i]; + if (val !== undefined) sum += val; } console.log("Sum of received: " + sum + "."); if (sum != s) { - util.requestErrorStop("ERROR: Expected " + s + "."); + util.requestErrorStop("ERROR: Expected " + s + "."); } s += 16; =} reaction(shutdown) {= if (s <= 6) { - util.reportError("ERROR: Destination received no input!"); + util.reportError("ERROR: Destination received no input!"); } console.log("Success."); =} } main reactor(bankWidth: number = 4) { - a = new[bankWidth] Source(width = 4) - b = new[bankWidth] Destination(width = 4) + a = new[bankWidth] Source(width=4) + b = new[bankWidth] Destination(width=4) a.out -> b.inp after 200 msec } diff --git a/test/TypeScript/src/multiport/BankToMultiport.lf b/test/TypeScript/src/multiport/BankToMultiport.lf index 5794e34b38..b1ea107ca9 100644 --- a/test/TypeScript/src/multiport/BankToMultiport.lf +++ b/test/TypeScript/src/multiport/BankToMultiport.lf @@ -13,17 +13,17 @@ reactor Sink { reaction(inp) {= for (let i = 0; i < inp.length; i++) { - received = true; - console.log("Received " + inp[i]); - if (inp[i] != i) { - util.requestErrorStop("Error: expected " + i); - } + received = true; + console.log("Received " + inp[i]); + if (inp[i] != i) { + util.requestErrorStop("Error: expected " + i); + } } =} reaction(shutdown) {= if (!received) { - util.requestErrorStop("Error: received no input!"); + util.requestErrorStop("Error: received no input!"); } =} } diff --git a/test/TypeScript/src/multiport/BankToReaction.lf b/test/TypeScript/src/multiport/BankToReaction.lf index 7eb2bbd0c6..2e46e45e24 100644 --- a/test/TypeScript/src/multiport/BankToReaction.lf +++ b/test/TypeScript/src/multiport/BankToReaction.lf @@ -11,10 +11,10 @@ main reactor { reaction(s.out) {= for (let i = 0; i < s.length; i++) { - console.log("Received " + s[i].out + "."); - if (count != s[i].out) { - util.requestErrorStop("Expected " + count + "."); - } + console.log("Received " + s[i].out + "."); + if (count != s[i].out) { + util.requestErrorStop("Expected " + count + "."); + } } count++; =} diff --git a/test/TypeScript/src/multiport/Broadcast.lf b/test/TypeScript/src/multiport/Broadcast.lf index c43b81f736..8ec6e21742 100644 --- a/test/TypeScript/src/multiport/Broadcast.lf +++ b/test/TypeScript/src/multiport/Broadcast.lf @@ -12,7 +12,7 @@ reactor Sink { reaction(inp) {= console.log("Received " + inp); if (inp != 42) { - util.requestErrorStop("Error: expected " + 42); + util.requestErrorStop("Error: expected " + 42); } =} } diff --git a/test/TypeScript/src/multiport/BroadcastAfter.lf b/test/TypeScript/src/multiport/BroadcastAfter.lf index 9fde4d610d..5d8165b983 100644 --- a/test/TypeScript/src/multiport/BroadcastAfter.lf +++ b/test/TypeScript/src/multiport/BroadcastAfter.lf @@ -15,18 +15,18 @@ reactor Destination { reaction(inp) {= console.log("Destination " + this.getBankIndex() + " received " + inp + "."); if (inp != 42) { - util.requestErrorStop("ERROR: Expected 42."); + util.requestErrorStop("ERROR: Expected 42."); } let elapsedTime = util.getElapsedLogicalTime(); if (!elapsedTime.isEqualTo(TimeValue.sec(1))) { - util.requestErrorStop("ERROR: Expected to receive input after one second."); + util.requestErrorStop("ERROR: Expected to receive input after one second."); } received = true; =} reaction(shutdown) {= if (!received) { - util.reportError("ERROR: Destination " + this.getBankIndex() + " received no input!"); + util.reportError("ERROR: Destination " + this.getBankIndex() + " received no input!"); } console.log("Success."); =} diff --git a/test/TypeScript/src/multiport/BroadcastMultipleAfter.lf b/test/TypeScript/src/multiport/BroadcastMultipleAfter.lf index 0840127f64..cd9bcd726a 100644 --- a/test/TypeScript/src/multiport/BroadcastMultipleAfter.lf +++ b/test/TypeScript/src/multiport/BroadcastMultipleAfter.lf @@ -16,27 +16,27 @@ reactor Destination { console.log("Destination " + this.getBankIndex() + " received " + inp + "."); let expected = (this.getBankIndex() % 3) + 1; if (inp != expected) { - util.requestErrorStop("ERROR: Expected " + expected + "."); + util.requestErrorStop("ERROR: Expected " + expected + "."); } let elapsedTime = util.getElapsedLogicalTime(); if (!elapsedTime.isEqualTo(TimeValue.sec(1))) { - util.requestErrorStop("ERROR: Expected to receive input after one second."); + util.requestErrorStop("ERROR: Expected to receive input after one second."); } received = true; =} reaction(shutdown) {= if (!received) { - util.requestErrorStop("ERROR: Destination " + this.getBankIndex() + " received no input!"); + util.requestErrorStop("ERROR: Destination " + this.getBankIndex() + " received no input!"); } console.log("Success."); =} } main reactor { - a1 = new Source(value = 1) - a2 = new Source(value = 2) - a3 = new Source(value = 3) + a1 = new Source(value=1) + a2 = new Source(value=2) + a3 = new Source(value=3) b = new[9] Destination() (a1.out, a2.out, a3.out)+ -> b.inp after 1 sec } diff --git a/test/TypeScript/src/multiport/FullyConnected.lf b/test/TypeScript/src/multiport/FullyConnected.lf index e33b1728c5..9db964a4d9 100644 --- a/test/TypeScript/src/multiport/FullyConnected.lf +++ b/test/TypeScript/src/multiport/FullyConnected.lf @@ -16,27 +16,27 @@ reactor Node(numNodes: number = 4) { console.log("Node " + this.getBankIndex() + " received messages from "); let count = 0; for (let i = 0; i < inp.length; i++) { - let val = inp[i] - if (val !== undefined) { - received = true; - count++; - console.log(val + ", "); - } + let val = inp[i] + if (val !== undefined) { + received = true; + count++; + console.log(val + ", "); + } } console.log(""); if (count != numNodes) { - util.requestErrorStop("Received fewer messages than expected!"); + util.requestErrorStop("Received fewer messages than expected!"); } =} reaction(shutdown) {= if (!received) { - util.reportError("Received no input!"); + util.reportError("Received no input!"); } =} } main reactor(numNodes: number = 4) { - nodes = new[numNodes] Node(numNodes = numNodes) + nodes = new[numNodes] Node(numNodes=numNodes) (nodes.out)+ -> nodes.inp } diff --git a/test/TypeScript/src/multiport/MultiportFromBank.lf b/test/TypeScript/src/multiport/MultiportFromBank.lf index 1bd32c218a..63708bfb76 100644 --- a/test/TypeScript/src/multiport/MultiportFromBank.lf +++ b/test/TypeScript/src/multiport/MultiportFromBank.lf @@ -16,17 +16,17 @@ reactor Destination(portWidth: number = 3) { reaction(inp) {= for (let i = 0; i < inp.length; i++) { - console.log("Destination channel " + i + " received " + inp[i]); - if (i != inp[i]) { - util.requestErrorStop("ERROR: Expected " + i); - } + console.log("Destination channel " + i + " received " + inp[i]); + if (i != inp[i]) { + util.requestErrorStop("ERROR: Expected " + i); + } } received = true; =} reaction(shutdown) {= if (!received) { - util.requestErrorStop("ERROR: Destination received no input!"); + util.requestErrorStop("ERROR: Destination received no input!"); } console.log("Success."); =} @@ -34,6 +34,6 @@ reactor Destination(portWidth: number = 3) { main reactor(width: number = 4) { a = new[width] Source() - b = new Destination(portWidth = width) + b = new Destination(portWidth=width) a.out -> b.inp } diff --git a/test/TypeScript/src/multiport/MultiportFromBankHierarchyAfter.lf b/test/TypeScript/src/multiport/MultiportFromBankHierarchyAfter.lf index b960ff2bc1..91a5e834ee 100644 --- a/test/TypeScript/src/multiport/MultiportFromBankHierarchyAfter.lf +++ b/test/TypeScript/src/multiport/MultiportFromBankHierarchyAfter.lf @@ -8,7 +8,7 @@ import Destination from "MultiportFromBank.lf" import Container from "MultiportFromBankHierarchy.lf" main reactor MultiportFromBankHierarchyAfter { - a = new Container(portWidth = 4) - b = new Destination(portWidth = 4) + a = new Container(portWidth=4) + b = new Destination(portWidth=4) a.out -> b.inp after 1 sec } diff --git a/test/TypeScript/src/multiport/MultiportFromHierarchy.lf b/test/TypeScript/src/multiport/MultiportFromHierarchy.lf index 85b32de0e6..f1d9e623de 100644 --- a/test/TypeScript/src/multiport/MultiportFromHierarchy.lf +++ b/test/TypeScript/src/multiport/MultiportFromHierarchy.lf @@ -10,7 +10,7 @@ reactor Source(width: number = 3) { reaction(t) -> out {= for(let i = 0; i < out.length; i++) { - out[i] = s++; + out[i] = s++; } =} } @@ -22,19 +22,19 @@ reactor Destination(width: number = 3) { reaction(inp) {= let sum = 0; for (let i = 0; i < inp.length; i++) { - let val = inp[i] - if (val !== undefined) sum += val; + let val = inp[i] + if (val !== undefined) sum += val; } console.log("Sum of received: " + sum + "."); if (sum != s) { - util.requestErrorStop("ERROR: Expected " + s + "."); + util.requestErrorStop("ERROR: Expected " + s + "."); } s += 16; =} reaction(shutdown) {= if (s <= 6) { - util.reportError("ERROR: Destination received no input!"); + util.reportError("ERROR: Destination received no input!"); } console.log("Success."); =} @@ -42,18 +42,18 @@ reactor Destination(width: number = 3) { reactor Container(width: number = 3) { output[width] out: number - src = new InsideContainer(width = width) + src = new InsideContainer(width=width) src.out -> out } reactor InsideContainer(width: number = 3) { output[width] out: number - src = new Source(width = width) + src = new Source(width=width) src.out -> out } main reactor MultiportFromHierarchy(width: number = 4) { - a = new Container(width = width) - b = new Destination(width = width) + a = new Container(width=width) + b = new Destination(width=width) a.out -> b.inp } diff --git a/test/TypeScript/src/multiport/MultiportFromReaction.lf b/test/TypeScript/src/multiport/MultiportFromReaction.lf index 582467f092..6959047e29 100644 --- a/test/TypeScript/src/multiport/MultiportFromReaction.lf +++ b/test/TypeScript/src/multiport/MultiportFromReaction.lf @@ -10,19 +10,19 @@ reactor Destination(width: number = 1) { reaction(inp) {= let sum = 0; for (let i = 0; i < inp.length; i++) { - let val = inp[i] - if (val !== undefined) sum += val; + let val = inp[i] + if (val !== undefined) sum += val; } console.log("Sum of received: " + sum + "."); if (sum != s) { - util.requestErrorStop("ERROR: Expected " + s + "."); + util.requestErrorStop("ERROR: Expected " + s + "."); } s += 16; =} reaction(shutdown) {= if (s <= 6) { - util.reportError("ERROR: Destination received no input!"); + util.reportError("ERROR: Destination received no input!"); } console.log("Success."); =} @@ -31,14 +31,14 @@ reactor Destination(width: number = 1) { main reactor MultiportFromReaction(width: number = 4) { timer t(0, 200 msec) state s: number = 0 - b = new Destination(width = width) + b = new Destination(width=width) reaction(t) -> b.inp {= for (let i = 0; i < b.inp.length; i++) { - console.log("Before SET, b.inp[" + i + "] !== undefined has value " + b.inp[i] !== undefined); - b.inp[i] = s++; - console.log("AFTER set, b.inp[" + i + "] !== undefined has value " + b.inp[i] !== undefined); - console.log("AFTER set, b.inp[" + i + "] has value " + b.inp[i]); + console.log("Before SET, b.inp[" + i + "] !== undefined has value " + b.inp[i] !== undefined); + b.inp[i] = s++; + console.log("AFTER set, b.inp[" + i + "] !== undefined has value " + b.inp[i] !== undefined); + console.log("AFTER set, b.inp[" + i + "] has value " + b.inp[i]); } =} } diff --git a/test/TypeScript/src/multiport/MultiportIn.lf b/test/TypeScript/src/multiport/MultiportIn.lf index aac9e2e4d5..8e786a4fdd 100644 --- a/test/TypeScript/src/multiport/MultiportIn.lf +++ b/test/TypeScript/src/multiport/MultiportIn.lf @@ -26,23 +26,23 @@ reactor Destination { reaction(inp) {= let sum = 0; for (let i = 0; i < inp.length; i++) { - const val = inp[i]; - if (val === undefined) { - util.requestErrorStop("ERROR: input at [" + i + "] is missing."); - } else { - sum += val; - } + const val = inp[i]; + if (val === undefined) { + util.requestErrorStop("ERROR: input at [" + i + "] is missing."); + } else { + sum += val; + } } console.log("Sum of received: " + sum + "."); if (sum != s) { - util.requestErrorStop("ERROR: Expected " + s + "."); + util.requestErrorStop("ERROR: Expected " + s + "."); } s += 4; =} reaction(shutdown) {= if (s == 0) { - util.requestErrorStop("ERROR: Destination received no input!"); + util.requestErrorStop("ERROR: Destination received no input!"); } console.log("Success."); =} diff --git a/test/TypeScript/src/multiport/MultiportInParameterized.lf b/test/TypeScript/src/multiport/MultiportInParameterized.lf index 7736e303e5..1f60d19bf0 100644 --- a/test/TypeScript/src/multiport/MultiportInParameterized.lf +++ b/test/TypeScript/src/multiport/MultiportInParameterized.lf @@ -29,21 +29,21 @@ reactor Destination(width: number = 1) { reaction(inp) {= let sum = 0; for (let i = 0; i < inp.length; i++) { - let val = inp[i]; - if (val !== undefined) { - sum += val; - } + let val = inp[i]; + if (val !== undefined) { + sum += val; + } } console.log("Sum of received: " + sum + "."); if (sum != s) { - util.requestErrorStop("ERROR: Expected " + s + "."); + util.requestErrorStop("ERROR: Expected " + s + "."); } s += 4; =} reaction(shutdown) {= if (s == 0) { - util.reportError("ERROR: Destination received no input!"); + util.reportError("ERROR: Destination received no input!"); } console.log("Success."); =} @@ -55,7 +55,7 @@ main reactor { t2 = new Computation() t3 = new Computation() t4 = new Computation() - b = new Destination(width = 4) + b = new Destination(width=4) a.out -> t1.inp a.out -> t2.inp a.out -> t3.inp diff --git a/test/TypeScript/src/multiport/MultiportMutableInput.lf b/test/TypeScript/src/multiport/MultiportMutableInput.lf index aad2281b3d..226efc4c7b 100644 --- a/test/TypeScript/src/multiport/MultiportMutableInput.lf +++ b/test/TypeScript/src/multiport/MultiportMutableInput.lf @@ -18,11 +18,11 @@ reactor Print(scale: number = 1) { reaction(inp) {= let expected = 42; for (let j = 0; j < 2; j++) { - console.log("Received on channel " + j + ": " + inp[j]); - if (inp[j] != expected) { - util.requestErrorStop("ERROR: Expected " + expected + "!"); - } - expected *=2; + console.log("Received on channel " + j + ": " + inp[j]); + if (inp[j] != expected) { + util.requestErrorStop("ERROR: Expected " + expected + "!"); + } + expected *=2; } =} } @@ -33,9 +33,9 @@ reactor Scale(scale: number = 2) { reaction(inp) -> out {= for (let j = 0; j < 2; j++) { - // Modify the input, allowed because mutable. - (inp[j] as number) *= scale; - out[j] = inp[j] as number; + // Modify the input, allowed because mutable. + (inp[j] as number) *= scale; + out[j] = inp[j] as number; } =} } @@ -43,7 +43,7 @@ reactor Scale(scale: number = 2) { main reactor { s = new Source() c = new Scale() - p = new Print(scale = 2) + p = new Print(scale=2) s.out -> c.inp c.out -> p.inp } diff --git a/test/TypeScript/src/multiport/MultiportMutableInputArray.lf b/test/TypeScript/src/multiport/MultiportMutableInputArray.lf index 3450885edf..b097927288 100644 --- a/test/TypeScript/src/multiport/MultiportMutableInputArray.lf +++ b/test/TypeScript/src/multiport/MultiportMutableInputArray.lf @@ -30,27 +30,27 @@ reactor Print(scale: number = 1) { input[2] inp: {= Array =} reaction(inp) {= - let count = 0; // For testing. + let count = 0; // For testing. let failed = false; // For testing. for(let j = 0; j < 2; j++) { - let logString = "Received on channel " + j + ": ["; - if (inp[j] === undefined) { - continue; + let logString = "Received on channel " + j + ": ["; + if (inp[j] === undefined) { + continue; + } + for (let i = 0; i < (inp[j] as Array).length; i++) { + if (i > 0) logString += ", "; + logString += (inp[j] as Array)[i]; + // For testing, check whether values match expectation. + if ((inp[j] as Array)[i] != scale * count) { + failed = true; } - for (let i = 0; i < (inp[j] as Array).length; i++) { - if (i > 0) logString += ", "; - logString += (inp[j] as Array)[i]; - // For testing, check whether values match expectation. - if ((inp[j] as Array)[i] != scale * count) { - failed = true; - } - count++; // For testing. - } - logString += "]"; - console.log(logString); + count++; // For testing. + } + logString += "]"; + console.log(logString); } if (failed) { - util.requestErrorStop("ERROR: Value received by Print does not match expectation!"); + util.requestErrorStop("ERROR: Value received by Print does not match expectation!"); } =} } @@ -61,13 +61,13 @@ reactor Scale(scale: number = 2) { reaction(inp) -> out {= for (let j = 0; j < inp.length; j++) { - if (inp[j] === undefined) { - continue; - } - for (let i = 0; i < (inp[j] as Array).length; i++) { - (inp[j] as Array)[i] *= scale; - } - out[j] = (inp[j] as Array); + if (inp[j] === undefined) { + continue; + } + for (let i = 0; i < (inp[j] as Array).length; i++) { + (inp[j] as Array)[i] *= scale; + } + out[j] = (inp[j] as Array); } =} } @@ -75,7 +75,7 @@ reactor Scale(scale: number = 2) { main reactor { s = new Source() c = new Scale() - p = new Print(scale = 2) + p = new Print(scale=2) s.out -> c.inp c.out -> p.inp } diff --git a/test/TypeScript/src/multiport/MultiportOut.lf b/test/TypeScript/src/multiport/MultiportOut.lf index e689c552fd..1bec85473b 100644 --- a/test/TypeScript/src/multiport/MultiportOut.lf +++ b/test/TypeScript/src/multiport/MultiportOut.lf @@ -10,7 +10,7 @@ reactor Source { reaction(t) -> out {= for(let i = 0; i < 4; i++) { - out[i] = s; + out[i] = s; } s++; =} @@ -33,19 +33,19 @@ reactor Destination { reaction(inp) {= let sum = 0; for (let i = 0; i < inp.length; i++) { - const val = inp[i] - if (val !== undefined) sum += val; + const val = inp[i] + if (val !== undefined) sum += val; } console.log("Sum of received: " + sum + "."); if (sum != s) { - util.requestErrorStop("ERROR: Expected " + s + "."); + util.requestErrorStop("ERROR: Expected " + s + "."); } s += 4; =} reaction(shutdown) {= if (s == 0) { - util.requestErrorStop("ERROR: Destination received no input!"); + util.requestErrorStop("ERROR: Destination received no input!"); } console.log("Success."); =} diff --git a/test/TypeScript/src/multiport/MultiportToBank.lf b/test/TypeScript/src/multiport/MultiportToBank.lf index efc4fcca4d..1b210c6cba 100644 --- a/test/TypeScript/src/multiport/MultiportToBank.lf +++ b/test/TypeScript/src/multiport/MultiportToBank.lf @@ -5,7 +5,7 @@ reactor Source { reaction(startup) -> out {= for (let i = 0 ; i < out.length; i++) { - out[i] = i; + out[i] = i; } =} } @@ -16,7 +16,7 @@ reactor Sink { reaction(inp) {= console.log("Received " + inp); if (inp != this.getBankIndex()) { - util.requestErrorStop("Error: expected " + this.getBankIndex()); + util.requestErrorStop("Error: expected " + this.getBankIndex()); } =} } diff --git a/test/TypeScript/src/multiport/MultiportToBankAfter.lf b/test/TypeScript/src/multiport/MultiportToBankAfter.lf index 292da3bb53..c9f62dfa7a 100644 --- a/test/TypeScript/src/multiport/MultiportToBankAfter.lf +++ b/test/TypeScript/src/multiport/MultiportToBankAfter.lf @@ -8,7 +8,7 @@ reactor Source(width: number = 2) { reaction(startup) -> out {= for (let i = 0; i < out.length; i++) { - out[i] = i; + out[i] = i; } =} } @@ -20,26 +20,26 @@ reactor Destination { reaction(inp) {= console.log("Destination " + this.getBankIndex() + " received " + inp + "."); if (this.getBankIndex() != inp) { - util.requestErrorStop("ERROR: Expected " + this.getBankIndex() + "."); + util.requestErrorStop("ERROR: Expected " + this.getBankIndex() + "."); } let elapsedTime = util.getElapsedLogicalTime(); if (!elapsedTime.isEqualTo(TimeValue.sec(1))) { - util.requestErrorStop("ERROR: Expected to receive input after one second."); + util.requestErrorStop("ERROR: Expected to receive input after one second."); } received = true; =} reaction(shutdown) {= if (!received) { - util.reportError("ERROR: Destination " + this.getBankIndex() + " received no input!", ); + util.reportError("ERROR: Destination " + this.getBankIndex() + " received no input!", ); } console.log("Success."); =} } main reactor(width: number = 3) { - a = new Source(width = width) + a = new Source(width=width) b = new[width] Destination() a.out -> b.inp after 1 sec // Width of the bank of delays will be inferred. } diff --git a/test/TypeScript/src/multiport/MultiportToBankDouble.lf b/test/TypeScript/src/multiport/MultiportToBankDouble.lf index 966fdf3b32..cf110a5369 100644 --- a/test/TypeScript/src/multiport/MultiportToBankDouble.lf +++ b/test/TypeScript/src/multiport/MultiportToBankDouble.lf @@ -9,7 +9,7 @@ reactor Source { reaction(startup) -> out {= for (let i = 0; i < out.length; i++) { - out[i] = i; + out[i] = i; } =} @@ -19,7 +19,7 @@ reactor Source { // Contents of the reactions does not matter (either could be empty) out {= for (let i = 0; i < out.length; i++) { - out[i] = i * 2; + out[i] = i * 2; } =} } @@ -31,14 +31,14 @@ reactor Destination { reaction(inp) {= console.log("Destination " + this.getBankIndex() + " received " + inp + "."); if (this.getBankIndex() * 2 != inp) { - util.requestErrorStop("ERROR: Expected " + this.getBankIndex() * 2 + "."); + util.requestErrorStop("ERROR: Expected " + this.getBankIndex() * 2 + "."); } received = true; =} reaction(shutdown) {= if (!received) { - util.reportError("ERROR: Destination " + this.getBankIndex() + " received no input!"); + util.reportError("ERROR: Destination " + this.getBankIndex() + " received no input!"); } console.log("Success."); =} diff --git a/test/TypeScript/src/multiport/MultiportToBankHierarchy.lf b/test/TypeScript/src/multiport/MultiportToBankHierarchy.lf index d98b662a5a..384e64e986 100644 --- a/test/TypeScript/src/multiport/MultiportToBankHierarchy.lf +++ b/test/TypeScript/src/multiport/MultiportToBankHierarchy.lf @@ -9,7 +9,7 @@ reactor Source { reaction(startup) -> out {= for(let i = 0; i < out.length; i++) { - out[i] = i; + out[i] = i; } =} } @@ -21,14 +21,14 @@ reactor Destination { reaction(inp) {= console.log("Destination " + this.getBankIndex() + " received " + inp + "."); if (this.getBankIndex() != inp) { - util.requestErrorStop("ERROR: Expected " + this.getBankIndex() + "."); + util.requestErrorStop("ERROR: Expected " + this.getBankIndex() + "."); } received = true; =} reaction(shutdown) {= if (!received) { - util.reportError("ERROR: Destination " + this.getBankIndex() + " received no input!"); + util.reportError("ERROR: Destination " + this.getBankIndex() + " received no input!"); } console.log("Success."); =} diff --git a/test/TypeScript/src/multiport/MultiportToHierarchy.lf b/test/TypeScript/src/multiport/MultiportToHierarchy.lf index e05cc29d29..ed9440a91f 100644 --- a/test/TypeScript/src/multiport/MultiportToHierarchy.lf +++ b/test/TypeScript/src/multiport/MultiportToHierarchy.lf @@ -11,7 +11,7 @@ reactor Source(width: number = 4) { reaction(t) -> out {= for(let i = 0; i < 4; i++) { - out[i] = s++; + out[i] = s++; } =} } @@ -23,19 +23,19 @@ reactor Destination(width: number = 4) { reaction(inp) {= let sum = 0; for (let i = 0; i < inp.length; i++) { - const val = inp[i] - if (val !== undefined) sum += val; + const val = inp[i] + if (val !== undefined) sum += val; } console.log("Sum of received: " + sum + "."); if (sum != s) { - util.requestErrorStop("ERROR: Expected " + s + "."); + util.requestErrorStop("ERROR: Expected " + s + "."); } s += 16; =} reaction(shutdown) {= if (s <= 6) { - util.requestErrorStop("ERROR: Destination received no input!"); + util.requestErrorStop("ERROR: Destination received no input!"); } console.log("Success."); =} @@ -48,7 +48,7 @@ reactor Container(width: number = 4) { } main reactor MultiportToHierarchy(width: number = 4) { - a = new Source(width = width) - b = new Container(width = width) + a = new Source(width=width) + b = new Container(width=width) a.out -> b.inp } diff --git a/test/TypeScript/src/multiport/MultiportToMultiport.lf b/test/TypeScript/src/multiport/MultiportToMultiport.lf index 73449b47c5..da9515ea94 100644 --- a/test/TypeScript/src/multiport/MultiportToMultiport.lf +++ b/test/TypeScript/src/multiport/MultiportToMultiport.lf @@ -5,7 +5,7 @@ reactor Source { reaction(startup) -> out {= for (let i = 0; i < out.length; i++) { - out[i] = i; + out[i] = i; } =} } @@ -16,17 +16,17 @@ reactor Sink { reaction(inp) {= for (let i = 0; i < inp.length; i++) { - console.log("Received " + inp[i]); - received = true; - if (inp[i] != i) { - util.requestErrorStop("FAILURE: Expected " + i + "!"); - } + console.log("Received " + inp[i]); + received = true; + if (inp[i] != i) { + util.requestErrorStop("FAILURE: Expected " + i + "!"); + } } =} reaction(shutdown) {= if (!received) { - util.requestErrorStop("ERROR: No data received!!"); + util.requestErrorStop("ERROR: No data received!!"); } console.log("Success."); =} diff --git a/test/TypeScript/src/multiport/MultiportToMultiport2.lf b/test/TypeScript/src/multiport/MultiportToMultiport2.lf index 205767e7db..5b6f88800b 100644 --- a/test/TypeScript/src/multiport/MultiportToMultiport2.lf +++ b/test/TypeScript/src/multiport/MultiportToMultiport2.lf @@ -6,7 +6,7 @@ reactor Source(width: number = 2) { reaction(startup) -> out {= for (let i = 0; i < out.length; i++) { - out[i] = i; + out[i] = i; } =} } @@ -16,19 +16,19 @@ reactor Destination(width: number = 2) { reaction(inp) {= for (let i = 0; i < inp.length; i++) { - console.log("Received on channel " + i + ": " + inp[i]); - // NOTE: For testing purposes, this assumes the specific - // widths instantiated below. - if (inp[i] != i % 3) { - util.requestErrorStop("ERROR: expected " + i % 3); - } + console.log("Received on channel " + i + ": " + inp[i]); + // NOTE: For testing purposes, this assumes the specific + // widths instantiated below. + if (inp[i] != i % 3) { + util.requestErrorStop("ERROR: expected " + i % 3); + } } =} } main reactor MultiportToMultiport2 { - a1 = new Source(width = 3) - a2 = new Source(width = 2) - b = new Destination(width = 5) + a1 = new Source(width=3) + a2 = new Source(width=2) + b = new Destination(width=5) a1.out, a2.out -> b.inp } diff --git a/test/TypeScript/src/multiport/MultiportToMultiport2After.lf b/test/TypeScript/src/multiport/MultiportToMultiport2After.lf index 5a511c8253..38eabbac3f 100644 --- a/test/TypeScript/src/multiport/MultiportToMultiport2After.lf +++ b/test/TypeScript/src/multiport/MultiportToMultiport2After.lf @@ -6,7 +6,7 @@ reactor Source(width: number = 2) { reaction(startup) -> out {= for (let i = 0; i < out.length; i++) { - out[i] = i; + out[i] = i; } =} } @@ -16,26 +16,26 @@ reactor Destination(width: number = 2) { reaction(inp) {= for (let i = 0; i < inp.length; i++) { - if (inp[i] !== undefined) { - let value = inp[i]; - console.log("Received on channel " + i + ": " + value); - // NOTE: For testing purposes, this assumes the specific - // widths instantiated below. - if (value != i % 3) { - util.requestErrorStop("ERROR: expected " + i % 3); - } + if (inp[i] !== undefined) { + let value = inp[i]; + console.log("Received on channel " + i + ": " + value); + // NOTE: For testing purposes, this assumes the specific + // widths instantiated below. + if (value != i % 3) { + util.requestErrorStop("ERROR: expected " + i % 3); } + } } let elapsedTime = util.getElapsedLogicalTime(); if (!elapsedTime.isEqualTo(TimeValue.msec(1000))) { - util.requestErrorStop("ERROR: Expected to receive input after one second."); + util.requestErrorStop("ERROR: Expected to receive input after one second."); } =} } main reactor { - a1 = new Source(width = 3) - a2 = new Source(width = 2) - b = new Destination(width = 5) + a1 = new Source(width=3) + a2 = new Source(width=2) + b = new Destination(width=5) a1.out, a2.out -> b.inp after 1 sec } diff --git a/test/TypeScript/src/multiport/MultiportToMultiportArray.lf b/test/TypeScript/src/multiport/MultiportToMultiportArray.lf index a8e51556f5..018d8dd587 100644 --- a/test/TypeScript/src/multiport/MultiportToMultiportArray.lf +++ b/test/TypeScript/src/multiport/MultiportToMultiportArray.lf @@ -10,14 +10,14 @@ reactor Source { reaction(t) -> out {= for(let i = 0; i < 2; i++) { - // Dynamically allocate a new output array - let a = new Array(3); - // initialize it - a[0] = s++; - a[1] = s++; - a[2] = s++; - // and send it - out[i] = a; + // Dynamically allocate a new output array + let a = new Array(3); + // initialize it + a[0] = s++; + a[1] = s++; + a[2] = s++; + // and send it + out[i] = a; } =} } @@ -29,23 +29,23 @@ reactor Destination { reaction(inp) {= let sum = 0; for (let i = 0; i < inp.length; i++) { - const a = inp[i] - if (a !== undefined) { - for (let j = 0; j < a.length; j++) { - sum += a[j]; - } + const a = inp[i] + if (a !== undefined) { + for (let j = 0; j < a.length; j++) { + sum += a[j]; } + } } console.log("Sum of received: " + sum); if (sum != s) { - util.requestErrorStop("ERROR: Expected " + s); + util.requestErrorStop("ERROR: Expected " + s); } s += 36; =} reaction(shutdown) {= if (s <= 15) { - util.requestErrorStop("ERROR: Destination received no input!"); + util.requestErrorStop("ERROR: Destination received no input!"); } console.log("Success."); =} diff --git a/test/TypeScript/src/multiport/MultiportToMultiportParameter.lf b/test/TypeScript/src/multiport/MultiportToMultiportParameter.lf index e0da646acc..6128888199 100644 --- a/test/TypeScript/src/multiport/MultiportToMultiportParameter.lf +++ b/test/TypeScript/src/multiport/MultiportToMultiportParameter.lf @@ -10,7 +10,7 @@ reactor Source(width: number = 1) { reaction(t) -> out {= for (let i = 0; i < out.length; i++) { - out[i] = s++; + out[i] = s++; } =} } @@ -22,25 +22,25 @@ reactor Destination(width: number = 1) { reaction(inp) {= let sum = 0; for (let i = 0; i < inp.length; i++) { - if (inp[i] !== undefined) sum += (inp[i] as number); + if (inp[i] !== undefined) sum += (inp[i] as number); } console.log("Sum of received: " + sum + ".", ); if (sum != s) { - util.requestErrorStop("ERROR: Expected " + s + "."); + util.requestErrorStop("ERROR: Expected " + s + "."); } s += 16; =} reaction(shutdown) {= if (s <= 6) { - util.reportError("ERROR: Destination received no input!"); + util.reportError("ERROR: Destination received no input!"); } console.log("Success."); =} } main reactor(width: number = 4) { - a = new Source(width = width) - b = new Destination(width = width) + a = new Source(width=width) + b = new Destination(width=width) a.out -> b.inp } diff --git a/test/TypeScript/src/multiport/MultiportToPort.lf b/test/TypeScript/src/multiport/MultiportToPort.lf index 17ff6ce9bd..4bf049fb21 100644 --- a/test/TypeScript/src/multiport/MultiportToPort.lf +++ b/test/TypeScript/src/multiport/MultiportToPort.lf @@ -8,8 +8,8 @@ reactor Source { reaction(startup) -> out {= for(let i = 0; i < out.length; i++) { - console.log("Source sending " + i); - out[i] = i; + console.log("Source sending " + i); + out[i] = i; } =} } @@ -22,13 +22,13 @@ reactor Destination(expected: number = 0) { console.log("Received " + inp); received = true; if (inp != expected) { - util.requestErrorStop("FAILURE: Expected " + expected); + util.requestErrorStop("FAILURE: Expected " + expected); } =} reaction(shutdown) {= if (!received) { - util.requestErrorStop("ERROR: Destination received no input!"); + util.requestErrorStop("ERROR: Destination received no input!"); } console.log("Success."); =} @@ -37,6 +37,6 @@ reactor Destination(expected: number = 0) { main reactor MultiportToPort { a = new Source() b1 = new Destination() - b2 = new Destination(expected = 1) + b2 = new Destination(expected=1) a.out -> b1.inp, b2.inp } diff --git a/test/TypeScript/src/multiport/MultiportToReaction.lf b/test/TypeScript/src/multiport/MultiportToReaction.lf index 824e605124..e5ba5eda17 100644 --- a/test/TypeScript/src/multiport/MultiportToReaction.lf +++ b/test/TypeScript/src/multiport/MultiportToReaction.lf @@ -11,31 +11,31 @@ reactor Source(width: number = 1) { reaction(t) -> out {= console.log("Sending."); for (let i = 0; i < out.length; i++) { - out[i] = s++; + out[i] = s++; } =} } main reactor MultiportToReaction { state s: number = 6 - b = new Source(width = 4) + b = new Source(width=4) reaction(b.out) {= let sum = 0; for (let i = 0; i < b.out.length; i++) { - let val = b.out[i] - if (val !== undefined) sum += val; + let val = b.out[i] + if (val !== undefined) sum += val; } console.log("Sum of received: " + sum + "."); if (sum != s) { - util.requestErrorStop("ERROR: Expected " + s + "."); + util.requestErrorStop("ERROR: Expected " + s + "."); } s += 16; =} reaction(shutdown) {= if (s <= 6) { - util.reportError("ERROR: Destination received no input!"); + util.reportError("ERROR: Destination received no input!"); } console.log("Success."); =} diff --git a/test/TypeScript/src/multiport/NestedBanks.lf b/test/TypeScript/src/multiport/NestedBanks.lf index 2fc1a9f3e5..d84b5245e8 100644 --- a/test/TypeScript/src/multiport/NestedBanks.lf +++ b/test/TypeScript/src/multiport/NestedBanks.lf @@ -42,10 +42,10 @@ reactor D { reaction(u) {= for (let i = 0; i < u.length; i++) { - console.log("d.u[" + i + "] received " + u[i] + "."); - if (u[i] != 6 + i) { - util.requestErrorStop("Expected " + (6 + i) + " but received " + u[i] + "."); - } + console.log("d.u[" + i + "] received " + u[i] + "."); + if (u[i] != 6 + i) { + util.requestErrorStop("Expected " + (6 + i) + " but received " + u[i] + "."); + } } =} } @@ -55,7 +55,7 @@ reactor E { reaction(t) {= for (let i = 0; i < t.length; i++) { - console.log("e.t[" + i + "] received " + t[i] + "."); + console.log("e.t[" + i + "] received " + t[i] + "."); } =} } @@ -66,7 +66,7 @@ reactor F(cBankIndex: number = 0) { reaction(w) {= console.log("c[" + cBankIndex + "].f.w received " + w + "."); if (w != cBankIndex * 2) { - util.requestErrorStop("Expected " + cBankIndex * 2 + " but received " + w + "."); + util.requestErrorStop("Expected " + cBankIndex * 2 + " but received " + w + "."); } =} } @@ -77,7 +77,7 @@ reactor G(cBankIndex: number = 0) { reaction(s) {= console.log("c[" + cBankIndex + "].g.s received " + s + "."); if (s != cBankIndex * 2 + 1) { - util.requestErrorStop("Expected " + (cBankIndex * 2 + 1) + " but received " + s + "."); + util.requestErrorStop("Expected " + (cBankIndex * 2 + 1) + " but received " + s + "."); } =} } diff --git a/test/TypeScript/src/multiport/PipelineAfter.lf b/test/TypeScript/src/multiport/PipelineAfter.lf index 5835193d9c..9db397c0e4 100644 --- a/test/TypeScript/src/multiport/PipelineAfter.lf +++ b/test/TypeScript/src/multiport/PipelineAfter.lf @@ -19,10 +19,10 @@ reactor Sink { reaction(inp) {= console.log("Received " + inp); if (inp != 42) { - util.requestErrorStop("ERROR: expected 42!"); + util.requestErrorStop("ERROR: expected 42!"); } if (!util.getElapsedLogicalTime().isEqualTo(TimeValue.sec(1))) { - util.requestErrorStop("ERROR: Expected to receive input after one second."); + util.requestErrorStop("ERROR: Expected to receive input after one second."); } =} } diff --git a/test/TypeScript/src/multiport/ReactionToContainedBank.lf b/test/TypeScript/src/multiport/ReactionToContainedBank.lf index da06fb7a1f..535e0e2fbc 100644 --- a/test/TypeScript/src/multiport/ReactionToContainedBank.lf +++ b/test/TypeScript/src/multiport/ReactionToContainedBank.lf @@ -9,11 +9,11 @@ main reactor ReactionToContainedBank(width: number = 2) { timer t(0, 100 msec) state count: number = 1 - test = new[width] TestCount(numInputs = 11) + test = new[width] TestCount(numInputs=11) reaction(t) -> test.inp {= for (let i = 0; i < width; i++) { - (test[i].inp as number) = count; + (test[i].inp as number) = count; } count++; =} diff --git a/test/TypeScript/src/multiport/ReactionsToNested.lf b/test/TypeScript/src/multiport/ReactionsToNested.lf index 299ddfc5a1..a6baf12135 100644 --- a/test/TypeScript/src/multiport/ReactionsToNested.lf +++ b/test/TypeScript/src/multiport/ReactionsToNested.lf @@ -11,21 +11,21 @@ reactor T(expected: number = 0) { console.log("T received " + z); received = true; if (z != expected) { - util.requestErrorStop("Expected " + expected); + util.requestErrorStop("Expected " + expected); } =} reaction(shutdown) {= if (!received) { - util.reportError("No input received"); + util.reportError("No input received"); } =} } reactor D { input[2] y: number - t1 = new T(expected = 42) - t2 = new T(expected = 43) + t1 = new T(expected=42) + t2 = new T(expected=43) y -> t1.z, t2.z } diff --git a/test/TypeScript/src/serialization/ProtoNoPacking.lf b/test/TypeScript/src/serialization/ProtoNoPacking.lf index 8e35981c6c..d2cd1ed1cc 100644 --- a/test/TypeScript/src/serialization/ProtoNoPacking.lf +++ b/test/TypeScript/src/serialization/ProtoNoPacking.lf @@ -34,7 +34,7 @@ reactor SinkProto { reaction(x) {= if (x !== undefined) { - console.log(`Received: name=${x.getName()}, number=${x.getNumber()}.`) + console.log(`Received: name=${x.getName()}, number=${x.getNumber()}.`) } =} }