test for symbolic substitution added
@@ -29,6 +29,7 @@ import static org.junit.Assert.assertEquals;
import java.util.Arrays;
+import org.graalvm.compiler.nodes.StructuredGraph;
import org.junit.Ignore;
import org.junit.Test;
@@ -44,6 +45,12 @@ public class TestLoops extends TornadoTestBase {
}
}
+ public static void forLoop2(int[] a) {
+ for (@Parallel int i = 0; i < a.length; i++) {
+ a[i] = (i + 1) + 1;
+ }
+ }
+
@Test
public void testForLoopOneD() {
final int size = 10;
@@ -64,6 +71,26 @@ public class TestLoops extends TornadoTestBase {
}
}
+ @Test
+ public void testForSymbolicSubstitution() {
+ final int size = 10;
+
+ int[] a = new int[size];
+
+ Arrays.fill(a, 1);
+
+ //@formatter:off
+ new TaskSchedule("s0")
+ .task("t0", TestLoops::forLoop2, a)
+ .streamOut(a)
+ .execute();
+ //@formatter:on
+
+ for (int i = 0; i < a.length; i++) {
+ assertEquals(i + 2, a[i]);
+ }
+ }
+
public static void reverseLoop(int[] a) {
for (@Parallel int i = a.length - 1; i >= 0; i--) {
a[i] = 10;
