Files
PhpSpreadsheet/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/BinomInvTest.php
T
Mark Baker 029f345987 Extract Binomial Distribution functions from Statistical (#1974)
* Extract Binomial Distribution functions from Statistical
Replace the old MS algorithm for CRITBINOM() (which has now been replaced with te BINOM.INV() function) with a brute force approach - I'll look to refine it later. The MS algorithm is no longer documented, and the implementation produced erroneous results anyway

* Exract the NEGBINOMDIST() function as well; still need to add a cumulative flag to support the additional argument for the newer NEGBINOM.DIST() function
* Rationalise validation of probability arguments
2021-03-30 22:49:10 +02:00

32 lines
808 B
PHP

<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Statistical;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Statistical;
use PHPUnit\Framework\TestCase;
class BinomInvTest extends TestCase
{
protected function setUp(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerBINOMINV
*
* @param mixed $expectedResult
*/
public function testBINOMINV($expectedResult, ...$args): void
{
$result = Statistical::CRITBINOM(...$args);
self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
}
public function providerBINOMINV()
{
return require 'tests/data/Calculation/Statistical/BINOMINV.php';
}
}