From ab6f9ef34a2b116c6f64bf3b89d174fbce574fab Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Tue, 11 Aug 2020 16:44:39 -0500 Subject: [PATCH] don't use out of range float values in the test These doubles are sometimes used as doubles and sometimes floats, but it doesn't make sense to use values that can't be a float as one. Just skip those in the test combinatorics. Change-Id: Ibfdb699cac80b260258b164f95361110eb85c152 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309483 Reviewed-by: Mike Klein Reviewed-by: Mike Reed Commit-Queue: Mike Klein --- tests/ScaleToSidesTest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/ScaleToSidesTest.cpp b/tests/ScaleToSidesTest.cpp index 1b217fc4cb..5e2c1eee87 100644 --- a/tests/ScaleToSidesTest.cpp +++ b/tests/ScaleToSidesTest.cpp @@ -50,6 +50,12 @@ DEF_TEST(ScaleToSides, reporter) { for (int i = 0; i < numInterestingValues; i++) { for (int j = 0; j < numInterestingValues; j++) { for (int k = 0; k < numInterestingValues; k++) { + // We're about to cast values i and j to float, don't bother if they won't fit. + // (Is there a more robust way to test this, like SkTFitsIn but double->float?) + if (interestingValues[i] > FLT_MAX || + interestingValues[j] > FLT_MAX) { + continue; + } float radius1 = (float)interestingValues[i]; float radius2 = (float)interestingValues[j]; double width = interestingValues[k];