SHA256
1
0
forked from pool/icu
icu/icu-fix-testTemperature.patch

31 lines
1.3 KiB
Diff
Raw Normal View History

From 7c9bad02d26a59466c760a28989f7045c8f133ad Mon Sep 17 00:00:00 2001
From: Hugo van der Merwe <17109322+hugovdm@users.noreply.github.com>
Date: Fri, 6 Nov 2020 17:55:21 +0000
Subject: [PATCH] ICU-21366 testConverter: allow some double-precision error
for 0.0
See #1443
---
icu4c/source/test/intltest/units_test.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Index: icu/source/test/intltest/units_test.cpp
===================================================================
--- icu.orig/source/test/intltest/units_test.cpp
+++ icu/source/test/intltest/units_test.cpp
@@ -252,9 +252,12 @@ void UnitsTest::testTemperature() {
ConversionRates conversionRates(status);
UnitConverter converter(source, target, conversionRates, status);
+ double maxDelta = 1e-6 * uprv_fabs(testCase.expectedValue);
+ if (testCase.expectedValue == 0) {
+ maxDelta = 1e-12;
+ }
assertEqualsNear(UnicodeString("testTemperature: ") + testCase.source + " to " + testCase.target,
- testCase.expectedValue, converter.convert(testCase.inputValue),
- 0.0001 * uprv_fabs(testCase.expectedValue));
+ testCase.expectedValue, converter.convert(testCase.inputValue), maxDelta);
}
}