From e87be5e16d411063a5b4ebaf61061784cdcc3402 Mon Sep 17 00:00:00 2001 From: oleibman <10341515+oleibman@users.noreply.github.com> Date: Fri, 4 Mar 2022 00:11:04 -0800 Subject: [PATCH] Failing Test Requiring Too Much Precision (#2647) The new array tests for IMCSC fail on my system because of a rounding error in the 14th (!) decimal position. This is not a real failure. Change the test to use only the first 8 decimal positions. --- .../Calculation/Functions/Engineering/ImCscTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php index ee21bd1a..bb1ca92b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php @@ -52,6 +52,18 @@ class ImCscTest extends TestCase $formula = "=IMCSC({$complex})"; $result = $calculation->_calculateFormulaValue($formula); + // Avoid testing for excess precision + foreach ($expectedResult as &$array) { + foreach ($array as &$string) { + $string = preg_replace('/(\\d{8})\\d+/', '$1', $string); + } + } + foreach ($result as &$array) { + foreach ($array as &$string) { + $string = preg_replace('/(\\d{8})\\d+/', '$1', $string); + } + } + self::assertEquals($expectedResult, $result); }