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

Side by Side Diff: tests/MathTest.cpp

Issue 2372083002: Revert of My take on SkAlign changes. (Closed)
Patch Set: Created 4 years, 2 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/core/SkTypes.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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 test_divmod<int16_t>(r); 672 test_divmod<int16_t>(r);
673 } 673 }
674 674
675 DEF_TEST(divmod_s32, r) { 675 DEF_TEST(divmod_s32, r) {
676 test_divmod<int32_t>(r); 676 test_divmod<int32_t>(r);
677 } 677 }
678 678
679 DEF_TEST(divmod_s64, r) { 679 DEF_TEST(divmod_s64, r) {
680 test_divmod<int64_t>(r); 680 test_divmod<int64_t>(r);
681 } 681 }
682
683 DEF_TEST(SkAlign, r) {
684 int x = 6;
685 REPORTER_ASSERT(r, SkIsAlign2(x));
686 REPORTER_ASSERT(r, !SkIsAlign4(x));
687 x = SkAlign4(x);
688 REPORTER_ASSERT(r, SkIsAlign2(x));
689 REPORTER_ASSERT(r, SkIsAlign4(x));
690
691 auto p = (char*)&x;
692 REPORTER_ASSERT(r, SkIsAlign2(p));
693 REPORTER_ASSERT(r, SkIsAlign4(p));
694 p += 2;
695 REPORTER_ASSERT(r, SkIsAlign2(p));
696 REPORTER_ASSERT(r, !SkIsAlign4(p));
697 p = SkAlign4(p);
698 REPORTER_ASSERT(r, p == (char*)(&x+1));
699 }
OLDNEW
« no previous file with comments | « include/core/SkTypes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698