mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-10-01 01:19:11 +00:00
5b4d7fcdc8
T.DIST takes 3 parameters. When the 3rd parameter, a boolean, is true, we now have code to support the request. We still do not have code to handle the false case.
54 lines
1.6 KiB
PHP
54 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Statistical;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
|
|
use PHPUnit\Framework\Attributes\DataProvider;
|
|
|
|
class TdotDistTrueTest extends AllSetupTeardown
|
|
{
|
|
#[DataProvider('providerTdotDistTrue')]
|
|
public function testTdotDistTrue(mixed $expectedResult, mixed $value, mixed $degrees): void
|
|
{
|
|
$this->runTestCaseReference('T.DIST', $expectedResult, $value, $degrees, true);
|
|
}
|
|
|
|
public static function providerTdotDistTrue(): array
|
|
{
|
|
return require 'tests/data/Calculation/Statistical/tDotDistTrue.php';
|
|
}
|
|
|
|
public function testTdotDistFalse(): void
|
|
{
|
|
$expectedResult = null; // not yet implemented is converted to old calculated value, which is null
|
|
$value = 1;
|
|
$degrees = 10;
|
|
$this->runTestCaseReference('T.DIST', $expectedResult, $value, $degrees, false);
|
|
}
|
|
|
|
#[DataProvider('providerTdotDistArray')]
|
|
public function testTdotDistArray(array $expectedResult, string $values, string $degrees): void
|
|
{
|
|
$calculation = Calculation::getInstance();
|
|
|
|
$formula = "=T.DIST({$values}, {$degrees}, true)";
|
|
$result = $calculation->calculateFormula($formula);
|
|
self::assertEqualsWithDelta($expectedResult, $result, 1.0e-6);
|
|
}
|
|
|
|
public static function providerTdotDistArray(): array
|
|
{
|
|
return [
|
|
'row/column vectors' => [
|
|
[
|
|
[0.852416, 0.930337, 0.959742],
|
|
],
|
|
'2',
|
|
'{1.5, 3.5, 8}',
|
|
],
|
|
];
|
|
}
|
|
}
|