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

Unified Diff: tests/Sk4xTest.cpp

Issue 1024633003: operator overloads for Sk4x, use them all where possible (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: weird, msvc doesnt like operator~() Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/Sk2xTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/Sk4xTest.cpp
diff --git a/tests/Sk4xTest.cpp b/tests/Sk4xTest.cpp
index 1cecd4f1fcec19ab3fffc74425661c656360eaa4..f25339bd9481739f7ee602c636d90a1edbcca18a 100644
--- a/tests/Sk4xTest.cpp
+++ b/tests/Sk4xTest.cpp
@@ -66,24 +66,24 @@ DEF_TEST(Sk4x_Bits, r) {
Sk4i a(2,3,4,5),
b(1,3,5,7);
- ASSERT_EQ(Sk4i(0,3,4,5), a.bitAnd(b));
- ASSERT_EQ(Sk4i(3,3,5,7), a.bitOr(b));
+ ASSERT_EQ(Sk4i(0,3,4,5), a & b);
+ ASSERT_EQ(Sk4i(3,3,5,7), a | b);
}
DEF_TEST(Sk4x_Arith, r) {
- ASSERT_EQ(Sk4f(4,6,8,10), Sk4f(1,2,3,4).add(Sk4f(3,4,5,6)));
- ASSERT_EQ(Sk4f(-2,-2,-2,-2), Sk4f(1,2,3,4).subtract(Sk4f(3,4,5,6)));
- ASSERT_EQ(Sk4f(3,8,15,24), Sk4f(1,2,3,4).multiply(Sk4f(3,4,5,6)));
+ ASSERT_EQ(Sk4f(4,6,8,10), Sk4f(1,2,3,4) + Sk4f(3,4,5,6));
+ ASSERT_EQ(Sk4f(-2,-2,-2,-2), Sk4f(1,2,3,4) - Sk4f(3,4,5,6));
+ ASSERT_EQ(Sk4f(3,8,15,24), Sk4f(1,2,3,4) * Sk4f(3,4,5,6));
float third = 1.0f/3.0f;
- ASSERT_EQ(Sk4f(1*third, 0.5f, 0.6f, 2*third), Sk4f(1,2,3,4).divide(Sk4f(3,4,5,6)));
- ASSERT_EQ(Sk4i(4,6,8,10), Sk4i(1,2,3,4).add(Sk4i(3,4,5,6)));
- ASSERT_EQ(Sk4i(-2,-2,-2,-2), Sk4i(1,2,3,4).subtract(Sk4i(3,4,5,6)));
- ASSERT_EQ(Sk4i(3,8,15,24), Sk4i(1,2,3,4).multiply(Sk4i(3,4,5,6)));
+ ASSERT_EQ(Sk4f(1*third, 0.5f, 0.6f, 2*third), Sk4f(1,2,3,4) / Sk4f(3,4,5,6));
+ ASSERT_EQ(Sk4i(4,6,8,10), Sk4i(1,2,3,4) + Sk4i(3,4,5,6));
+ ASSERT_EQ(Sk4i(-2,-2,-2,-2), Sk4i(1,2,3,4) - Sk4i(3,4,5,6));
+ ASSERT_EQ(Sk4i(3,8,15,24), Sk4i(1,2,3,4) * Sk4i(3,4,5,6));
}
-DEF_TEST(Sk4x_ImplicitPromotion, r) {
- ASSERT_EQ(Sk4f(2,4,6,8), Sk4f(1,2,3,4).multiply(Sk4f(2.0f)));
+DEF_TEST(Sk4x_ExplicitPromotion, r) {
+ ASSERT_EQ(Sk4f(2,4,6,8), Sk4f(1,2,3,4) * Sk4f(2.0f));
}
DEF_TEST(Sk4x_Sqrt, r) {
@@ -104,22 +104,22 @@ DEF_TEST(Sk4x_Comparison, r) {
ASSERT_EQ(Sk4f(1,2,3,4), Sk4f(1,2,3,4));
ASSERT_NE(Sk4f(4,3,2,1), Sk4f(1,2,3,4));
- ASSERT_EQ(Sk4i(-1,-1,0,-1), Sk4f(1,2,5,4).equal(Sk4f(1,2,3,4)));
+ ASSERT_EQ(Sk4i(-1,-1,0,-1), Sk4f(1,2,5,4) == Sk4f(1,2,3,4));
- ASSERT_EQ(Sk4i(-1,-1,-1,-1), Sk4f(1,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5));
+ ASSERT_EQ(Sk4i(0,0,0,0), Sk4i(1,2,3,4) > Sk4i(2,3,4,5));
+ ASSERT_EQ(Sk4i(0,0,0,0), Sk4i(1,2,3,4) >= Sk4i(2,3,4,5));
}
DEF_TEST(Sk4x_MinMax, r) {
« no previous file with comments | « tests/Sk2xTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698