mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-10-01 17:37:34 +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.
48 lines
1.5 KiB
PHP
48 lines
1.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Statistical;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
|
|
|
|
class GammaInvTest extends AllSetupTeardown
|
|
{
|
|
#[\PHPUnit\Framework\Attributes\DataProvider('providerGAMMAINV')]
|
|
public function testGAMMAINV(mixed $expectedResult, mixed ...$args): void
|
|
{
|
|
$this->runTestCases('GAMMA.INV', $expectedResult, ...$args);
|
|
}
|
|
|
|
public static function providerGAMMAINV(): array
|
|
{
|
|
return require 'tests/data/Calculation/Statistical/GAMMAINV.php';
|
|
}
|
|
|
|
#[\PHPUnit\Framework\Attributes\DataProvider('providerGammaInvArray')]
|
|
public function testGammaInvArray(array $expectedResult, string $values, string $alpha, string $beta): void
|
|
{
|
|
$calculation = Calculation::getInstance();
|
|
|
|
$formula = "=GAMMA.INV({$values}, {$alpha}, {$beta})";
|
|
$result = $calculation->calculateFormula($formula);
|
|
self::assertEqualsWithDelta($expectedResult, $result, 1.0e-14);
|
|
}
|
|
|
|
public static function providerGammaInvArray(): array
|
|
{
|
|
return [
|
|
'row/column vectors' => [
|
|
[
|
|
[2.772588722239782, 5.38526905777939, 12.548861396889375],
|
|
[5.545177444479563, 10.77053811555878, 25.09772279377875],
|
|
[6.931471805599453, 13.463172644448473, 31.372153492223436],
|
|
],
|
|
'0.75',
|
|
'{1, 2, 5}',
|
|
'{2; 4; 5}',
|
|
],
|
|
];
|
|
}
|
|
}
|