Add not supported complex ternary condition unitest
@@ -26,6 +26,7 @@ import org.junit.Test;
import uk.ac.manchester.tornado.api.TaskSchedule;
import uk.ac.manchester.tornado.api.annotations.Parallel;
+import uk.ac.manchester.tornado.unittests.common.TornadoNotSupported;
import uk.ac.manchester.tornado.unittests.common.TornadoTestBase;
public class TestConditionals extends TornadoTestBase {
@@ -229,4 +230,37 @@ public class TestConditionals extends TornadoTestBase {
assertEquals(10, a[i]);
}
}
+
+ public static void ternaryComplexCondition(int[] a, int[] b) {
+ for (@Parallel int i = 0; i < a.length; i++) {
+ for (int x = 0; x < a.length; x++) {
+ if (i == a.length) {
+ a[x] = (a[x] == 20) ? a[x]+b[x] : 5;
+ }
+ }
+ }
+ }
+
+ @TornadoNotSupported
+ public void testComplexTernaryCondition() {
+
+ final int size = 8192;
+ int[] a = new int[size];
+ int[] b = new int[size];
+
+
+ Arrays.fill(a, 20);
+ Arrays.fill(b, 30);
+
+ //@formatter:off
+ new TaskSchedule("s0")
+ .task("t0", TestConditionals::ternaryComplexCondition, a, b)
+ .streamOut(a)
+ .execute();
+ //formatter:on
+
+ for (int i = 0; i < a.length; i++) {
+ assertEquals(50, a[i]);
+ }
+ }
}
