aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/MathTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/MathTest.cpp')
-rw-r--r--tests/MathTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp
index 31bb45308c..94b15207f7 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -691,6 +691,17 @@ DEF_TEST(FloatSaturate32, reporter) {
for (auto r : recs) {
int i = sk_float_saturate2int(r.fFloat);
REPORTER_ASSERT(reporter, r.fExpectedInt == i);
+
+ // ensure that these bound even non-finite values (including NaN)
+
+ SkScalar mx = SkTMax<SkScalar>(r.fFloat, 50);
+ REPORTER_ASSERT(reporter, mx >= 50);
+
+ SkScalar mn = SkTMin<SkScalar>(r.fFloat, 50);
+ REPORTER_ASSERT(reporter, mn <= 50);
+
+ SkScalar p = SkTPin<SkScalar>(r.fFloat, 0, 100);
+ REPORTER_ASSERT(reporter, p >= 0 && p <= 100);
}
}