mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-01 04:59:14 +00:00
770eddf69d
Remaining: - Calculation/LookupRef - Calculation/Statistical - Shared/OLE - Odds and ends
34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
|
|
|
|
use PHPUnit\Framework\Attributes\DataProvider;
|
|
|
|
class MdeTermTest extends AllSetupTeardown
|
|
{
|
|
/** @param array<mixed>|float|int|string $matrix */
|
|
#[DataProvider('providerMDETERM')]
|
|
public function testMDETERM2(float|int|string $expectedResult, array|int|float|string $matrix): void
|
|
{
|
|
$this->mightHaveException($expectedResult);
|
|
$sheet = $this->getSheet();
|
|
if (is_array($matrix)) {
|
|
$sheet->fromArray($matrix, null, 'A1', true);
|
|
$maxCol = $sheet->getHighestColumn();
|
|
$maxRow = $sheet->getHighestRow();
|
|
$sheet->getCell('Z1')->setValue("=MDETERM(A1:$maxCol$maxRow)");
|
|
} else {
|
|
$sheet->getCell('Z1')->setValue("=MDETERM($matrix)");
|
|
}
|
|
$result = $sheet->getCell('Z1')->getCalculatedValue();
|
|
self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
|
|
}
|
|
|
|
public static function providerMDETERM(): array
|
|
{
|
|
return require 'tests/data/Calculation/MathTrig/MDETERM.php';
|
|
}
|
|
}
|