Skip to content

Commit e87be5e

Browse files
authored
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.
1 parent a7a48bf commit e87be5e

File tree

1 file changed

+12
-0
lines changed
  • tests/PhpSpreadsheetTests/Calculation/Functions/Engineering

1 file changed

+12
-0
lines changed

tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ImCscTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ public function testImCscArray(array $expectedResult, string $complex): void
5252

5353
$formula = "=IMCSC({$complex})";
5454
$result = $calculation->_calculateFormulaValue($formula);
55+
// Avoid testing for excess precision
56+
foreach ($expectedResult as &$array) {
57+
foreach ($array as &$string) {
58+
$string = preg_replace('/(\\d{8})\\d+/', '$1', $string);
59+
}
60+
}
61+
foreach ($result as &$array) {
62+
foreach ($array as &$string) {
63+
$string = preg_replace('/(\\d{8})\\d+/', '$1', $string);
64+
}
65+
}
66+
5567
self::assertEquals($expectedResult, $result);
5668
}
5769

0 commit comments

Comments
 (0)