aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2016-02-12 00:49:22 -0800
committerDavid Gross <dgross@google.com>2016-04-18 15:11:45 -0700
commit3ec26f885f73b4a93652847cb1d9b1e22964c0d3 (patch)
tree6638639bc63804cc877aef5504e418bd4bf84296
parentfe1e7ca3a7db3f62d38d5f824edac97ecdb1393d (diff)
downloadslang-3ec26f885f73b4a93652847cb1d9b1e22964c0d3.tar.gz
Fix reduction halter example.
A recent update to reduction removed the array subrange variant, but this test wasn't updated accordingly. Change-Id: I51e0e649af3d98db71b574c0585c57038ac7707d (cherry picked from commit a8ce784abff97cb632e2ff585bbc502890610fe7)
-rw-r--r--tests/P_reduce_general_examples_halter/ScriptC_reduce_general_examples_halter.java.expect46
1 files changed, 4 insertions, 42 deletions
diff --git a/tests/P_reduce_general_examples_halter/ScriptC_reduce_general_examples_halter.java.expect b/tests/P_reduce_general_examples_halter/ScriptC_reduce_general_examples_halter.java.expect
index d49c116..0d6f8ac 100644
--- a/tests/P_reduce_general_examples_halter/ScriptC_reduce_general_examples_halter.java.expect
+++ b/tests/P_reduce_general_examples_halter/ScriptC_reduce_general_examples_halter.java.expect
@@ -82,28 +82,9 @@ public class ScriptC_reduce_general_examples_halter extends ScriptC {
if (in1 == null) {
throw new RSIllegalArgumentException("Array \"in1\" is null!");
}
-
- return reduce_fz(in1, 0, in1.length);
- }
-
- // reduction only across cells at x1 <= coord < x2
- // in1 = "inVal"
- public result_int reduce_fz(int[] in1, int x1, int x2) {
- // Bounds-check x1 and x2
- if (x1 < 0 || x1 >= x2) {
- throw new RSRuntimeException("Input bounds are invalid!");
- }
- // Verify that "in1" is non-null.
- if (in1 == null) {
- throw new RSIllegalArgumentException("Array \"in1\" is null!");
- }
- // Bounds-check "in1" against x2
- if (x2 > in1.length) {
- throw new RSRuntimeException("Input bound is invalid for parameter \"in1\"!");
- }
- Allocation ain1 = Allocation.createSized(mRSLocal, __I32, x2 - x1);
+ Allocation ain1 = Allocation.createSized(mRSLocal, __I32, in1.length);
ain1.setAutoPadding(true);
- ain1.copy1DRangeFrom(x1, x2 - x1, in1);
+ ain1.copyFrom(in1);
return reduce_fz(ain1, null);
}
@@ -132,28 +113,9 @@ public class ScriptC_reduce_general_examples_halter extends ScriptC {
if (in1 == null) {
throw new RSIllegalArgumentException("Array \"in1\" is null!");
}
-
- return reduce_fz2(in1, 0, in1.length);
- }
-
- // reduction only across cells at x1 <= coord < x2
- // in1 = "inVal"
- public result_int2 reduce_fz2(int[] in1, int x1, int x2) {
- // Bounds-check x1 and x2
- if (x1 < 0 || x1 >= x2) {
- throw new RSRuntimeException("Input bounds are invalid!");
- }
- // Verify that "in1" is non-null.
- if (in1 == null) {
- throw new RSIllegalArgumentException("Array \"in1\" is null!");
- }
- // Bounds-check "in1" against x2
- if (x2 > in1.length) {
- throw new RSRuntimeException("Input bound is invalid for parameter \"in1\"!");
- }
- Allocation ain1 = Allocation.createSized(mRSLocal, __I32, x2 - x1);
+ Allocation ain1 = Allocation.createSized(mRSLocal, __I32, in1.length);
ain1.setAutoPadding(true);
- ain1.copy1DRangeFrom(x1, x2 - x1, in1);
+ ain1.copyFrom(in1);
return reduce_fz2(ain1, null);
}