OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Test.h" | 8 #include "Test.h" |
9 #include "TestClassDef.h" | 9 #include "TestClassDef.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 218 } |
219 if (x < -SK_MaxS32) { | 219 if (x < -SK_MaxS32) { |
220 return ((int32_t)si) == SK_MinS32; | 220 return ((int32_t)si) == SK_MinS32; |
221 } | 221 } |
222 return si == ni; | 222 return si == ni; |
223 } | 223 } |
224 | 224 |
225 static void assert_float_equal(skiatest::Reporter* reporter, const char op[], | 225 static void assert_float_equal(skiatest::Reporter* reporter, const char op[], |
226 float x, uint32_t ni, uint32_t si) { | 226 float x, uint32_t ni, uint32_t si) { |
227 if (!equal_float_native_skia(x, ni, si)) { | 227 if (!equal_float_native_skia(x, ni, si)) { |
228 SkString desc; | 228 ERRORF(reporter, "%s float %g bits %x native %x skia %x\n", |
229 uint32_t xi = SkFloat2Bits(x); | 229 op, x, SkFloat2Bits(x), ni, si); |
230 desc.printf("%s float %g bits %x native %x skia %x\n", op, x, xi, ni, si
); | |
231 reporter->reportFailed(desc); | |
232 } | 230 } |
233 } | 231 } |
234 | 232 |
235 static void test_float_cast(skiatest::Reporter* reporter, float x) { | 233 static void test_float_cast(skiatest::Reporter* reporter, float x) { |
236 int ix = (int)x; | 234 int ix = (int)x; |
237 int iix = SkFloatToIntCast(x); | 235 int iix = SkFloatToIntCast(x); |
238 assert_float_equal(reporter, "cast", x, ix, iix); | 236 assert_float_equal(reporter, "cast", x, ix, iix); |
239 } | 237 } |
240 | 238 |
241 static void test_float_floor(skiatest::Reporter* reporter, float x) { | 239 static void test_float_floor(skiatest::Reporter* reporter, float x) { |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 test_divmod<int16_t>(r); | 597 test_divmod<int16_t>(r); |
600 } | 598 } |
601 | 599 |
602 DEF_TEST(divmod_s32, r) { | 600 DEF_TEST(divmod_s32, r) { |
603 test_divmod<int32_t>(r); | 601 test_divmod<int32_t>(r); |
604 } | 602 } |
605 | 603 |
606 DEF_TEST(divmod_s64, r) { | 604 DEF_TEST(divmod_s64, r) { |
607 test_divmod<int64_t>(r); | 605 test_divmod<int64_t>(r); |
608 } | 606 } |
OLD | NEW |