Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: tests/MathTest.cpp

Issue 2149733002: Fix SkFixedDiv macro (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/private/SkFixed.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "float.h" 8 #include "float.h"
9 9
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 (SkScalar) (rand.nextS() >> 13), 523 (SkScalar) (rand.nextS() >> 13),
524 SK_Scalar1); 524 SK_Scalar1);
525 check_length(reporter, p, SK_Scalar1); 525 check_length(reporter, p, SK_Scalar1);
526 } 526 }
527 527
528 { 528 {
529 SkFixed result = SkFixedDiv(100, 100); 529 SkFixed result = SkFixedDiv(100, 100);
530 REPORTER_ASSERT(reporter, result == SK_Fixed1); 530 REPORTER_ASSERT(reporter, result == SK_Fixed1);
531 result = SkFixedDiv(1, SK_Fixed1); 531 result = SkFixedDiv(1, SK_Fixed1);
532 REPORTER_ASSERT(reporter, result == 1); 532 REPORTER_ASSERT(reporter, result == 1);
533 result = SkFixedDiv(10 - 1, SK_Fixed1 * 3);
534 REPORTER_ASSERT(reporter, result == 3);
533 } 535 }
534 536
535 unittest_fastfloat(reporter); 537 unittest_fastfloat(reporter);
536 unittest_isfinite(reporter); 538 unittest_isfinite(reporter);
537 unittest_half(reporter); 539 unittest_half(reporter);
538 test_rsqrt(reporter, sk_float_rsqrt); 540 test_rsqrt(reporter, sk_float_rsqrt);
539 test_rsqrt(reporter, sk_float_rsqrt_portable); 541 test_rsqrt(reporter, sk_float_rsqrt_portable);
540 542
541 for (i = 0; i < 10000; i++) { 543 for (i = 0; i < 10000; i++) {
542 SkFixed numer = rand.nextS(); 544 SkFixed numer = rand.nextS();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 test_divmod<int16_t>(r); 672 test_divmod<int16_t>(r);
671 } 673 }
672 674
673 DEF_TEST(divmod_s32, r) { 675 DEF_TEST(divmod_s32, r) {
674 test_divmod<int32_t>(r); 676 test_divmod<int32_t>(r);
675 } 677 }
676 678
677 DEF_TEST(divmod_s64, r) { 679 DEF_TEST(divmod_s64, r) {
678 test_divmod<int64_t>(r); 680 test_divmod<int64_t>(r);
679 } 681 }
OLDNEW
« no previous file with comments | « include/private/SkFixed.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698