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

Side by Side Diff: tests/Sk2xTest.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 unified diff | Download patch
« no previous file with comments | « tests/PMFloatTest.cpp ('k') | tests/Sk4xTest.cpp » ('j') | 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 2015 Google Inc. 2 * Copyright 2015 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 "Sk2x.h" 9 #include "Sk2x.h"
10 10
(...skipping 23 matching lines...) Expand all
34 T vals[] = { 2, 5 }; 34 T vals[] = { 2, 5 };
35 Sk2x<T> f = Sk2x<T>::Load(vals); 35 Sk2x<T> f = Sk2x<T>::Load(vals);
36 REPORTER_ASSERT(r, eq(d, 2, 5)); 36 REPORTER_ASSERT(r, eq(d, 2, 5));
37 REPORTER_ASSERT(r, eq(e, 2, 5)); 37 REPORTER_ASSERT(r, eq(e, 2, 5));
38 REPORTER_ASSERT(r, eq(f, 2, 5)); 38 REPORTER_ASSERT(r, eq(f, 2, 5));
39 39
40 a.store(vals); 40 a.store(vals);
41 REPORTER_ASSERT(r, vals[0] == 4 && vals[1] == 4); 41 REPORTER_ASSERT(r, vals[0] == 4 && vals[1] == 4);
42 42
43 // Math 43 // Math
44 REPORTER_ASSERT(r, eq(a.add(d), 6, 9));
45 REPORTER_ASSERT(r, eq(a.subtract(d), 2, -1));
46 REPORTER_ASSERT(r, eq(a.multiply(d), 8, 20));
47
48 REPORTER_ASSERT(r, eq(a + d, 6, 9)); 44 REPORTER_ASSERT(r, eq(a + d, 6, 9));
49 REPORTER_ASSERT(r, eq(a - d, 2, -1)); 45 REPORTER_ASSERT(r, eq(a - d, 2, -1));
50 REPORTER_ASSERT(r, eq(a * d, 8, 20)); 46 REPORTER_ASSERT(r, eq(a * d, 8, 20));
51 47
52 REPORTER_ASSERT(r, nearly_eq(0.001, a.rsqrt(), 0.5, 0.5)); 48 REPORTER_ASSERT(r, nearly_eq(0.001, a.rsqrt(), 0.5, 0.5));
53 REPORTER_ASSERT(r, eq(a.sqrt(), 2, 2)); 49 REPORTER_ASSERT(r, eq(a.sqrt(), 2, 2));
54 50
55 REPORTER_ASSERT(r, eq(Sk2x<T>::Min(a, d), 2, 4)); 51 REPORTER_ASSERT(r, eq(Sk2x<T>::Min(a, d), 2, 4));
56 REPORTER_ASSERT(r, eq(Sk2x<T>::Max(a, d), 4, 5)); 52 REPORTER_ASSERT(r, eq(Sk2x<T>::Max(a, d), 4, 5));
57 53
58 // A bit of both. 54 // A bit of both.
59 a += d; 55 a += d;
60 a *= d; 56 a *= d;
61 a -= d; 57 a -= d;
62 REPORTER_ASSERT(r, eq(a, 10,40)); 58 REPORTER_ASSERT(r, eq(a, 10, 40));
63 } 59 }
64 60
65 DEF_TEST(Sk2f, r) { test< float>(r); } 61 DEF_TEST(Sk2f, r) { test< float>(r); }
66 DEF_TEST(Sk2d, r) { test<double>(r); } 62 DEF_TEST(Sk2d, r) { test<double>(r); }
OLDNEW
« no previous file with comments | « tests/PMFloatTest.cpp ('k') | tests/Sk4xTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698