mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-10-02 09:57:25 +00:00
70b4ecd4d3
They aren't quite interchangeable. Both are used in the test suite, with no indication of why one or the other. I think we'd be best off being consistent. Based on the names, I think `_calculateFormulaValue` was intended as a private, or at least internal, method, so favor `calculateFormula`. I do not intend to rename or re-categorize `_calculateFormulaValue`, just remove its usage when it isn't clearly warranted.
47 lines
1.5 KiB
PHP
47 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Statistical;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
|
|
|
|
class TDistTest extends AllSetupTeardown
|
|
{
|
|
#[\PHPUnit\Framework\Attributes\DataProvider('providerTDIST')]
|
|
public function testTDIST(mixed $expectedResult, mixed $value, mixed $degrees, mixed $tails): void
|
|
{
|
|
$this->runTestCaseReference('TDIST', $expectedResult, $value, $degrees, $tails);
|
|
}
|
|
|
|
public static function providerTDIST(): array
|
|
{
|
|
return require 'tests/data/Calculation/Statistical/TDIST.php';
|
|
}
|
|
|
|
#[\PHPUnit\Framework\Attributes\DataProvider('providerTDistArray')]
|
|
public function testTDistArray(array $expectedResult, string $values, string $degrees, string $tails): void
|
|
{
|
|
$calculation = Calculation::getInstance();
|
|
|
|
$formula = "=TDIST({$values}, {$degrees}, {$tails})";
|
|
$result = $calculation->calculateFormula($formula);
|
|
self::assertEqualsWithDelta($expectedResult, $result, 1.0e-14);
|
|
}
|
|
|
|
public static function providerTDistArray(): array
|
|
{
|
|
return [
|
|
'row/column vectors' => [
|
|
[
|
|
[0.020259663176916964, 0.06966298427942164, 0.040258118978631297],
|
|
[0.04051932635383393, 0.13932596855884327, 0.08051623795726259],
|
|
],
|
|
'2',
|
|
'{1.5, 3.5, 8}',
|
|
'{1; 2}',
|
|
],
|
|
];
|
|
}
|
|
}
|