OLD | NEW |
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 "SkNx.h" | 8 #include "SkNx.h" |
9 #include "SkRandom.h" | 9 #include "SkRandom.h" |
10 #include "Test.h" | 10 #include "Test.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 assert_eq(a, 3, 4, 5, 6); | 39 assert_eq(a, 3, 4, 5, 6); |
40 assert_eq(b, 3, 4, 5, 6); | 40 assert_eq(b, 3, 4, 5, 6); |
41 assert_eq(c, 3, 4, 5, 6); | 41 assert_eq(c, 3, 4, 5, 6); |
42 assert_eq(d, 3, 4, 5, 6); | 42 assert_eq(d, 3, 4, 5, 6); |
43 | 43 |
44 assert_eq(a+b, 6, 8, 10, 12); | 44 assert_eq(a+b, 6, 8, 10, 12); |
45 assert_eq(a*b, 9, 16, 25, 36); | 45 assert_eq(a*b, 9, 16, 25, 36); |
46 assert_eq(a*b-b, 6, 12, 20, 30); | 46 assert_eq(a*b-b, 6, 12, 20, 30); |
47 assert_eq((a*b).sqrt(), 3, 4, 5, 6); | 47 assert_eq((a*b).sqrt(), 3, 4, 5, 6); |
48 assert_eq(a/b, 1, 1, 1, 1); | 48 assert_eq(a/b, 1, 1, 1, 1); |
49 assert_eq(-a, -3, -4, -5, -6); | 49 assert_eq(SkNf<N,T>(0)-a, -3, -4, -5, -6); |
50 | 50 |
51 SkNf<N,T> fours(4); | 51 SkNf<N,T> fours(4); |
52 | 52 |
53 assert_eq(fours.sqrt(), 2,2,2,2); | 53 assert_eq(fours.sqrt(), 2,2,2,2); |
54 assert_nearly_eq(0.001, fours.rsqrt0(), 0.5, 0.5, 0.5, 0.5); | 54 assert_nearly_eq(0.001, fours.rsqrt0(), 0.5, 0.5, 0.5, 0.5); |
55 assert_nearly_eq(0.001, fours.rsqrt1(), 0.5, 0.5, 0.5, 0.5); | 55 assert_nearly_eq(0.001, fours.rsqrt1(), 0.5, 0.5, 0.5, 0.5); |
56 assert_nearly_eq(0.001, fours.rsqrt2(), 0.5, 0.5, 0.5, 0.5); | 56 assert_nearly_eq(0.001, fours.rsqrt2(), 0.5, 0.5, 0.5, 0.5); |
57 | 57 |
58 assert_eq( fours. invert(), 0.25, 0.25, 0.25, 0.25); | 58 assert_eq( fours. invert(), 0.25, 0.25, 0.25, 0.25); |
59 assert_nearly_eq(0.001, fours.approxInvert(), 0.25, 0.25, 0.25, 0.25); | 59 assert_nearly_eq(0.001, fours.approxInvert(), 0.25, 0.25, 0.25, 0.25); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 b = rand.nextU() >> 16; | 147 b = rand.nextU() >> 16; |
148 REPORTER_ASSERT(r, Sk8h::Min(Sk8h(a), Sk8h(b)).kth<0>() == SkTMin(a, b))
; | 148 REPORTER_ASSERT(r, Sk8h::Min(Sk8h(a), Sk8h(b)).kth<0>() == SkTMin(a, b))
; |
149 } | 149 } |
150 #else | 150 #else |
151 for (int a = 0; a < (1<<16); a++) { | 151 for (int a = 0; a < (1<<16); a++) { |
152 for (int b = 0; b < (1<<16); b++) { | 152 for (int b = 0; b < (1<<16); b++) { |
153 REPORTER_ASSERT(r, Sk8h::Min(Sk8h(a), Sk8h(b)).kth<0>() == SkTMin(a, b))
; | 153 REPORTER_ASSERT(r, Sk8h::Min(Sk8h(a), Sk8h(b)).kth<0>() == SkTMin(a, b))
; |
154 }} | 154 }} |
155 #endif | 155 #endif |
156 } | 156 } |
OLD | NEW |