summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2012-07-20 15:52:42 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-07-20 15:52:42 -0700
commitb10f455e4494de687634aed1e24fc8f7edff427a (patch)
tree026b1620cc03413336e2f35032513211746da751 /tests
parent55b9e59b845f65c80ff007813f4d278973e73764 (diff)
parent5666d8f4fb6ddb33394d40f0d35a778a3b7cdbc7 (diff)
downloadframeworks_base-b10f455e4494de687634aed1e24fc8f7edff427a.zip
frameworks_base-b10f455e4494de687634aed1e24fc8f7edff427a.tar.gz
frameworks_base-b10f455e4494de687634aed1e24fc8f7edff427a.tar.bz2
Merge "Updated math_agree test"
Diffstat (limited to 'tests')
-rw-r--r--tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java495
-rw-r--r--tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs401
2 files changed, 872 insertions, 24 deletions
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java
index 32a4bd7..9d94ba5 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_math_agree.java
@@ -19,19 +19,267 @@ package com.android.rs.test;
import android.content.Context;
import android.content.res.Resources;
import android.renderscript.*;
+import android.util.Log;
+import java.util.Arrays;
import java.util.Random;
public class UT_math_agree extends UnitTest {
private Resources mRes;
+ private Random rand;
protected UT_math_agree(RSTestCore rstc, Resources res, Context ctx) {
super(rstc, "Math Agreement", ctx);
mRes = res;
+ rand = new Random();
}
- private void initializeValues(ScriptC_math_agree s) {
- Random rand = new Random();
+ // packing functions
+ private Float2 pack_f2(float[] val) {
+ assert val.length == 2;
+ return new Float2(val[0], val[1]);
+ }
+ private Float3 pack_f3(float[] val) {
+ assert val.length == 3;
+ return new Float3(val[0], val[1], val[2]);
+ }
+ private Float4 pack_f4(float[] val) {
+ assert val.length == 4;
+ return new Float4(val[0], val[1], val[2], val[3]);
+ }
+ private Byte2 pack_b2(byte[] val) {
+ assert val.length == 2;
+ return new Byte2(val[0], val[1]);
+ }
+ private Byte3 pack_b3(byte[] val) {
+ assert val.length == 3;
+ return new Byte3(val[0], val[1], val[2]);
+ }
+ private Byte4 pack_b4(byte[] val) {
+ assert val.length == 4;
+ return new Byte4(val[0], val[1], val[2], val[3]);
+ }
+ private Short2 pack_s2(short[] val) {
+ assert val.length == 2;
+ return new Short2(val[0], val[1]);
+ }
+ private Short3 pack_s3(short[] val) {
+ assert val.length == 3;
+ return new Short3(val[0], val[1], val[2]);
+ }
+ private Short4 pack_s4(short[] val) {
+ assert val.length == 4;
+ return new Short4(val[0], val[1], val[2], val[3]);
+ }
+ private Int2 pack_i2(int[] val) {
+ assert val.length == 2;
+ return new Int2(val[0], val[1]);
+ }
+ private Int3 pack_i3(int[] val) {
+ assert val.length == 3;
+ return new Int3(val[0], val[1], val[2]);
+ }
+ private Int4 pack_i4(int[] val) {
+ assert val.length == 4;
+ return new Int4(val[0], val[1], val[2], val[3]);
+ }
+ private Long2 pack_l2(long[] val) {
+ assert val.length == 2;
+ return new Long2(val[0], val[1]);
+ }
+ private Long3 pack_l3(long[] val) {
+ assert val.length == 3;
+ return new Long3(val[0], val[1], val[2]);
+ }
+ private Long4 pack_l4(long[] val) {
+ assert val.length == 4;
+ return new Long4(val[0], val[1], val[2], val[3]);
+ }
+
+ // random vector generation functions
+ private float[] randvec_float(int dim) {
+ float[] fv = new float[dim];
+ for (int i = 0; i < dim; ++i)
+ fv[i] = rand.nextFloat();
+ return fv;
+ }
+ private byte[] randvec_char(int dim) {
+ byte[] cv = new byte[dim];
+ rand.nextBytes(cv);
+ return cv;
+ }
+ private short[] randvec_uchar(int dim) {
+ short[] ucv = new short[dim];
+ for (int i = 0; i < dim; ++i)
+ ucv[i] = (short)rand.nextInt(0x1 << 8);
+ return ucv;
+ }
+ private short[] randvec_short(int dim) {
+ short[] sv = new short[dim];
+ for (int i = 0; i < dim; ++i)
+ sv[i] = (short)rand.nextInt(0x1 << 16);
+ return sv;
+ }
+ private int[] randvec_ushort(int dim) {
+ int[] usv = new int[dim];
+ for (int i = 0; i < dim; ++i)
+ usv[i] = rand.nextInt(0x1 << 16);
+ return usv;
+ }
+ private int[] randvec_int(int dim) {
+ int[] iv = new int[dim];
+ for (int i = 0; i < dim; ++i)
+ iv[i] = rand.nextInt();
+ return iv;
+ }
+ private long[] randvec_uint(int dim) {
+ long[] uiv = new long[dim];
+ for (int i = 0; i < dim; ++i)
+ uiv[i] = (long)rand.nextInt() - (long)Integer.MIN_VALUE;
+ return uiv;
+ }
+ private long[] randvec_long(int dim) {
+ long[] lv = new long[dim];
+ for (int i = 0; i < dim; ++i)
+ lv[i] = rand.nextLong();
+ return lv;
+ }
+ // TODO: unsigned long generator
+
+ // min reference functions
+ private float min(float v1, float v2) {
+ return v1 < v2 ? v1 : v2;
+ }
+ private float[] min(float[] v1, float[] v2) {
+ assert v1.length == v2.length;
+ float[] rv = new float[v1.length];
+ for (int i = 0; i < v1.length; ++i)
+ rv[i] = min(v1[i], v2[i]);
+ return rv;
+ }
+ private byte min(byte v1, byte v2) {
+ return v1 < v2 ? v1 : v2;
+ }
+ private byte[] min(byte[] v1, byte[] v2) {
+ assert v1.length == v2.length;
+ byte[] rv = new byte[v1.length];
+ for (int i = 0; i < v1.length; ++i)
+ rv[i] = min(v1[i], v2[i]);
+ return rv;
+ }
+ private short min(short v1, short v2) {
+ return v1 < v2 ? v1 : v2;
+ }
+ private short[] min(short[] v1, short[] v2) {
+ assert v1.length == v2.length;
+ short[] rv = new short[v1.length];
+ for (int i = 0; i < v1.length; ++i)
+ rv[i] = min(v1[i], v2[i]);
+ return rv;
+ }
+ private int min(int v1, int v2) {
+ return v1 < v2 ? v1 : v2;
+ }
+ private int[] min(int[] v1, int[] v2) {
+ assert v1.length == v2.length;
+ int[] rv = new int[v1.length];
+ for (int i = 0; i < v1.length; ++i)
+ rv[i] = min(v1[i], v2[i]);
+ return rv;
+ }
+ private long min(long v1, long v2) {
+ return v1 < v2 ? v1 : v2;
+ }
+ private long[] min(long[] v1, long[] v2) {
+ assert v1.length == v2.length;
+ long[] rv = new long[v1.length];
+ for (int i = 0; i < v1.length; ++i)
+ rv[i] = min(v1[i], v2[i]);
+ return rv;
+ }
+ // TODO: unsigned long version of min
+
+ // max reference functions
+ private float max(float v1, float v2) {
+ return v1 > v2 ? v1 : v2;
+ }
+ private float[] max(float[] v1, float[] v2) {
+ assert v1.length == v2.length;
+ float[] rv = new float[v1.length];
+ for (int i = 0; i < v1.length; ++i)
+ rv[i] = max(v1[i], v2[i]);
+ return rv;
+ }
+ private byte max(byte v1, byte v2) {
+ return v1 > v2 ? v1 : v2;
+ }
+ private byte[] max(byte[] v1, byte[] v2) {
+ assert v1.length == v2.length;
+ byte[] rv = new byte[v1.length];
+ for (int i = 0; i < v1.length; ++i)
+ rv[i] = max(v1[i], v2[i]);
+ return rv;
+ }
+ private short max(short v1, short v2) {
+ return v1 > v2 ? v1 : v2;
+ }
+ private short[] max(short[] v1, short[] v2) {
+ assert v1.length == v2.length;
+ short[] rv = new short[v1.length];
+ for (int i = 0; i < v1.length; ++i)
+ rv[i] = max(v1[i], v2[i]);
+ return rv;
+ }
+ private int max(int v1, int v2) {
+ return v1 > v2 ? v1 : v2;
+ }
+ private int[] max(int[] v1, int[] v2) {
+ assert v1.length == v2.length;
+ int[] rv = new int[v1.length];
+ for (int i = 0; i < v1.length; ++i)
+ rv[i] = max(v1[i], v2[i]);
+ return rv;
+ }
+ private long max(long v1, long v2) {
+ return v1 > v2 ? v1 : v2;
+ }
+ private long[] max(long[] v1, long[] v2) {
+ assert v1.length == v2.length;
+ long[] rv = new long[v1.length];
+ for (int i = 0; i < v1.length; ++i)
+ rv[i] = max(v1[i], v2[i]);
+ return rv;
+ }
+ // TODO: unsigned long version of max
+ // fmin reference functions
+ private float fmin(float v1, float v2) {
+ return min(v1, v2);
+ }
+ private float[] fmin(float[] v1, float[] v2) {
+ return min(v1, v2);
+ }
+ private float[] fmin(float[] v1, float v2) {
+ float[] rv = new float[v1.length];
+ for (int i = 0; i < v1.length; ++i)
+ rv[i] = min(v1[i], v2);
+ return rv;
+ }
+
+ // fmax reference functions
+ private float fmax(float v1, float v2) {
+ return max(v1, v2);
+ }
+ private float[] fmax(float[] v1, float[] v2) {
+ return max(v1, v2);
+ }
+ private float[] fmax(float[] v1, float v2) {
+ float[] rv = new float[v1.length];
+ for (int i = 0; i < v1.length; ++i)
+ rv[i] = max(v1[i], v2);
+ return rv;
+ }
+
+ private void initializeValues(ScriptC_math_agree s) {
float x = rand.nextFloat();
float y = rand.nextFloat();
@@ -41,6 +289,249 @@ public class UT_math_agree extends UnitTest {
s.set_result_sub(x - y);
s.set_result_mul(x * y);
s.set_result_div(x / y);
+
+ // Generate random vectors of all types
+ float rand_f1_0 = rand.nextFloat();
+ float[] rand_f2_0 = randvec_float(2);
+ float[] rand_f3_0 = randvec_float(3);
+ float[] rand_f4_0 = randvec_float(4);
+ float rand_f1_1 = rand.nextFloat();
+ float[] rand_f2_1 = randvec_float(2);
+ float[] rand_f3_1 = randvec_float(3);
+ float[] rand_f4_1 = randvec_float(4);
+ byte rand_sc1_0 = (byte)rand.nextInt(0x1 << 8);
+ byte[] rand_sc2_0 = randvec_char(2);
+ byte[] rand_sc3_0 = randvec_char(3);
+ byte[] rand_sc4_0 = randvec_char(4);
+ byte rand_sc1_1 = (byte)rand.nextInt(0x1 << 8);
+ byte[] rand_sc2_1 = randvec_char(2);
+ byte[] rand_sc3_1 = randvec_char(3);
+ byte[] rand_sc4_1 = randvec_char(4);
+ short rand_ss1_0 = (short)rand.nextInt(0x1 << 16);
+ short[] rand_ss2_0 = randvec_short(2);
+ short[] rand_ss3_0 = randvec_short(3);
+ short[] rand_ss4_0 = randvec_short(4);
+ short rand_ss1_1 = (short)rand.nextInt(0x1 << 16);
+ short[] rand_ss2_1 = randvec_short(2);
+ short[] rand_ss3_1 = randvec_short(3);
+ short[] rand_ss4_1 = randvec_short(4);
+ int rand_si1_0 = rand.nextInt();
+ int[] rand_si2_0 = randvec_int(2);
+ int[] rand_si3_0 = randvec_int(3);
+ int[] rand_si4_0 = randvec_int(4);
+ int rand_si1_1 = rand.nextInt();
+ int[] rand_si2_1 = randvec_int(2);
+ int[] rand_si3_1 = randvec_int(3);
+ int[] rand_si4_1 = randvec_int(4);
+ long rand_sl1_0 = rand.nextLong();
+ long[] rand_sl2_0 = randvec_long(2);
+ long[] rand_sl3_0 = randvec_long(3);
+ long[] rand_sl4_0 = randvec_long(4);
+ long rand_sl1_1 = rand.nextLong();
+ long[] rand_sl2_1 = randvec_long(2);
+ long[] rand_sl3_1 = randvec_long(3);
+ long[] rand_sl4_1 = randvec_long(4);
+ // FIXME: generate unsigned input vectors once bug 6764163 is fixed
+ /*
+ short rand_uc1_0 = (short)rand.nextInt(0x1 << 8);
+ short[] rand_uc2_0 = randvec_uchar(2);
+ short[] rand_uc3_0 = randvec_uchar(3);
+ short[] rand_uc4_0 = randvec_uchar(4);
+ short rand_uc1_1 = (short)rand.nextInt(0x1 << 8);
+ short[] rand_uc2_1 = randvec_uchar(2);
+ short[] rand_uc3_1 = randvec_uchar(3);
+ short[] rand_uc4_1 = randvec_uchar(4);
+ int rand_us1_0 = rand.nextInt(0x1 << 16);
+ int[] rand_us2_0 = randvec_ushort(2);
+ int[] rand_us3_0 = randvec_ushort(3);
+ int[] rand_us4_0 = randvec_ushort(4);
+ int rand_us1_1 = rand.nextInt(0x1 << 16);
+ int[] rand_us2_1 = randvec_ushort(2);
+ int[] rand_us3_1 = randvec_ushort(3);
+ int[] rand_us4_1 = randvec_ushort(4);
+ long rand_ui1_0 = (long)rand.nextInt() - (long)Integer.MIN_VALUE;
+ long[] rand_ui2_0 = randvec_uint(2);
+ long[] rand_ui3_0 = randvec_uint(3);
+ long[] rand_ui4_0 = randvec_uint(4);
+ long rand_ui1_1 = (long)rand.nextInt() - (long)Integer.MIN_VALUE;
+ long[] rand_ui2_1 = randvec_uint(2);
+ long[] rand_ui3_1 = randvec_uint(3);
+ long[] rand_ui4_1 = randvec_uint(4);
+ */
+ // TODO: generate unsigned long vectors
+
+ // Set random vectors in renderscript code
+ s.set_rand_f1_0(rand_f1_0);
+ s.set_rand_f2_0(pack_f2(rand_f2_0));
+ s.set_rand_f3_0(pack_f3(rand_f3_0));
+ s.set_rand_f4_0(pack_f4(rand_f4_0));
+ s.set_rand_f1_1(rand_f1_1);
+ s.set_rand_f2_1(pack_f2(rand_f2_1));
+ s.set_rand_f3_1(pack_f3(rand_f3_1));
+ s.set_rand_f4_1(pack_f4(rand_f4_1));
+ s.set_rand_sc1_1(rand_sc1_1);
+ s.set_rand_sc2_1(pack_b2(rand_sc2_1));
+ s.set_rand_sc3_1(pack_b3(rand_sc3_1));
+ s.set_rand_sc4_1(pack_b4(rand_sc4_1));
+ s.set_rand_ss1_0(rand_ss1_0);
+ s.set_rand_ss2_0(pack_s2(rand_ss2_0));
+ s.set_rand_ss3_0(pack_s3(rand_ss3_0));
+ s.set_rand_ss4_0(pack_s4(rand_ss4_0));
+ s.set_rand_ss1_1(rand_ss1_1);
+ s.set_rand_ss2_1(pack_s2(rand_ss2_1));
+ s.set_rand_ss3_1(pack_s3(rand_ss3_1));
+ s.set_rand_ss4_1(pack_s4(rand_ss4_1));
+ s.set_rand_si1_0(rand_si1_0);
+ s.set_rand_si2_0(pack_i2(rand_si2_0));
+ s.set_rand_si3_0(pack_i3(rand_si3_0));
+ s.set_rand_si4_0(pack_i4(rand_si4_0));
+ s.set_rand_si1_1(rand_si1_1);
+ s.set_rand_si2_1(pack_i2(rand_si2_1));
+ s.set_rand_si3_1(pack_i3(rand_si3_1));
+ s.set_rand_si4_1(pack_i4(rand_si4_1));
+ s.set_rand_sl1_0(rand_sl1_0);
+ s.set_rand_sl2_0(pack_l2(rand_sl2_0));
+ s.set_rand_sl3_0(pack_l3(rand_sl3_0));
+ s.set_rand_sl4_0(pack_l4(rand_sl4_0));
+ s.set_rand_sl1_1(rand_sl1_1);
+ s.set_rand_sl2_1(pack_l2(rand_sl2_1));
+ s.set_rand_sl3_1(pack_l3(rand_sl3_1));
+ s.set_rand_sl4_1(pack_l4(rand_sl4_1));
+ // FIXME: set signed char input vectors once bug is fixed
+ /*
+ s.set_rand_sc1_0(rand_sc1_0);
+ s.set_rand_sc2_0(pack_b2(rand_sc2_0));
+ s.set_rand_sc3_0(pack_b3(rand_sc3_0));
+ s.set_rand_sc4_0(pack_b4(rand_sc4_0));
+ */
+ // FIXME: set unsigned input vectors once bug 6764163 is fixed
+ /*
+ s.set_rand_us1_0(rand_us1_0);
+ s.set_rand_us2_0(pack_i2(rand_us2_0));
+ s.set_rand_us3_0(pack_i3(rand_us3_0));
+ s.set_rand_us4_0(pack_i4(rand_us4_0));
+ s.set_rand_us1_1(rand_us1_1);
+ s.set_rand_us2_1(pack_i2(rand_us2_1));
+ s.set_rand_us3_1(pack_i3(rand_us3_1));
+ s.set_rand_us4_1(pack_i4(rand_us4_1));
+ s.set_rand_uc1_0(rand_uc1_0);
+ s.set_rand_uc2_0(pack_s2(rand_uc2_0));
+ s.set_rand_uc3_0(pack_s3(rand_uc3_0));
+ s.set_rand_uc4_0(pack_s4(rand_uc4_0));
+ s.set_rand_uc1_1(rand_uc1_1);
+ s.set_rand_uc2_1(pack_s2(rand_uc2_1));
+ s.set_rand_uc3_1(pack_s3(rand_uc3_1));
+ s.set_rand_uc4_1(pack_s4(rand_uc4_1));
+ s.set_rand_ui1_0(rand_ui1_0);
+ s.set_rand_ui2_0(pack_l2(rand_ui2_0));
+ s.set_rand_ui3_0(pack_l3(rand_ui3_0));
+ s.set_rand_ui4_0(pack_l4(rand_ui4_0));
+ s.set_rand_ui1_1(rand_ui1_1);
+ s.set_rand_ui2_1(pack_l2(rand_ui2_1));
+ s.set_rand_ui3_1(pack_l3(rand_ui3_1));
+ s.set_rand_ui4_1(pack_l4(rand_ui4_1));
+ */
+ // TODO: set unsigned long vectors
+
+ // Set results for min
+ s.set_min_rand_f1_f1(min(rand_f1_0, rand_f1_1));
+ s.set_min_rand_f2_f2(pack_f2(min(rand_f2_0, rand_f2_1)));
+ s.set_min_rand_f3_f3(pack_f3(min(rand_f3_0, rand_f3_1)));
+ s.set_min_rand_f4_f4(pack_f4(min(rand_f4_0, rand_f4_1)));
+ s.set_min_rand_ss1_ss1(min(rand_ss1_0, rand_ss1_1));
+ s.set_min_rand_ss2_ss2(pack_s2(min(rand_ss2_0, rand_ss2_1)));
+ s.set_min_rand_ss3_ss3(pack_s3(min(rand_ss3_0, rand_ss3_1)));
+ s.set_min_rand_ss4_ss4(pack_s4(min(rand_ss4_0, rand_ss4_1)));
+ s.set_min_rand_si1_si1(min(rand_si1_0, rand_si1_1));
+ s.set_min_rand_si2_si2(pack_i2(min(rand_si2_0, rand_si2_1)));
+ s.set_min_rand_si3_si3(pack_i3(min(rand_si3_0, rand_si3_1)));
+ s.set_min_rand_si4_si4(pack_i4(min(rand_si4_0, rand_si4_1)));
+ s.set_min_rand_sl1_sl1(min(rand_sl1_0, rand_sl1_1));
+ s.set_min_rand_sl2_sl2(pack_l2(min(rand_sl2_0, rand_sl2_1)));
+ s.set_min_rand_sl3_sl3(pack_l3(min(rand_sl3_0, rand_sl3_1)));
+ s.set_min_rand_sl4_sl4(pack_l4(min(rand_sl4_0, rand_sl4_1)));
+ // FIXME: set signed char min reference vectors once bug is fixed
+ /*
+ s.set_min_rand_sc1_sc1(min(rand_sc1_0, rand_sc1_1));
+ s.set_min_rand_sc2_sc2(pack_b2(min(rand_sc2_0, rand_sc2_1)));
+ s.set_min_rand_sc3_sc3(pack_b3(min(rand_sc3_0, rand_sc3_1)));
+ s.set_min_rand_sc4_sc4(pack_b4(min(rand_sc4_0, rand_sc4_1)));
+ */
+ // FIXME: set unsigned min reference vectors once bug 6764163 is fixed
+ /*
+ s.set_min_rand_uc1_uc1(min(rand_uc1_0, rand_uc1_1));
+ s.set_min_rand_uc2_uc2(pack_s3(min(rand_uc2_0, rand_uc2_1)));
+ s.set_min_rand_uc3_uc3(pack_s3(min(rand_uc3_0, rand_uc3_1)));
+ s.set_min_rand_uc4_uc4(pack_s4(min(rand_uc4_0, rand_uc4_1)));
+ s.set_min_rand_us1_us1(min(rand_us1_0, rand_us1_1));
+ s.set_min_rand_us2_us2(pack_i2(min(rand_us2_0, rand_us2_1)));
+ s.set_min_rand_us3_us3(pack_i3(min(rand_us3_0, rand_us3_1)));
+ s.set_min_rand_us4_us4(pack_i4(min(rand_us4_0, rand_us4_1)));
+ s.set_min_rand_ui1_ui1(min(rand_ui1_0, rand_ui1_1));
+ s.set_min_rand_ui2_ui2(pack_l2(min(rand_ui2_0, rand_ui2_1)));
+ s.set_min_rand_ui3_ui3(pack_l3(min(rand_ui3_0, rand_ui3_1)));
+ s.set_min_rand_ui4_ui4(pack_l4(min(rand_ui4_0, rand_ui4_1)));
+ */
+ // TODO: set results for unsigned long min
+
+ // Set results for max
+ s.set_max_rand_f1_f1(max(rand_f1_0, rand_f1_1));
+ s.set_max_rand_f2_f2(pack_f2(max(rand_f2_0, rand_f2_1)));
+ s.set_max_rand_f3_f3(pack_f3(max(rand_f3_0, rand_f3_1)));
+ s.set_max_rand_f4_f4(pack_f4(max(rand_f4_0, rand_f4_1)));
+ s.set_max_rand_ss1_ss1(max(rand_ss1_0, rand_ss1_1));
+ s.set_max_rand_ss2_ss2(pack_s2(max(rand_ss2_0, rand_ss2_1)));
+ s.set_max_rand_ss3_ss3(pack_s3(max(rand_ss3_0, rand_ss3_1)));
+ s.set_max_rand_ss4_ss4(pack_s4(max(rand_ss4_0, rand_ss4_1)));
+ s.set_max_rand_si1_si1(max(rand_si1_0, rand_si1_1));
+ s.set_max_rand_si2_si2(pack_i2(max(rand_si2_0, rand_si2_1)));
+ s.set_max_rand_si3_si3(pack_i3(max(rand_si3_0, rand_si3_1)));
+ s.set_max_rand_si4_si4(pack_i4(max(rand_si4_0, rand_si4_1)));
+ s.set_max_rand_sl1_sl1(max(rand_sl1_0, rand_sl1_1));
+ s.set_max_rand_sl2_sl2(pack_l2(max(rand_sl2_0, rand_sl2_1)));
+ s.set_max_rand_sl3_sl3(pack_l3(max(rand_sl3_0, rand_sl3_1)));
+ s.set_max_rand_sl4_sl4(pack_l4(max(rand_sl4_0, rand_sl4_1)));
+ // FIXME: set signed char max reference vectors once bug is fixed
+ /*
+ s.set_max_rand_sc1_sc1(max(rand_sc1_0, rand_sc1_1));
+ s.set_max_rand_sc2_sc2(pack_b2(max(rand_sc2_0, rand_sc2_1)));
+ s.set_max_rand_sc3_sc3(pack_b3(max(rand_sc3_0, rand_sc3_1)));
+ s.set_max_rand_sc4_sc4(pack_b4(max(rand_sc4_0, rand_sc4_1)));
+ */
+ // FIXME: set unsigned max reference vectors once bug 6764163 is fixed
+ /*
+ s.set_max_rand_uc1_uc1(max(rand_uc1_0, rand_uc1_1));
+ s.set_max_rand_uc2_uc2(pack_s3(max(rand_uc2_0, rand_uc2_1)));
+ s.set_max_rand_uc3_uc3(pack_s3(max(rand_uc3_0, rand_uc3_1)));
+ s.set_max_rand_uc4_uc4(pack_s4(max(rand_uc4_0, rand_uc4_1)));
+ s.set_max_rand_us1_us1(max(rand_us1_0, rand_us1_1));
+ s.set_max_rand_us2_us2(pack_i2(max(rand_us2_0, rand_us2_1)));
+ s.set_max_rand_us3_us3(pack_i3(max(rand_us3_0, rand_us3_1)));
+ s.set_max_rand_us4_us4(pack_i4(max(rand_us4_0, rand_us4_1)));
+ s.set_max_rand_ui1_ui1(max(rand_ui1_0, rand_ui1_1));
+ s.set_max_rand_ui2_ui2(pack_l2(max(rand_ui2_0, rand_ui2_1)));
+ s.set_max_rand_ui3_ui3(pack_l3(max(rand_ui3_0, rand_ui3_1)));
+ s.set_max_rand_ui4_ui4(pack_l4(max(rand_ui4_0, rand_ui4_1)));
+ */
+ // TODO: set results for unsigned long max
+
+ // Set results for fmin
+ s.set_fmin_rand_f1_f1(fmin(rand_f1_0, rand_f1_1));
+ s.set_fmin_rand_f2_f2(pack_f2(fmin(rand_f2_0, rand_f2_1)));
+ s.set_fmin_rand_f3_f3(pack_f3(fmin(rand_f3_0, rand_f3_1)));
+ s.set_fmin_rand_f4_f4(pack_f4(fmin(rand_f4_0, rand_f4_1)));
+ s.set_fmin_rand_f2_f1(pack_f2(fmin(rand_f2_0, rand_f1_1)));
+ s.set_fmin_rand_f3_f1(pack_f3(fmin(rand_f3_0, rand_f1_1)));
+ s.set_fmin_rand_f4_f1(pack_f4(fmin(rand_f4_0, rand_f1_1)));
+
+ // Set results for fmax
+ s.set_fmax_rand_f1_f1(fmax(rand_f1_0, rand_f1_1));
+ s.set_fmax_rand_f2_f2(pack_f2(fmax(rand_f2_0, rand_f2_1)));
+ s.set_fmax_rand_f3_f3(pack_f3(fmax(rand_f3_0, rand_f3_1)));
+ s.set_fmax_rand_f4_f4(pack_f4(fmax(rand_f4_0, rand_f4_1)));
+ s.set_fmax_rand_f2_f1(pack_f2(fmax(rand_f2_0, rand_f1_1)));
+ s.set_fmax_rand_f3_f1(pack_f3(fmax(rand_f3_0, rand_f1_1)));
+ s.set_fmax_rand_f4_f1(pack_f4(fmax(rand_f4_0, rand_f1_1)));
}
public void run() {
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs
index 953b9de..ac3a3fa 100644
--- a/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs
+++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/math_agree.rs
@@ -1,34 +1,391 @@
#include "shared.rsh"
//#pragma rs_fp_relaxed
-float x = 0.0f;
-float y = 0.0f;
-float result_add = 0.0f;
-float result_sub = 0.0f;
-float result_mul = 0.0f;
-float result_div = 0.0f;
-
-#define TEST_OP(op, opName) \
-result = x op y; \
-if (! float_almost_equal(result, result_##opName)) { \
- rsDebug(#opName " did not match!", 0); \
- rsDebug("x = ", x); \
- rsDebug("y = ", y); \
- rsDebug("Result = ", result); \
- rsDebug("Expected = ", result_##opName); \
- rsDebug("Difference = ", result - result_##opName); \
- rsDebug("ULP Difference =", float_dist(result, result_##opName)); \
+volatile float x = 0.0f;
+volatile float y = 0.0f;
+volatile float result_add = 0.0f;
+volatile float result_sub = 0.0f;
+volatile float result_mul = 0.0f;
+volatile float result_div = 0.0f;
+
+#define DECLARE_INPUT_SET(type, abbrev) \
+volatile type rand_##abbrev##1_0, rand_##abbrev##1_1; \
+volatile type##2 rand_##abbrev##2_0, rand_##abbrev##2_1; \
+volatile type##3 rand_##abbrev##3_0, rand_##abbrev##3_1; \
+volatile type##4 rand_##abbrev##4_0, rand_##abbrev##4_1;
+
+#define DECLARE_ALL_INPUT_SETS() \
+DECLARE_INPUT_SET(float, f); \
+DECLARE_INPUT_SET(char, sc); \
+DECLARE_INPUT_SET(uchar, uc); \
+DECLARE_INPUT_SET(short, ss); \
+DECLARE_INPUT_SET(ushort, us); \
+DECLARE_INPUT_SET(int, si); \
+DECLARE_INPUT_SET(uint, ui); \
+DECLARE_INPUT_SET(long, sl); \
+DECLARE_INPUT_SET(ulong, ul);
+
+DECLARE_ALL_INPUT_SETS();
+
+#define DECLARE_REFERENCE_SET_VEC_VEC(type, abbrev, func) \
+volatile type func##_rand_##abbrev##1_##abbrev##1; \
+volatile type##2 func##_rand_##abbrev##2_##abbrev##2; \
+volatile type##3 func##_rand_##abbrev##3_##abbrev##3; \
+volatile type##4 func##_rand_##abbrev##4_##abbrev##4;
+#define DECLARE_REFERENCE_SET_VEC_SCL(type, abbrev, func) \
+volatile type##2 func##_rand_##abbrev##2_##abbrev##1; \
+volatile type##3 func##_rand_##abbrev##3_##abbrev##1; \
+volatile type##4 func##_rand_##abbrev##4_##abbrev##1;
+
+#define DECLARE_ALL_REFERENCE_SETS_VEC_VEC(func) \
+DECLARE_REFERENCE_SET_VEC_VEC(float, f, func); \
+DECLARE_REFERENCE_SET_VEC_VEC(char, sc, func); \
+DECLARE_REFERENCE_SET_VEC_VEC(uchar, uc, func); \
+DECLARE_REFERENCE_SET_VEC_VEC(short, ss, func); \
+DECLARE_REFERENCE_SET_VEC_VEC(ushort, us, func); \
+DECLARE_REFERENCE_SET_VEC_VEC(int, si, func); \
+DECLARE_REFERENCE_SET_VEC_VEC(uint, ui, func); \
+DECLARE_REFERENCE_SET_VEC_VEC(long, sl, func); \
+DECLARE_REFERENCE_SET_VEC_VEC(ulong, ul, func);
+
+DECLARE_ALL_REFERENCE_SETS_VEC_VEC(min);
+DECLARE_ALL_REFERENCE_SETS_VEC_VEC(max);
+DECLARE_REFERENCE_SET_VEC_VEC(float, f, fmin);
+DECLARE_REFERENCE_SET_VEC_SCL(float, f, fmin);
+DECLARE_REFERENCE_SET_VEC_VEC(float, f, fmax);
+DECLARE_REFERENCE_SET_VEC_SCL(float, f, fmax);
+
+static void fail_f1(float v1, float v2, float actual, float expected, char *op_name) {
+ int dist = float_dist(actual, expected);
+ rsDebug("float operation did not match!", op_name);
+ rsDebug("v1", v1);
+ rsDebug("v2", v2);
+ rsDebug("Dalvik result", expected);
+ rsDebug("Renderscript result", actual);
+ rsDebug("ULP difference", dist);
+}
+
+static void fail_f2(float2 v1, float2 v2, float2 actual, float2 expected, char *op_name) {
+ int2 dist;
+ dist.x = float_dist(actual.x, expected.x);
+ dist.y = float_dist(actual.y, expected.y);
+ rsDebug("float2 operation did not match!", op_name);
+ rsDebug("v1.x", v1.x);
+ rsDebug("v1.y", v1.y);
+ rsDebug("v2.x", v2.x);
+ rsDebug("v2.y", v2.y);
+ rsDebug("Dalvik result .x", expected.x);
+ rsDebug("Dalvik result .y", expected.y);
+ rsDebug("Renderscript result .x", actual.x);
+ rsDebug("Renderscript result .y", actual.y);
+ rsDebug("ULP difference .x", dist.x);
+ rsDebug("ULP difference .y", dist.y);
+}
+
+static void fail_f3(float3 v1, float3 v2, float3 actual, float3 expected, char *op_name) {
+ int3 dist;
+ dist.x = float_dist(actual.x, expected.x);
+ dist.y = float_dist(actual.y, expected.y);
+ dist.z = float_dist(actual.z, expected.z);
+ rsDebug("float3 operation did not match!", op_name);
+ rsDebug("v1.x", v1.x);
+ rsDebug("v1.y", v1.y);
+ rsDebug("v1.z", v1.z);
+ rsDebug("v2.x", v2.x);
+ rsDebug("v2.y", v2.y);
+ rsDebug("v2.z", v2.z);
+ rsDebug("Dalvik result .x", expected.x);
+ rsDebug("Dalvik result .y", expected.y);
+ rsDebug("Dalvik result .z", expected.z);
+ rsDebug("Renderscript result .x", actual.x);
+ rsDebug("Renderscript result .y", actual.y);
+ rsDebug("Renderscript result .z", actual.z);
+ rsDebug("ULP difference .x", dist.x);
+ rsDebug("ULP difference .y", dist.y);
+ rsDebug("ULP difference .z", dist.z);
+}
+
+static void fail_f4(float4 v1, float4 v2, float4 actual, float4 expected, char *op_name) {
+ int4 dist;
+ dist.x = float_dist(actual.x, expected.x);
+ dist.y = float_dist(actual.y, expected.y);
+ dist.z = float_dist(actual.z, expected.z);
+ dist.w = float_dist(actual.w, expected.w);
+ rsDebug("float4 operation did not match!", op_name);
+ rsDebug("v1.x", v1.x);
+ rsDebug("v1.y", v1.y);
+ rsDebug("v1.z", v1.z);
+ rsDebug("v1.w", v1.w);
+ rsDebug("v2.x", v2.x);
+ rsDebug("v2.y", v2.y);
+ rsDebug("v2.z", v2.z);
+ rsDebug("v2.w", v2.w);
+ rsDebug("Dalvik result .x", expected.x);
+ rsDebug("Dalvik result .y", expected.y);
+ rsDebug("Dalvik result .z", expected.z);
+ rsDebug("Dalvik result .w", expected.w);
+ rsDebug("Renderscript result .x", actual.x);
+ rsDebug("Renderscript result .y", actual.y);
+ rsDebug("Renderscript result .z", actual.z);
+ rsDebug("Renderscript result .w", actual.w);
+ rsDebug("ULP difference .x", dist.x);
+ rsDebug("ULP difference .y", dist.y);
+ rsDebug("ULP difference .z", dist.z);
+ rsDebug("ULP difference .w", dist.w);
+}
+
+static bool f1_almost_equal(float a, float b) {
+ return float_almost_equal(a, b);
+}
+
+static bool f2_almost_equal(float2 a, float2 b) {
+ return float_almost_equal(a.x, b.x) && float_almost_equal(a.y, b.y);
+}
+
+
+static bool f3_almost_equal(float3 a, float3 b) {
+ return float_almost_equal(a.x, b.x) && float_almost_equal(a.y, b.y)
+ && float_almost_equal(a.z, b.z);
+}
+
+static bool f4_almost_equal(float4 a, float4 b) {
+ return float_almost_equal(a.x, b.x) && float_almost_equal(a.y, b.y)
+ && float_almost_equal(a.z, b.z) && float_almost_equal(a.w, b.w);
+}
+
+#define TEST_BASIC_FLOAT_OP(op, opName) \
+temp_f1 = x op y; \
+if (! float_almost_equal(temp_f1, result_##opName)) { \
+ fail_f1(x, y , temp_f1, result_##opName, #opName); \
+ failed = true; \
+}
+
+#define TEST_FN_FN(func, size) \
+temp_f##size = func(rand_f##size##_0, rand_f##size##_1); \
+if (! f##size##_almost_equal(temp_f##size , func##_rand_f##size##_f##size)) { \
+ fail_f##size (x, y , temp_f##size, func##_rand_f##size##_f##size, #func); \
+ failed = true; \
+}
+#define TEST_FN_F(func, size) \
+temp_f##size = func(rand_f##size##_0, rand_f1_1); \
+if (! f##size##_almost_equal(temp_f##size , func##_rand_f##size##_f1)) { \
+ fail_f##size (x, y , temp_f##size, func##_rand_f##size##_f1 , #func); \
+ failed = true; \
+}
+
+#define TEST_FN_FN_ALL(func) \
+TEST_FN_FN(func, 1) \
+TEST_FN_FN(func, 2) \
+TEST_FN_FN(func, 3) \
+TEST_FN_FN(func, 4)
+#define TEST_FN_F_ALL(func) \
+TEST_FN_F(func, 2) \
+TEST_FN_F(func, 3) \
+TEST_FN_F(func, 4)
+
+#define TEST_VEC1_VEC1(func, type) \
+temp_##type##1 = func( rand_##type##1_0, rand_##type##1_1 ); \
+if (temp_##type##1 != func##_rand_##type##1_##type##1) { \
+ rsDebug(#func " " #type "1 operation did not match!", 0); \
+ rsDebug("v1", rand_##type##1_0); \
+ rsDebug("v2", rand_##type##1_1); \
+ rsDebug("Dalvik result", func##_rand_##type##1_##type##1); \
+ rsDebug("Renderscript result", temp_##type##1); \
+ failed = true; \
+}
+#define TEST_VEC2_VEC2(func, type) \
+temp_##type##2 = func( rand_##type##2_0, rand_##type##2_1 ); \
+if (temp_##type##2 .x != func##_rand_##type##2_##type##2 .x \
+ || temp_##type##2 .y != func##_rand_##type##2_##type##2 .y) { \
+ rsDebug(#func " " #type "2 operation did not match!", 0); \
+ rsDebug("v1.x", rand_##type##2_0 .x); \
+ rsDebug("v1.y", rand_##type##2_0 .y); \
+ rsDebug("v2.x", rand_##type##2_1 .x); \
+ rsDebug("v2.y", rand_##type##2_1 .y); \
+ rsDebug("Dalvik result .x", func##_rand_##type##2_##type##2 .x); \
+ rsDebug("Dalvik result .y", func##_rand_##type##2_##type##2 .y); \
+ rsDebug("Renderscript result .x", temp_##type##2 .x); \
+ rsDebug("Renderscript result .y", temp_##type##2 .y); \
failed = true; \
}
+#define TEST_VEC3_VEC3(func, type) \
+temp_##type##3 = func( rand_##type##3_0, rand_##type##3_1 ); \
+if (temp_##type##3 .x != func##_rand_##type##3_##type##3 .x \
+ || temp_##type##3 .y != func##_rand_##type##3_##type##3 .y \
+ || temp_##type##3 .z != func##_rand_##type##3_##type##3 .z) { \
+ rsDebug(#func " " #type "3 operation did not match!", 0); \
+ rsDebug("v1.x", rand_##type##3_0 .x); \
+ rsDebug("v1.y", rand_##type##3_0 .y); \
+ rsDebug("v1.z", rand_##type##3_0 .z); \
+ rsDebug("v2.x", rand_##type##3_1 .x); \
+ rsDebug("v2.y", rand_##type##3_1 .y); \
+ rsDebug("v2.z", rand_##type##3_1 .z); \
+ rsDebug("Dalvik result .x", func##_rand_##type##3_##type##3 .x); \
+ rsDebug("Dalvik result .y", func##_rand_##type##3_##type##3 .y); \
+ rsDebug("Dalvik result .z", func##_rand_##type##3_##type##3 .z); \
+ rsDebug("Renderscript result .x", temp_##type##3 .x); \
+ rsDebug("Renderscript result .y", temp_##type##3 .y); \
+ rsDebug("Renderscript result .z", temp_##type##3 .z); \
+ failed = true; \
+}
+#define TEST_VEC4_VEC4(func, type) \
+temp_##type##4 = func( rand_##type##4_0, rand_##type##4_1 ); \
+if (temp_##type##4 .x != func##_rand_##type##4_##type##4 .x \
+ || temp_##type##4 .y != func##_rand_##type##4_##type##4 .y \
+ || temp_##type##4 .z != func##_rand_##type##4_##type##4 .z \
+ || temp_##type##4 .w != func##_rand_##type##4_##type##4 .w) { \
+ rsDebug(#func " " #type "4 operation did not match!", 0); \
+ rsDebug("v1.x", rand_##type##4_0 .x); \
+ rsDebug("v1.y", rand_##type##4_0 .y); \
+ rsDebug("v1.z", rand_##type##4_0 .z); \
+ rsDebug("v1.w", rand_##type##4_0 .w); \
+ rsDebug("v2.x", rand_##type##4_1 .x); \
+ rsDebug("v2.y", rand_##type##4_1 .y); \
+ rsDebug("v2.z", rand_##type##4_1 .z); \
+ rsDebug("v2.w", rand_##type##4_1 .w); \
+ rsDebug("Dalvik result .x", func##_rand_##type##4_##type##4 .x); \
+ rsDebug("Dalvik result .y", func##_rand_##type##4_##type##4 .y); \
+ rsDebug("Dalvik result .z", func##_rand_##type##4_##type##4 .z); \
+ rsDebug("Dalvik result .w", func##_rand_##type##4_##type##4 .w); \
+ rsDebug("Renderscript result .x", temp_##type##4 .x); \
+ rsDebug("Renderscript result .y", temp_##type##4 .y); \
+ rsDebug("Renderscript result .z", temp_##type##4 .z); \
+ rsDebug("Renderscript result .w", temp_##type##4 .w); \
+ failed = true; \
+}
+
+#define TEST_SC1_SC1(func) TEST_VEC1_VEC1(func, sc)
+#define TEST_SC2_SC2(func) TEST_VEC2_VEC2(func, sc)
+#define TEST_SC3_SC3(func) TEST_VEC3_VEC3(func, sc)
+#define TEST_SC4_SC4(func) TEST_VEC4_VEC4(func, sc)
+
+#define TEST_UC1_UC1(func) TEST_VEC1_VEC1(func, uc)
+#define TEST_UC2_UC2(func) TEST_VEC2_VEC2(func, uc)
+#define TEST_UC3_UC3(func) TEST_VEC3_VEC3(func, uc)
+#define TEST_UC4_UC4(func) TEST_VEC4_VEC4(func, uc)
+
+#define TEST_SS1_SS1(func) TEST_VEC1_VEC1(func, ss)
+#define TEST_SS2_SS2(func) TEST_VEC2_VEC2(func, ss)
+#define TEST_SS3_SS3(func) TEST_VEC3_VEC3(func, ss)
+#define TEST_SS4_SS4(func) TEST_VEC4_VEC4(func, ss)
+
+#define TEST_US1_US1(func) TEST_VEC1_VEC1(func, us)
+#define TEST_US2_US2(func) TEST_VEC2_VEC2(func, us)
+#define TEST_US3_US3(func) TEST_VEC3_VEC3(func, us)
+#define TEST_US4_US4(func) TEST_VEC4_VEC4(func, us)
+
+#define TEST_SI1_SI1(func) TEST_VEC1_VEC1(func, si)
+#define TEST_SI2_SI2(func) TEST_VEC2_VEC2(func, si)
+#define TEST_SI3_SI3(func) TEST_VEC3_VEC3(func, si)
+#define TEST_SI4_SI4(func) TEST_VEC4_VEC4(func, si)
+
+#define TEST_UI1_UI1(func) TEST_VEC1_VEC1(func, ui)
+#define TEST_UI2_UI2(func) TEST_VEC2_VEC2(func, ui)
+#define TEST_UI3_UI3(func) TEST_VEC3_VEC3(func, ui)
+#define TEST_UI4_UI4(func) TEST_VEC4_VEC4(func, ui)
+
+#define TEST_SL1_SL1(func) TEST_VEC1_VEC1(func, sl)
+#define TEST_SL2_SL2(func) TEST_VEC2_VEC2(func, sl)
+#define TEST_SL3_SL3(func) TEST_VEC3_VEC3(func, sl)
+#define TEST_SL4_SL4(func) TEST_VEC4_VEC4(func, sl)
+
+#define TEST_UL1_UL1(func) TEST_VEC1_VEC1(func, ul)
+#define TEST_UL2_UL2(func) TEST_VEC2_VEC2(func, ul)
+#define TEST_UL3_UL3(func) TEST_VEC3_VEC3(func, ul)
+#define TEST_UL4_UL4(func) TEST_VEC4_VEC4(func, ul)
+
+#define TEST_SC_SC_ALL(func) \
+TEST_SC1_SC1(func) \
+TEST_SC2_SC2(func) \
+TEST_SC3_SC3(func) \
+TEST_SC4_SC4(func)
+#define TEST_UC_UC_ALL(func) \
+TEST_UC1_UC1(func) \
+TEST_UC2_UC2(func) \
+TEST_UC3_UC3(func) \
+TEST_UC4_UC4(func)
+
+#define TEST_SS_SS_ALL(func) \
+TEST_SS1_SS1(func) \
+TEST_SS2_SS2(func) \
+TEST_SS3_SS3(func) \
+TEST_SS4_SS4(func)
+#define TEST_US_US_ALL(func) \
+TEST_US1_US1(func) \
+TEST_US2_US2(func) \
+TEST_US3_US3(func) \
+TEST_US4_US4(func)
+#define TEST_SI_SI_ALL(func) \
+TEST_SI1_SI1(func) \
+TEST_SI2_SI2(func) \
+TEST_SI3_SI3(func) \
+TEST_SI4_SI4(func)
+#define TEST_UI_UI_ALL(func) \
+TEST_UI1_UI1(func) \
+TEST_UI2_UI2(func) \
+TEST_UI3_UI3(func) \
+TEST_UI4_UI4(func)
+#define TEST_SL_SL_ALL(func) \
+TEST_SL1_SL1(func) \
+TEST_SL2_SL2(func) \
+TEST_SL3_SL3(func) \
+TEST_SL4_SL4(func)
+#define TEST_UL_UL_ALL(func) \
+TEST_UL1_UL1(func) \
+TEST_UL2_UL2(func) \
+TEST_UL3_UL3(func) \
+TEST_UL4_UL4(func)
+
+#define TEST_VEC_VEC_ALL(func) \
+TEST_FN_FN_ALL(func) \
+TEST_SS_SS_ALL(func) \
+TEST_SI_SI_ALL(func)
+// FIXME: Add tests back in once bug 6764163 is fixed
+#if 0
+TEST_SC_SC_ALL(func) \
+TEST_US_US_ALL(func) \
+TEST_UC_UC_ALL(func) \
+TEST_UI_UI_ALL(func)
+#endif
+// TODO: add long types to ALL macro
+#if 0
+TEST_SL_SL_ALL(func) \
+TEST_UL_UL_ALL(func)
+#endif
+
+#define DECLARE_TEMP_SET(type, abbrev) \
+volatile type temp_##abbrev##1; \
+volatile type##2 temp_##abbrev##2; \
+volatile type##3 temp_##abbrev##3; \
+volatile type##4 temp_##abbrev##4;
+
+#define DECLARE_ALL_TEMP_SETS() \
+DECLARE_TEMP_SET(float, f); \
+DECLARE_TEMP_SET(char, sc); \
+DECLARE_TEMP_SET(uchar, uc); \
+DECLARE_TEMP_SET(short, ss); \
+DECLARE_TEMP_SET(ushort, us); \
+DECLARE_TEMP_SET(int, si); \
+DECLARE_TEMP_SET(uint, ui); \
+DECLARE_TEMP_SET(long, sl); \
+DECLARE_TEMP_SET(ulong, ul);
static bool test_math_agree() {
bool failed = false;
- float result = 0.0;
- TEST_OP(+, add);
- TEST_OP(-, sub);
- TEST_OP(*, mul);
- TEST_OP(/, div);
+ DECLARE_ALL_TEMP_SETS();
+
+ TEST_BASIC_FLOAT_OP(+, add);
+ TEST_BASIC_FLOAT_OP(-, sub);
+ TEST_BASIC_FLOAT_OP(*, mul);
+ TEST_BASIC_FLOAT_OP(/, div);
+
+ TEST_VEC_VEC_ALL(min);
+ TEST_VEC_VEC_ALL(max);
+ TEST_FN_FN_ALL(fmin);
+ TEST_FN_F_ALL(fmin);
+ TEST_FN_FN_ALL(fmax);
+ TEST_FN_F_ALL(fmax);
if (failed) {
rsDebug("test_math_agree FAILED", 0);