From a1d8541d312759c69d6f7714559768c7f1f4e7ba Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Thu, 18 Feb 2021 23:36:40 +0100 Subject: [PATCH 1/2] Additional Unit Test Cases --- .../Functions/Engineering/ConvertUoMTest.php | 6 ++++ .../Calculation/Engineering/CONVERTUOM.php | 28 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php index 7a18067fd2..cf43c7598a 100644 --- a/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/Functions/Engineering/ConvertUoMTest.php @@ -37,6 +37,12 @@ public function testGetConversionMultipliers(): void self::assertIsArray($result); } + public function testGetBinaryConversionMultipliers(): void + { + $result = Engineering::getBinaryConversionMultipliers(); + self::assertIsArray($result); + } + /** * @dataProvider providerCONVERTUOM * diff --git a/tests/data/Calculation/Engineering/CONVERTUOM.php b/tests/data/Calculation/Engineering/CONVERTUOM.php index 64aaef6244..8f90c86483 100644 --- a/tests/data/Calculation/Engineering/CONVERTUOM.php +++ b/tests/data/Calculation/Engineering/CONVERTUOM.php @@ -139,6 +139,18 @@ 'K', 'Reau', ], + 'Melting Point of Titanium (Rankine to K)' => [ + 1941, + 3493.8, + 'Rank', + 'K', + ], + 'Melting Point of Titanium (RĂ©aumur to K)' => [ + 1941, + 1334.28, + 'Reau', + 'K', + ], 'Temperature synonyms (K)' => [ 123.45, 123.45, @@ -175,18 +187,30 @@ 'ft', 'day', ], - 'From Prefixed imperial (Invalid)' => [ + 'From prefixed Imperial (Invalid)' => [ '#N/A', 234.56, 'kpt', 'lt', ], - 'To prefixed imperial (Invalid)' => [ + 'To prefixed Imperial (Invalid)' => [ '#N/A', 234.56, 'lt', 'kpt', ], + 'From binary prefixed Imperial (Invalid)' => [ + '#N/A', + 234.56, + 'kilt', + 'pt', + ], + 'To binary prefixed Imperial (Invalid)' => [ + '#N/A', + 234.56, + 'pt', + 'kilt', + ], 'Invalid from unit' => [ '#N/A', 234.56, From cfcdc1ddcbd019404489cb5954d8ace351931b47 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Fri, 19 Feb 2021 08:26:34 +0100 Subject: [PATCH 2/2] Additional Unit Test Cases --- .../Calculation/Engineering/CONVERTUOM.php | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/data/Calculation/Engineering/CONVERTUOM.php b/tests/data/Calculation/Engineering/CONVERTUOM.php index 8f90c86483..420fa2d001 100644 --- a/tests/data/Calculation/Engineering/CONVERTUOM.php +++ b/tests/data/Calculation/Engineering/CONVERTUOM.php @@ -169,12 +169,18 @@ 'F', 'fah', ], - 'Invalid value to conver' => [ + 'Invalid value to convert' => [ '#VALUE!', 'three', 'ft', 'yds', ], + 'Imperial to 2-character prefixed imperial, same unit' => [ + '#N/A', + 100.0, + 'pt', + 'dapt', + ], 'Prefixed metric to binary prefixed metric' => [ '#N/A', 12.345, @@ -202,14 +208,26 @@ 'From binary prefixed Imperial (Invalid)' => [ '#N/A', 234.56, - 'kilt', + 'kiqt', 'pt', ], 'To binary prefixed Imperial (Invalid)' => [ '#N/A', 234.56, 'pt', - 'kilt', + 'kiqt', + ], + 'From prefixed Imperial 2 (Invalid)' => [ + '#N/A', + 12345.6, + 'baton', + 'cwt', + ], + 'To prefixed Imperial 2 (Invalid)' => [ + '#N/A', + 12345.6, + 'cwt', + 'baton', ], 'Invalid from unit' => [ '#N/A',