Text function array value tests, plus some cleanup

This commit is contained in:
MarkBaker
2022-02-11 12:34:29 +01:00
parent 5ab3cbc8db
commit df12b06c59
20 changed files with 281 additions and 50 deletions
@@ -2,6 +2,8 @@
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\TextData;
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
class CodeTest extends AllSetupTeardown
{
/**
@@ -28,4 +30,25 @@ class CodeTest extends AllSetupTeardown
{
return require 'tests/data/Calculation/TextData/CODE.php';
}
/**
* @dataProvider providerCodeArray
*/
public function testCodeArray(array $expectedResult, string $array): void
{
$calculation = Calculation::getInstance();
$formula = "=CODE({$array})";
$result = $calculation->_calculateFormulaValue($formula);
self::assertEqualsWithDelta($expectedResult, $result, 1.0e-14);
}
public function providerCodeArray(): array
{
return [
'row vector' => [[[80, 72, 80]], '{"P", "H", "P"}'],
'column vector' => [[[80], [72], [80]], '{"P"; "H"; "P"}'],
'matrix' => [[[89, 111], [108, 111]], '{"Y", "o"; "l", "o"}'],
];
}
}