Skip to content

Commit

Permalink
[tests] Whitespace only.
Browse files Browse the repository at this point in the history
  • Loading branch information
petervdonovan committed May 19, 2022
1 parent 1b5dbd2 commit 8d4d047
Show file tree
Hide file tree
Showing 143 changed files with 1,600 additions and 1,605 deletions.
8 changes: 4 additions & 4 deletions test/C/src/ActionDelay.lf
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@ reactor Source {
=}
}
reactor Sink {
input in:int;
reaction(in) {=
input in:int;
reaction(in) {=
interval_t elapsed_logical = lf_time_logical_elapsed();
interval_t logical = lf_time_logical();
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);
printf("FAILURE: Expected %lld but got %lld.\n", MSEC(100), elapsed_logical);
exit(1);
} else {
printf("SUCCESS. Elapsed logical time is 100 msec.\n");
}
=}
=}
}

main reactor ActionDelay {
Expand Down
54 changes: 27 additions & 27 deletions test/C/src/Composition.lf
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@ target C {
timeout: 10 sec
};
reactor Source(period:time(2 sec)) {
output y:int;
timer t(1 sec, period);
state count:int(0);
reaction(t) -> y {=
(self->count)++;
printf("Source sending %d.\n", self->count);
lf_set(y, self->count);
=}
output y:int;
timer t(1 sec, period);
state count:int(0);
reaction(t) -> y {=
(self->count)++;
printf("Source sending %d.\n", self->count);
lf_set(y, self->count);
=}
}

reactor Test {
input x:int;
state count:int(0);
reaction(x) {=
(self->count)++;
printf("Received %d\n", x->value);
if (x->value != self->count) {
fprintf(stderr, "FAILURE: Expected %d\n", self->count);
exit(1);
}
=}
reaction(shutdown) {=
if (self->count == 0) {
fprintf(stderr, "FAILURE: No data received.\n");
}
=}
input x:int;
state count:int(0);
reaction(x) {=
(self->count)++;
printf("Received %d\n", x->value);
if (x->value != self->count) {
fprintf(stderr, "FAILURE: Expected %d\n", self->count);
exit(1);
}
=}
reaction(shutdown) {=
if (self->count == 0) {
fprintf(stderr, "FAILURE: No data received.\n");
}
=}
}
main reactor Composition {
s = new Source();
d = new Test();
s.y -> d.x;
s = new Source();
d = new Test();
s.y -> d.x;
}

This comment has been minimized.

Copy link
@lhstrh

lhstrh May 19, 2022

Member

You might want to fix these missing newlines too, now that you're at it!

44 changes: 22 additions & 22 deletions test/C/src/CompositionAfter.lf
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
// This test connects a simple counting source to tester
// that checks against its own count.
target C {
fast: true,
timeout: 10 sec
fast: true,
timeout: 10 sec
};

reactor Source(period:time(2 sec)) {
output y:int;
timer t(1 sec, period);
state count:int(0);
reaction(t) -> y {=
(self->count)++;
lf_set(y, self->count);
=}
output y:int;
timer t(1 sec, period);
state count:int(0);
reaction(t) -> y {=
(self->count)++;
lf_set(y, self->count);
=}
}

reactor Test {
input x:int;
state count:int(0);
reaction(x) {=
(self->count)++;
printf("Received %d\n", x->value);
if (x->value != self->count) {
printf("FAILURE: Expected %d\n", self->count);
exit(1);
}
=}
input x:int;
state count:int(0);
reaction(x) {=
(self->count)++;
printf("Received %d\n", x->value);
if (x->value != self->count) {
printf("FAILURE: Expected %d\n", self->count);
exit(1);
}
=}
}

main reactor CompositionAfter(delay:time(5 sec)) {
s = new Source();
d = new Test();
s.y -> d.x after delay;
s = new Source();
d = new Test();
s.y -> d.x after delay;
}
66 changes: 33 additions & 33 deletions test/C/src/CompositionInheritance.lf
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,45 @@ target C {
};
reactor Source(period:time(2 sec)) {
input foo:int;
output y:int;
timer t(1 sec, period);
state count:int(0);
reaction(t) -> y {=
printf("Hello World. At time %lld, my count is: %d.\n", lf_time_logical_elapsed(), self->count);
lf_set(y, self->count);
=}
output y:int;
timer t(1 sec, period);
state count:int(0);
reaction(t) -> y {=
printf("Hello World. At time %lld, my count is: %d.\n", lf_time_logical_elapsed(), self->count);
lf_set(y, self->count);
=}
}

reactor SourceExtended extends Source {
output y2: int;
timer t2(1 sec, 3 sec);
reaction(t2) -> y2 {=
(self->count)++;
printf("At time %lld, source sending %d.\n", lf_time_logical_elapsed(), self->count);
lf_set(y2, self->count);
=}
output y2: int;
timer t2(1 sec, 3 sec);
reaction(t2) -> y2 {=
(self->count)++;
printf("At time %lld, source sending %d.\n", lf_time_logical_elapsed(), self->count);
lf_set(y2, self->count);
=}
}

reactor Test {
input x:int;
state count:int(0);
reaction(x) {=
(self->count)++;
printf("Received %d\n", x->value);
if (x->value != self->count) {
fprintf(stderr, "FAILURE: Expected %d\n", self->count);
exit(1);
}
=}
reaction(shutdown) {=
if (self->count == 0) {
fprintf(stderr, "FAILURE: No data received.\n");
}
=}
input x:int;
state count:int(0);
reaction(x) {=
(self->count)++;
printf("Received %d\n", x->value);
if (x->value != self->count) {
fprintf(stderr, "FAILURE: Expected %d\n", self->count);
exit(1);
}
=}
reaction(shutdown) {=
if (self->count == 0) {
fprintf(stderr, "FAILURE: No data received.\n");
}
=}
}
main reactor CompositionInheritance {
s = new SourceExtended(period = 2 sec);
d = new Test();
s.y2 -> d.x;
s = new SourceExtended(period = 2 sec);
d = new Test();
s.y2 -> d.x;
}
2 changes: 1 addition & 1 deletion test/C/src/DelayStructWithAfter.lf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
target C {files: include/hello.h};

preamble {=
#include "hello.h"
#include "hello.h"
=}

reactor Source {
Expand Down
8 changes: 4 additions & 4 deletions test/C/src/DelayedReaction.lf
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ reactor Source {
=}
}
reactor Sink {
input in:int;
reaction(in) {=
input in:int;
reaction(in) {=
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);
}
=}
}
=}
}
main reactor DelayedReaction {

Expand Down
60 changes: 30 additions & 30 deletions test/C/src/DoubleReaction.lf
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@ target C {
fast: true
};
reactor Clock(offset:time(0), period:time(1 sec)) {
output y:int;
timer t(offset, period);
state count:int(0);
reaction(t) -> y {=
(self->count)++;
lf_set(y, self->count);
=}
output y:int;
timer t(offset, period);
state count:int(0);
reaction(t) -> y {=
(self->count)++;
lf_set(y, self->count);
=}
}

reactor Destination {
input x:int;
input w:int;
state s:int(2);
reaction(x, w) {=
int sum = 0;
if (x->is_present) {
sum += x->value;
}
if (w->is_present) {
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);
}
self->s += 2;
=}
input x:int;
input w:int;
state s:int(2);
reaction(x, w) {=
int sum = 0;
if (x->is_present) {
sum += x->value;
}
if (w->is_present) {
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);
}
self->s += 2;
=}
}
main reactor DoubleReaction {
c1 = new Clock();
c2 = new Clock();
d = new Destination();
c1.y -> d.x;
c2.y -> d.w;
c1 = new Clock();
c2 = new Clock();
d = new Destination();
c1.y -> d.x;
c2.y -> d.w;
}
10 changes: 5 additions & 5 deletions test/C/src/DoubleTrigger.lf
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ target C {
fast: true
};
main reactor DoubleTrigger {
timer t1;
timer t2;
state s:int(0);
reaction(t1, t2) {=
timer t1;
timer t2;
state s:int(0);
reaction(t1, t2) {=
self->s++;
if (self->s > 1) {
printf("FAILURE: Reaction got triggered twice.\n");
Expand All @@ -17,7 +17,7 @@ main reactor DoubleTrigger {
=}
reaction(shutdown) {=
if (self->s == 1) {
printf("SUCCESS.\n");
printf("SUCCESS.\n");
} else {
printf("FAILURE: Reaction was never triggered.\n");
exit(1);
Expand Down
Loading

0 comments on commit 8d4d047

Please sign in to comment.