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 "Sk4px.h" | 8 #include "Sk4px.h" |
9 #include "SkNx.h" | 9 #include "SkNx.h" |
10 #include "SkRandom.h" | 10 #include "SkRandom.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 DEF_TEST(SkNx_cast, r) { | 210 DEF_TEST(SkNx_cast, r) { |
211 Sk4f fs(-1.7f, -1.4f, 0.5f, 1.9f); | 211 Sk4f fs(-1.7f, -1.4f, 0.5f, 1.9f); |
212 Sk4i is = SkNx_cast<int>(fs); | 212 Sk4i is = SkNx_cast<int>(fs); |
213 | 213 |
214 REPORTER_ASSERT(r, is.kth<0>() == -1); | 214 REPORTER_ASSERT(r, is.kth<0>() == -1); |
215 REPORTER_ASSERT(r, is.kth<1>() == -1); | 215 REPORTER_ASSERT(r, is.kth<1>() == -1); |
216 REPORTER_ASSERT(r, is.kth<2>() == 0); | 216 REPORTER_ASSERT(r, is.kth<2>() == 0); |
217 REPORTER_ASSERT(r, is.kth<3>() == 1); | 217 REPORTER_ASSERT(r, is.kth<3>() == 1); |
218 } | 218 } |
| 219 |
| 220 DEF_TEST(SkNx_abs, r) { |
| 221 auto fs = Sk4f(0.0f, -0.0f, 2.0f, -4.0f).abs(); |
| 222 REPORTER_ASSERT(r, fs.kth<0>() == 0.0f); |
| 223 REPORTER_ASSERT(r, fs.kth<1>() == 0.0f); |
| 224 REPORTER_ASSERT(r, fs.kth<2>() == 2.0f); |
| 225 REPORTER_ASSERT(r, fs.kth<3>() == 4.0f); |
| 226 } |
OLD | NEW |