epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 8 | #include "Test.h" |
tomhudson@google.com | 8afae61 | 2012-08-14 15:03:35 +0000 | [diff] [blame] | 9 | #include "SkFloatBits.h" |
reed@android.com | c846ede | 2010-04-13 15:29:15 +0000 | [diff] [blame] | 10 | #include "SkFloatingPoint.h" |
reed@google.com | 4b163ed | 2012-08-07 21:35:13 +0000 | [diff] [blame] | 11 | #include "SkMathPriv.h" |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 12 | #include "SkPoint.h" |
| 13 | #include "SkRandom.h" |
reed@google.com | 0abb499 | 2011-10-06 20:04:36 +0000 | [diff] [blame] | 14 | #include "SkColorPriv.h" |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 15 | |
reed@google.com | a7d7461 | 2012-05-30 12:30:09 +0000 | [diff] [blame] | 16 | static float sk_fsel(float pred, float result_ge, float result_lt) { |
| 17 | return pred >= 0 ? result_ge : result_lt; |
| 18 | } |
| 19 | |
| 20 | static float fast_floor(float x) { |
reed@google.com | c20bc25 | 2012-05-30 13:48:14 +0000 | [diff] [blame] | 21 | // float big = sk_fsel(x, 0x1.0p+23, -0x1.0p+23); |
| 22 | float big = sk_fsel(x, (float)(1 << 23), -(float)(1 << 23)); |
robertphillips@google.com | 00bf06a | 2012-05-30 15:19:17 +0000 | [diff] [blame] | 23 | return (float)(x + big) - big; |
reed@google.com | a7d7461 | 2012-05-30 12:30:09 +0000 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | static float std_floor(float x) { |
| 27 | return sk_float_floor(x); |
| 28 | } |
| 29 | |
| 30 | static void test_floor_value(skiatest::Reporter* reporter, float value) { |
| 31 | float fast = fast_floor(value); |
| 32 | float std = std_floor(value); |
| 33 | REPORTER_ASSERT(reporter, std == fast); |
| 34 | // SkDebugf("value[%1.9f] std[%g] fast[%g] equal[%d]\n", |
| 35 | // value, std, fast, std == fast); |
| 36 | } |
| 37 | |
| 38 | static void test_floor(skiatest::Reporter* reporter) { |
| 39 | static const float gVals[] = { |
| 40 | 0, 1, 1.1f, 1.01f, 1.001f, 1.0001f, 1.00001f, 1.000001f, 1.0000001f |
| 41 | }; |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 42 | |
reed@google.com | a7d7461 | 2012-05-30 12:30:09 +0000 | [diff] [blame] | 43 | for (size_t i = 0; i < SK_ARRAY_COUNT(gVals); ++i) { |
| 44 | test_floor_value(reporter, gVals[i]); |
| 45 | // test_floor_value(reporter, -gVals[i]); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | /////////////////////////////////////////////////////////////////////////////// |
| 50 | |
reed@google.com | ea774d2 | 2013-04-22 20:21:56 +0000 | [diff] [blame] | 51 | // test that SkMul16ShiftRound and SkMulDiv255Round return the same result |
| 52 | static void test_muldivround(skiatest::Reporter* reporter) { |
| 53 | #if 0 |
| 54 | // this "complete" test is too slow, so we test a random sampling of it |
| 55 | |
| 56 | for (int a = 0; a <= 32767; ++a) { |
| 57 | for (int b = 0; b <= 32767; ++b) { |
| 58 | unsigned prod0 = SkMul16ShiftRound(a, b, 8); |
| 59 | unsigned prod1 = SkMulDiv255Round(a, b); |
| 60 | SkASSERT(prod0 == prod1); |
| 61 | } |
| 62 | } |
| 63 | #endif |
| 64 | |
| 65 | SkRandom rand; |
| 66 | for (int i = 0; i < 10000; ++i) { |
| 67 | unsigned a = rand.nextU() & 0x7FFF; |
| 68 | unsigned b = rand.nextU() & 0x7FFF; |
| 69 | |
| 70 | unsigned prod0 = SkMul16ShiftRound(a, b, 8); |
| 71 | unsigned prod1 = SkMulDiv255Round(a, b); |
| 72 | |
| 73 | REPORTER_ASSERT(reporter, prod0 == prod1); |
| 74 | } |
| 75 | } |
| 76 | |
reed@google.com | 0abb499 | 2011-10-06 20:04:36 +0000 | [diff] [blame] | 77 | static float float_blend(int src, int dst, float unit) { |
| 78 | return dst + (src - dst) * unit; |
reed@google.com | 772813a | 2011-03-30 22:34:45 +0000 | [diff] [blame] | 79 | } |
| 80 | |
reed@google.com | 8d7e39c | 2011-11-09 17:12:08 +0000 | [diff] [blame] | 81 | static int blend31(int src, int dst, int a31) { |
| 82 | return dst + ((src - dst) * a31 * 2114 >> 16); |
| 83 | // return dst + ((src - dst) * a31 * 33 >> 10); |
| 84 | } |
| 85 | |
| 86 | static int blend31_slow(int src, int dst, int a31) { |
| 87 | int prod = src * a31 + (31 - a31) * dst + 16; |
| 88 | prod = (prod + (prod >> 5)) >> 5; |
| 89 | return prod; |
| 90 | } |
| 91 | |
| 92 | static int blend31_round(int src, int dst, int a31) { |
| 93 | int prod = (src - dst) * a31 + 16; |
| 94 | prod = (prod + (prod >> 5)) >> 5; |
| 95 | return dst + prod; |
| 96 | } |
| 97 | |
| 98 | static int blend31_old(int src, int dst, int a31) { |
| 99 | a31 += a31 >> 4; |
| 100 | return dst + ((src - dst) * a31 >> 5); |
| 101 | } |
| 102 | |
caryclark@google.com | 42639cd | 2012-06-06 12:03:39 +0000 | [diff] [blame] | 103 | // suppress unused code warning |
| 104 | static int (*blend_functions[])(int, int, int) = { |
| 105 | blend31, |
| 106 | blend31_slow, |
| 107 | blend31_round, |
| 108 | blend31_old |
| 109 | }; |
| 110 | |
reed@google.com | 8d7e39c | 2011-11-09 17:12:08 +0000 | [diff] [blame] | 111 | static void test_blend31() { |
| 112 | int failed = 0; |
| 113 | int death = 0; |
caryclark@google.com | 42639cd | 2012-06-06 12:03:39 +0000 | [diff] [blame] | 114 | if (false) { // avoid bit rot, suppress warning |
| 115 | failed = (*blend_functions[0])(0,0,0); |
| 116 | } |
reed@google.com | 8d7e39c | 2011-11-09 17:12:08 +0000 | [diff] [blame] | 117 | for (int src = 0; src <= 255; src++) { |
| 118 | for (int dst = 0; dst <= 255; dst++) { |
| 119 | for (int a = 0; a <= 31; a++) { |
| 120 | // int r0 = blend31(src, dst, a); |
| 121 | // int r0 = blend31_round(src, dst, a); |
| 122 | // int r0 = blend31_old(src, dst, a); |
| 123 | int r0 = blend31_slow(src, dst, a); |
| 124 | |
| 125 | float f = float_blend(src, dst, a / 31.f); |
| 126 | int r1 = (int)f; |
| 127 | int r2 = SkScalarRoundToInt(SkFloatToScalar(f)); |
| 128 | |
| 129 | if (r0 != r1 && r0 != r2) { |
| 130 | printf("src:%d dst:%d a:%d result:%d float:%g\n", |
| 131 | src, dst, a, r0, f); |
| 132 | failed += 1; |
| 133 | } |
| 134 | if (r0 > 255) { |
| 135 | death += 1; |
| 136 | printf("death src:%d dst:%d a:%d result:%d float:%g\n", |
| 137 | src, dst, a, r0, f); |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | SkDebugf("---- failed %d death %d\n", failed, death); |
| 143 | } |
| 144 | |
reed@google.com | 0abb499 | 2011-10-06 20:04:36 +0000 | [diff] [blame] | 145 | static void test_blend(skiatest::Reporter* reporter) { |
| 146 | for (int src = 0; src <= 255; src++) { |
| 147 | for (int dst = 0; dst <= 255; dst++) { |
| 148 | for (int a = 0; a <= 255; a++) { |
| 149 | int r0 = SkAlphaBlend255(src, dst, a); |
| 150 | float f1 = float_blend(src, dst, a / 255.f); |
reed@google.com | 111c19b | 2011-10-06 20:13:22 +0000 | [diff] [blame] | 151 | int r1 = SkScalarRoundToInt(SkFloatToScalar(f1)); |
reed@google.com | 772813a | 2011-03-30 22:34:45 +0000 | [diff] [blame] | 152 | |
reed@google.com | 0abb499 | 2011-10-06 20:04:36 +0000 | [diff] [blame] | 153 | if (r0 != r1) { |
| 154 | float diff = sk_float_abs(f1 - r1); |
| 155 | diff = sk_float_abs(diff - 0.5f); |
| 156 | if (diff > (1 / 255.f)) { |
| 157 | #ifdef SK_DEBUG |
| 158 | SkDebugf("src:%d dst:%d a:%d result:%d float:%g\n", |
| 159 | src, dst, a, r0, f1); |
| 160 | #endif |
| 161 | REPORTER_ASSERT(reporter, false); |
| 162 | } |
| 163 | } |
reed@google.com | 772813a | 2011-03-30 22:34:45 +0000 | [diff] [blame] | 164 | } |
| 165 | } |
| 166 | } |
| 167 | } |
reed@google.com | 772813a | 2011-03-30 22:34:45 +0000 | [diff] [blame] | 168 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 169 | #if defined(SkLONGLONG) |
| 170 | static int symmetric_fixmul(int a, int b) { |
| 171 | int sa = SkExtractSign(a); |
| 172 | int sb = SkExtractSign(b); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 173 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 174 | a = SkApplySign(a, sa); |
| 175 | b = SkApplySign(b, sb); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 176 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 177 | #if 1 |
| 178 | int c = (int)(((SkLONGLONG)a * b) >> 16); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 179 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 180 | return SkApplySign(c, sa ^ sb); |
| 181 | #else |
| 182 | SkLONGLONG ab = (SkLONGLONG)a * b; |
| 183 | if (sa ^ sb) { |
| 184 | ab = -ab; |
| 185 | } |
| 186 | return ab >> 16; |
| 187 | #endif |
| 188 | } |
| 189 | #endif |
| 190 | |
| 191 | static void check_length(skiatest::Reporter* reporter, |
| 192 | const SkPoint& p, SkScalar targetLen) { |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 193 | float x = SkScalarToFloat(p.fX); |
| 194 | float y = SkScalarToFloat(p.fY); |
| 195 | float len = sk_float_sqrt(x*x + y*y); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 196 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 197 | len /= SkScalarToFloat(targetLen); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 198 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 199 | REPORTER_ASSERT(reporter, len > 0.999f && len < 1.001f); |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 200 | } |
| 201 | |
jvanverth@google.com | c490f80 | 2013-03-04 13:56:38 +0000 | [diff] [blame] | 202 | static float nextFloat(SkMWCRandom& rand) { |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 203 | SkFloatIntUnion data; |
| 204 | data.fSignBitInt = rand.nextU(); |
| 205 | return data.fFloat; |
| 206 | } |
| 207 | |
| 208 | /* returns true if a == b as resulting from (int)x. Since it is undefined |
| 209 | what to do if the float exceeds 2^32-1, we check for that explicitly. |
| 210 | */ |
| 211 | static bool equal_float_native_skia(float x, uint32_t ni, uint32_t si) { |
| 212 | if (!(x == x)) { // NAN |
bsalomon@google.com | 373ebc6 | 2012-09-26 13:08:56 +0000 | [diff] [blame] | 213 | return ((int32_t)si) == SK_MaxS32 || ((int32_t)si) == SK_MinS32; |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 214 | } |
| 215 | // for out of range, C is undefined, but skia always should return NaN32 |
| 216 | if (x > SK_MaxS32) { |
bsalomon@google.com | 373ebc6 | 2012-09-26 13:08:56 +0000 | [diff] [blame] | 217 | return ((int32_t)si) == SK_MaxS32; |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 218 | } |
| 219 | if (x < -SK_MaxS32) { |
bsalomon@google.com | 373ebc6 | 2012-09-26 13:08:56 +0000 | [diff] [blame] | 220 | return ((int32_t)si) == SK_MinS32; |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 221 | } |
| 222 | return si == ni; |
| 223 | } |
| 224 | |
| 225 | static void assert_float_equal(skiatest::Reporter* reporter, const char op[], |
| 226 | float x, uint32_t ni, uint32_t si) { |
| 227 | if (!equal_float_native_skia(x, ni, si)) { |
| 228 | SkString desc; |
tomhudson@google.com | 8afae61 | 2012-08-14 15:03:35 +0000 | [diff] [blame] | 229 | uint32_t xi = SkFloat2Bits(x); |
| 230 | desc.printf("%s float %g bits %x native %x skia %x\n", op, x, xi, ni, si); |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 231 | reporter->reportFailed(desc); |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | static void test_float_cast(skiatest::Reporter* reporter, float x) { |
| 236 | int ix = (int)x; |
| 237 | int iix = SkFloatToIntCast(x); |
| 238 | assert_float_equal(reporter, "cast", x, ix, iix); |
| 239 | } |
| 240 | |
| 241 | static void test_float_floor(skiatest::Reporter* reporter, float x) { |
| 242 | int ix = (int)floor(x); |
| 243 | int iix = SkFloatToIntFloor(x); |
| 244 | assert_float_equal(reporter, "floor", x, ix, iix); |
| 245 | } |
| 246 | |
| 247 | static void test_float_round(skiatest::Reporter* reporter, float x) { |
| 248 | double xx = x + 0.5; // need intermediate double to avoid temp loss |
| 249 | int ix = (int)floor(xx); |
| 250 | int iix = SkFloatToIntRound(x); |
| 251 | assert_float_equal(reporter, "round", x, ix, iix); |
| 252 | } |
| 253 | |
| 254 | static void test_float_ceil(skiatest::Reporter* reporter, float x) { |
| 255 | int ix = (int)ceil(x); |
| 256 | int iix = SkFloatToIntCeil(x); |
| 257 | assert_float_equal(reporter, "ceil", x, ix, iix); |
| 258 | } |
| 259 | |
| 260 | static void test_float_conversions(skiatest::Reporter* reporter, float x) { |
| 261 | test_float_cast(reporter, x); |
| 262 | test_float_floor(reporter, x); |
| 263 | test_float_round(reporter, x); |
| 264 | test_float_ceil(reporter, x); |
| 265 | } |
| 266 | |
| 267 | static void test_int2float(skiatest::Reporter* reporter, int ival) { |
| 268 | float x0 = (float)ival; |
| 269 | float x1 = SkIntToFloatCast(ival); |
| 270 | float x2 = SkIntToFloatCast_NoOverflowCheck(ival); |
| 271 | REPORTER_ASSERT(reporter, x0 == x1); |
| 272 | REPORTER_ASSERT(reporter, x0 == x2); |
| 273 | } |
| 274 | |
| 275 | static void unittest_fastfloat(skiatest::Reporter* reporter) { |
jvanverth@google.com | c490f80 | 2013-03-04 13:56:38 +0000 | [diff] [blame] | 276 | SkMWCRandom rand; |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 277 | size_t i; |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 278 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 279 | static const float gFloats[] = { |
| 280 | 0.f, 1.f, 0.5f, 0.499999f, 0.5000001f, 1.f/3, |
| 281 | 0.000000001f, 1000000000.f, // doesn't overflow |
| 282 | 0.0000000001f, 10000000000.f // does overflow |
| 283 | }; |
| 284 | for (i = 0; i < SK_ARRAY_COUNT(gFloats); i++) { |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 285 | test_float_conversions(reporter, gFloats[i]); |
| 286 | test_float_conversions(reporter, -gFloats[i]); |
| 287 | } |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 288 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 289 | for (int outer = 0; outer < 100; outer++) { |
| 290 | rand.setSeed(outer); |
| 291 | for (i = 0; i < 100000; i++) { |
| 292 | float x = nextFloat(rand); |
| 293 | test_float_conversions(reporter, x); |
| 294 | } |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 295 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 296 | test_int2float(reporter, 0); |
| 297 | test_int2float(reporter, 1); |
| 298 | test_int2float(reporter, -1); |
| 299 | for (i = 0; i < 100000; i++) { |
| 300 | // for now only test ints that are 24bits or less, since we don't |
| 301 | // round (down) large ints the same as IEEE... |
| 302 | int ival = rand.nextU() & 0xFFFFFF; |
| 303 | test_int2float(reporter, ival); |
| 304 | test_int2float(reporter, -ival); |
| 305 | } |
| 306 | } |
| 307 | } |
| 308 | |
reed@android.com | d413445 | 2011-02-09 02:24:26 +0000 | [diff] [blame] | 309 | #ifdef SK_SCALAR_IS_FLOAT |
reed@google.com | 077910e | 2011-02-08 21:56:39 +0000 | [diff] [blame] | 310 | static float make_zero() { |
| 311 | return sk_float_sin(0); |
| 312 | } |
reed@android.com | d413445 | 2011-02-09 02:24:26 +0000 | [diff] [blame] | 313 | #endif |
reed@google.com | 077910e | 2011-02-08 21:56:39 +0000 | [diff] [blame] | 314 | |
| 315 | static void unittest_isfinite(skiatest::Reporter* reporter) { |
| 316 | #ifdef SK_SCALAR_IS_FLOAT |
epoger@google.com | bf083a9 | 2011-06-08 18:26:08 +0000 | [diff] [blame] | 317 | float nan = sk_float_asin(2); |
tomhudson@google.com | 7558925 | 2012-04-10 17:42:21 +0000 | [diff] [blame] | 318 | float inf = 1.0f / make_zero(); |
| 319 | float big = 3.40282e+038f; |
reed@google.com | 077910e | 2011-02-08 21:56:39 +0000 | [diff] [blame] | 320 | |
reed@google.com | 077910e | 2011-02-08 21:56:39 +0000 | [diff] [blame] | 321 | REPORTER_ASSERT(reporter, !SkScalarIsNaN(inf)); |
reed@android.com | d413445 | 2011-02-09 02:24:26 +0000 | [diff] [blame] | 322 | REPORTER_ASSERT(reporter, !SkScalarIsNaN(-inf)); |
| 323 | REPORTER_ASSERT(reporter, !SkScalarIsFinite(inf)); |
| 324 | REPORTER_ASSERT(reporter, !SkScalarIsFinite(-inf)); |
| 325 | #else |
| 326 | SkFixed nan = SK_FixedNaN; |
| 327 | SkFixed big = SK_FixedMax; |
| 328 | #endif |
| 329 | |
| 330 | REPORTER_ASSERT(reporter, SkScalarIsNaN(nan)); |
reed@google.com | 077910e | 2011-02-08 21:56:39 +0000 | [diff] [blame] | 331 | REPORTER_ASSERT(reporter, !SkScalarIsNaN(big)); |
| 332 | REPORTER_ASSERT(reporter, !SkScalarIsNaN(-big)); |
| 333 | REPORTER_ASSERT(reporter, !SkScalarIsNaN(0)); |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 334 | |
reed@google.com | 077910e | 2011-02-08 21:56:39 +0000 | [diff] [blame] | 335 | REPORTER_ASSERT(reporter, !SkScalarIsFinite(nan)); |
reed@google.com | 077910e | 2011-02-08 21:56:39 +0000 | [diff] [blame] | 336 | REPORTER_ASSERT(reporter, SkScalarIsFinite(big)); |
| 337 | REPORTER_ASSERT(reporter, SkScalarIsFinite(-big)); |
| 338 | REPORTER_ASSERT(reporter, SkScalarIsFinite(0)); |
reed@google.com | 077910e | 2011-02-08 21:56:39 +0000 | [diff] [blame] | 339 | } |
| 340 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 341 | static void test_muldiv255(skiatest::Reporter* reporter) { |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 342 | for (int a = 0; a <= 255; a++) { |
| 343 | for (int b = 0; b <= 255; b++) { |
| 344 | int ab = a * b; |
| 345 | float s = ab / 255.0f; |
| 346 | int round = (int)floorf(s + 0.5f); |
| 347 | int trunc = (int)floorf(s); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 348 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 349 | int iround = SkMulDiv255Round(a, b); |
| 350 | int itrunc = SkMulDiv255Trunc(a, b); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 351 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 352 | REPORTER_ASSERT(reporter, iround == round); |
| 353 | REPORTER_ASSERT(reporter, itrunc == trunc); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 354 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 355 | REPORTER_ASSERT(reporter, itrunc <= iround); |
| 356 | REPORTER_ASSERT(reporter, iround <= a); |
| 357 | REPORTER_ASSERT(reporter, iround <= b); |
| 358 | } |
| 359 | } |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 360 | } |
| 361 | |
senorblanco@chromium.org | ec7a30c | 2010-12-07 21:07:56 +0000 | [diff] [blame] | 362 | static void test_muldiv255ceiling(skiatest::Reporter* reporter) { |
| 363 | for (int c = 0; c <= 255; c++) { |
| 364 | for (int a = 0; a <= 255; a++) { |
| 365 | int product = (c * a + 255); |
| 366 | int expected_ceiling = (product + (product >> 8)) >> 8; |
| 367 | int webkit_ceiling = (c * a + 254) / 255; |
| 368 | REPORTER_ASSERT(reporter, expected_ceiling == webkit_ceiling); |
| 369 | int skia_ceiling = SkMulDiv255Ceiling(c, a); |
| 370 | REPORTER_ASSERT(reporter, skia_ceiling == webkit_ceiling); |
| 371 | } |
| 372 | } |
| 373 | } |
| 374 | |
reed@android.com | f0ad086 | 2010-02-09 19:18:38 +0000 | [diff] [blame] | 375 | static void test_copysign(skiatest::Reporter* reporter) { |
| 376 | static const int32_t gTriples[] = { |
| 377 | // x, y, expected result |
| 378 | 0, 0, 0, |
| 379 | 0, 1, 0, |
| 380 | 0, -1, 0, |
| 381 | 1, 0, 1, |
| 382 | 1, 1, 1, |
| 383 | 1, -1, -1, |
| 384 | -1, 0, 1, |
| 385 | -1, 1, 1, |
| 386 | -1, -1, -1, |
| 387 | }; |
| 388 | for (size_t i = 0; i < SK_ARRAY_COUNT(gTriples); i += 3) { |
| 389 | REPORTER_ASSERT(reporter, |
| 390 | SkCopySign32(gTriples[i], gTriples[i+1]) == gTriples[i+2]); |
reed@android.com | f0ad086 | 2010-02-09 19:18:38 +0000 | [diff] [blame] | 391 | float x = (float)gTriples[i]; |
| 392 | float y = (float)gTriples[i+1]; |
| 393 | float expected = (float)gTriples[i+2]; |
| 394 | REPORTER_ASSERT(reporter, sk_float_copysign(x, y) == expected); |
reed@android.com | f0ad086 | 2010-02-09 19:18:38 +0000 | [diff] [blame] | 395 | } |
| 396 | |
jvanverth@google.com | c490f80 | 2013-03-04 13:56:38 +0000 | [diff] [blame] | 397 | SkMWCRandom rand; |
reed@android.com | f0ad086 | 2010-02-09 19:18:38 +0000 | [diff] [blame] | 398 | for (int j = 0; j < 1000; j++) { |
| 399 | int ix = rand.nextS(); |
| 400 | REPORTER_ASSERT(reporter, SkCopySign32(ix, ix) == ix); |
| 401 | REPORTER_ASSERT(reporter, SkCopySign32(ix, -ix) == -ix); |
| 402 | REPORTER_ASSERT(reporter, SkCopySign32(-ix, ix) == ix); |
| 403 | REPORTER_ASSERT(reporter, SkCopySign32(-ix, -ix) == -ix); |
| 404 | |
| 405 | SkScalar sx = rand.nextSScalar1(); |
| 406 | REPORTER_ASSERT(reporter, SkScalarCopySign(sx, sx) == sx); |
| 407 | REPORTER_ASSERT(reporter, SkScalarCopySign(sx, -sx) == -sx); |
| 408 | REPORTER_ASSERT(reporter, SkScalarCopySign(-sx, sx) == sx); |
| 409 | REPORTER_ASSERT(reporter, SkScalarCopySign(-sx, -sx) == -sx); |
| 410 | } |
| 411 | } |
| 412 | |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 413 | static void TestMath(skiatest::Reporter* reporter) { |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 414 | int i; |
| 415 | int32_t x; |
jvanverth@google.com | c490f80 | 2013-03-04 13:56:38 +0000 | [diff] [blame] | 416 | SkMWCRandom rand; |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 417 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 418 | // these should assert |
| 419 | #if 0 |
| 420 | SkToS8(128); |
| 421 | SkToS8(-129); |
| 422 | SkToU8(256); |
| 423 | SkToU8(-5); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 424 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 425 | SkToS16(32768); |
| 426 | SkToS16(-32769); |
| 427 | SkToU16(65536); |
| 428 | SkToU16(-5); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 429 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 430 | if (sizeof(size_t) > 4) { |
| 431 | SkToS32(4*1024*1024); |
| 432 | SkToS32(-4*1024*1024); |
| 433 | SkToU32(5*1024*1024); |
| 434 | SkToU32(-5); |
| 435 | } |
| 436 | #endif |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 437 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 438 | test_muldiv255(reporter); |
senorblanco@chromium.org | ec7a30c | 2010-12-07 21:07:56 +0000 | [diff] [blame] | 439 | test_muldiv255ceiling(reporter); |
reed@android.com | f0ad086 | 2010-02-09 19:18:38 +0000 | [diff] [blame] | 440 | test_copysign(reporter); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 441 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 442 | { |
| 443 | SkScalar x = SK_ScalarNaN; |
| 444 | REPORTER_ASSERT(reporter, SkScalarIsNaN(x)); |
| 445 | } |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 446 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 447 | for (i = 1; i <= 10; i++) { |
| 448 | x = SkCubeRootBits(i*i*i, 11); |
| 449 | REPORTER_ASSERT(reporter, x == i); |
| 450 | } |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 451 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 452 | x = SkFixedSqrt(SK_Fixed1); |
| 453 | REPORTER_ASSERT(reporter, x == SK_Fixed1); |
| 454 | x = SkFixedSqrt(SK_Fixed1/4); |
| 455 | REPORTER_ASSERT(reporter, x == SK_Fixed1/2); |
| 456 | x = SkFixedSqrt(SK_Fixed1*4); |
| 457 | REPORTER_ASSERT(reporter, x == SK_Fixed1*2); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 458 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 459 | x = SkFractSqrt(SK_Fract1); |
| 460 | REPORTER_ASSERT(reporter, x == SK_Fract1); |
| 461 | x = SkFractSqrt(SK_Fract1/4); |
| 462 | REPORTER_ASSERT(reporter, x == SK_Fract1/2); |
| 463 | x = SkFractSqrt(SK_Fract1/16); |
| 464 | REPORTER_ASSERT(reporter, x == SK_Fract1/4); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 465 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 466 | for (i = 1; i < 100; i++) { |
| 467 | x = SkFixedSqrt(SK_Fixed1 * i * i); |
| 468 | REPORTER_ASSERT(reporter, x == SK_Fixed1 * i); |
| 469 | } |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 470 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 471 | for (i = 0; i < 1000; i++) { |
| 472 | int value = rand.nextS16(); |
| 473 | int max = rand.nextU16(); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 474 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 475 | int clamp = SkClampMax(value, max); |
| 476 | int clamp2 = value < 0 ? 0 : (value > max ? max : value); |
| 477 | REPORTER_ASSERT(reporter, clamp == clamp2); |
| 478 | } |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 479 | |
reed@android.com | e72fee5 | 2009-11-16 14:52:01 +0000 | [diff] [blame] | 480 | for (i = 0; i < 10000; i++) { |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 481 | SkPoint p; |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 482 | |
tomhudson@google.com | 7558925 | 2012-04-10 17:42:21 +0000 | [diff] [blame] | 483 | // These random values are being treated as 32-bit-patterns, not as |
| 484 | // ints; calling SkIntToScalar() here produces crashes. |
robertphillips@google.com | 4debcac | 2012-05-14 16:33:36 +0000 | [diff] [blame] | 485 | p.setLength((SkScalar) rand.nextS(), |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 486 | (SkScalar) rand.nextS(), |
robertphillips@google.com | 4debcac | 2012-05-14 16:33:36 +0000 | [diff] [blame] | 487 | SK_Scalar1); |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 488 | check_length(reporter, p, SK_Scalar1); |
robertphillips@google.com | 4debcac | 2012-05-14 16:33:36 +0000 | [diff] [blame] | 489 | p.setLength((SkScalar) (rand.nextS() >> 13), |
rmistry@google.com | d6176b0 | 2012-08-23 18:14:13 +0000 | [diff] [blame] | 490 | (SkScalar) (rand.nextS() >> 13), |
robertphillips@google.com | 4debcac | 2012-05-14 16:33:36 +0000 | [diff] [blame] | 491 | SK_Scalar1); |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 492 | check_length(reporter, p, SK_Scalar1); |
| 493 | } |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 494 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 495 | { |
| 496 | SkFixed result = SkFixedDiv(100, 100); |
| 497 | REPORTER_ASSERT(reporter, result == SK_Fixed1); |
| 498 | result = SkFixedDiv(1, SK_Fixed1); |
| 499 | REPORTER_ASSERT(reporter, result == 1); |
| 500 | } |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 501 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 502 | unittest_fastfloat(reporter); |
reed@google.com | 077910e | 2011-02-08 21:56:39 +0000 | [diff] [blame] | 503 | unittest_isfinite(reporter); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 504 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 505 | #ifdef SkLONGLONG |
reed@android.com | e72fee5 | 2009-11-16 14:52:01 +0000 | [diff] [blame] | 506 | for (i = 0; i < 10000; i++) { |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 507 | SkFixed numer = rand.nextS(); |
| 508 | SkFixed denom = rand.nextS(); |
| 509 | SkFixed result = SkFixedDiv(numer, denom); |
| 510 | SkLONGLONG check = ((SkLONGLONG)numer << 16) / denom; |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 511 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 512 | (void)SkCLZ(numer); |
| 513 | (void)SkCLZ(denom); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 514 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 515 | REPORTER_ASSERT(reporter, result != (SkFixed)SK_NaN32); |
| 516 | if (check > SK_MaxS32) { |
| 517 | check = SK_MaxS32; |
| 518 | } else if (check < -SK_MaxS32) { |
| 519 | check = SK_MinS32; |
| 520 | } |
| 521 | REPORTER_ASSERT(reporter, result == (int32_t)check); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 522 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 523 | result = SkFractDiv(numer, denom); |
| 524 | check = ((SkLONGLONG)numer << 30) / denom; |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 525 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 526 | REPORTER_ASSERT(reporter, result != (SkFixed)SK_NaN32); |
| 527 | if (check > SK_MaxS32) { |
| 528 | check = SK_MaxS32; |
| 529 | } else if (check < -SK_MaxS32) { |
| 530 | check = SK_MinS32; |
| 531 | } |
| 532 | REPORTER_ASSERT(reporter, result == (int32_t)check); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 533 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 534 | // make them <= 2^24, so we don't overflow in fixmul |
| 535 | numer = numer << 8 >> 8; |
| 536 | denom = denom << 8 >> 8; |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 537 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 538 | result = SkFixedMul(numer, denom); |
| 539 | SkFixed r2 = symmetric_fixmul(numer, denom); |
| 540 | // SkASSERT(result == r2); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 541 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 542 | result = SkFixedMul(numer, numer); |
| 543 | r2 = SkFixedSquare(numer); |
| 544 | REPORTER_ASSERT(reporter, result == r2); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 545 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 546 | if (numer >= 0 && denom >= 0) { |
| 547 | SkFixed mean = SkFixedMean(numer, denom); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 548 | float prod = SkFixedToFloat(numer) * SkFixedToFloat(denom); |
| 549 | float fm = sk_float_sqrt(sk_float_abs(prod)); |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 550 | SkFixed mean2 = SkFloatToFixed(fm); |
| 551 | int diff = SkAbs32(mean - mean2); |
| 552 | REPORTER_ASSERT(reporter, diff <= 1); |
| 553 | } |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 554 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 555 | { |
| 556 | SkFixed mod = SkFixedMod(numer, denom); |
| 557 | float n = SkFixedToFloat(numer); |
| 558 | float d = SkFixedToFloat(denom); |
| 559 | float m = sk_float_mod(n, d); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 560 | // ensure the same sign |
| 561 | REPORTER_ASSERT(reporter, mod == 0 || (mod < 0) == (m < 0)); |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 562 | int diff = SkAbs32(mod - SkFloatToFixed(m)); |
| 563 | REPORTER_ASSERT(reporter, (diff >> 7) == 0); |
| 564 | } |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 565 | } |
| 566 | #endif |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 567 | |
reed@android.com | e72fee5 | 2009-11-16 14:52:01 +0000 | [diff] [blame] | 568 | for (i = 0; i < 10000; i++) { |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 569 | SkFract x = rand.nextU() >> 1; |
| 570 | double xx = (double)x / SK_Fract1; |
| 571 | SkFract xr = SkFractSqrt(x); |
| 572 | SkFract check = SkFloatToFract(sqrt(xx)); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 573 | REPORTER_ASSERT(reporter, xr == check || |
| 574 | xr == check-1 || |
| 575 | xr == check+1); |
| 576 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 577 | xr = SkFixedSqrt(x); |
| 578 | xx = (double)x / SK_Fixed1; |
| 579 | check = SkFloatToFixed(sqrt(xx)); |
| 580 | REPORTER_ASSERT(reporter, xr == check || xr == check-1); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 581 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 582 | xr = SkSqrt32(x); |
| 583 | xx = (double)x; |
| 584 | check = (int32_t)sqrt(xx); |
| 585 | REPORTER_ASSERT(reporter, xr == check || xr == check-1); |
| 586 | } |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 587 | |
reed@google.com | 7886ad3 | 2012-06-11 21:21:26 +0000 | [diff] [blame] | 588 | #if !defined(SK_SCALAR_IS_FLOAT) |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 589 | { |
| 590 | SkFixed s, c; |
| 591 | s = SkFixedSinCos(0, &c); |
| 592 | REPORTER_ASSERT(reporter, s == 0); |
| 593 | REPORTER_ASSERT(reporter, c == SK_Fixed1); |
| 594 | } |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 595 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 596 | int maxDiff = 0; |
reed@android.com | e72fee5 | 2009-11-16 14:52:01 +0000 | [diff] [blame] | 597 | for (i = 0; i < 1000; i++) { |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 598 | SkFixed rads = rand.nextS() >> 10; |
| 599 | double frads = SkFixedToFloat(rads); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 600 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 601 | SkFixed s, c; |
| 602 | s = SkScalarSinCos(rads, &c); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 603 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 604 | double fs = sin(frads); |
| 605 | double fc = cos(frads); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 606 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 607 | SkFixed is = SkFloatToFixed(fs); |
| 608 | SkFixed ic = SkFloatToFixed(fc); |
reed@android.com | 80e39a7 | 2009-04-02 16:59:40 +0000 | [diff] [blame] | 609 | |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 610 | maxDiff = SkMax32(maxDiff, SkAbs32(is - s)); |
| 611 | maxDiff = SkMax32(maxDiff, SkAbs32(ic - c)); |
| 612 | } |
| 613 | SkDebugf("SinCos: maximum error = %d\n", maxDiff); |
| 614 | #endif |
reed@google.com | 772813a | 2011-03-30 22:34:45 +0000 | [diff] [blame] | 615 | |
reed@google.com | 0abb499 | 2011-10-06 20:04:36 +0000 | [diff] [blame] | 616 | #ifdef SK_SCALAR_IS_FLOAT |
| 617 | test_blend(reporter); |
| 618 | #endif |
reed@google.com | 8d7e39c | 2011-11-09 17:12:08 +0000 | [diff] [blame] | 619 | |
humper@google.com | 05af1af | 2013-01-07 16:47:43 +0000 | [diff] [blame] | 620 | if (false) test_floor(reporter); |
reed@google.com | a7d7461 | 2012-05-30 12:30:09 +0000 | [diff] [blame] | 621 | |
reed@google.com | 8d7e39c | 2011-11-09 17:12:08 +0000 | [diff] [blame] | 622 | // disable for now |
caryclark@google.com | 42639cd | 2012-06-06 12:03:39 +0000 | [diff] [blame] | 623 | if (false) test_blend31(); // avoid bit rot, suppress warning |
reed@google.com | ea774d2 | 2013-04-22 20:21:56 +0000 | [diff] [blame] | 624 | |
| 625 | test_muldivround(reporter); |
reed@android.com | ed67331 | 2009-02-27 16:24:51 +0000 | [diff] [blame] | 626 | } |
| 627 | |
reed@android.com | d8730ea | 2009-02-27 22:06:06 +0000 | [diff] [blame] | 628 | #include "TestClassDef.h" |
| 629 | DEFINE_TESTCLASS("Math", MathTestClass, TestMath) |