Skip to content

Commit 3a22432

Browse files
committed
Issue #20 - Updated for statement test.
1 parent 4eb2ef4 commit 3a22432

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

org.modeldriven.alf/tests-x/Statements_For_Looping.alf

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ class Statements_For_Looping specializes Test {
1010
@Create public run(in tester: Tester[0..1]) {
1111
super(tester);
1212

13-
this.test(readings, sum, outgoingEdges, SnEven, SnOdd);
13+
this.test(readings, sum, outgoingEdges, SnEven, SnOdd, testReturn);
1414

1515
AssertList("readings", readings, Integer[]{1,2});
1616
AssertEqual("sum", sum, 55);
1717
AssertList("outgoingEdges.token", outgoingEdges.token, Integer[]{2,4});
1818
AssertList("SnEven", SnEven, Integer[]{5,7,9});
1919
AssertList("SnOdd", SnOdd, Integer[]{30,60,90});
20+
AssertTrue("testReturn", testReturn);
2021

2122
this.done();
2223
}
@@ -39,12 +40,26 @@ class Statements_For_Looping specializes Test {
3940

4041
private activity processRecord(in index: Integer) { }
4142

43+
// Test that the for loop is mapped as a loop node,
44+
// not an expansion region, if it contains a return.
45+
private activity TestReturn() : Boolean {
46+
for (x in Integer[]{1,2}) {
47+
if (false) {
48+
for (y in 1) {
49+
return false;
50+
}
51+
}
52+
}
53+
return true;
54+
}
55+
4256
//**************************************************************************
4357

4458
public test(
4559
out readings: Integer[*], out sum1: Integer,
4660
out outgoingEdges: ActivityEdgeInstance[*],
47-
out SnEven: Integer[*], out SnOdd: Integer[*]) {
61+
out SnEven: Integer[*], out SnOdd: Integer[*],
62+
out testReturn: Boolean) {
4863

4964
// Setup
5065
noiseLimit = 0;
@@ -95,5 +110,7 @@ class Statements_For_Looping specializes Test {
95110
}
96111
}
97112

113+
testReturn = TestReturn();
114+
98115
}
99116
}

0 commit comments

Comments
 (0)