mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-10-09 13:26:33 +00:00
Text function array value tests, plus some cleanup
This commit is contained in:
@@ -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"}'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user