-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation of MS Excel's LOGNORM.DIST(), NORM.S.DIST(), F.DIST(),…
… GAUSS() and GAMMA() functions (#1588) * `GAUSS()` and `GAMMA()`, `NORM.S.DIST()`, `LOGNORM.DIST()` and `F.DIST()` function implementations, and further unit tests for a number of the statistical functions Co-authored-by: Adrien Crivelli <[email protected]>
- Loading branch information
Showing
25 changed files
with
602 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/FDist2Test.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Statistical; | ||
|
||
use PhpOffice\PhpSpreadsheet\Calculation\Statistical; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class FDist2Test extends TestCase | ||
{ | ||
/** | ||
* @dataProvider providerFDIST2 | ||
* | ||
* @param mixed $expectedResult | ||
*/ | ||
public function testFDIST2($expectedResult, ...$args): void | ||
{ | ||
$result = Statistical::FDIST2(...$args); | ||
self::assertEqualsWithDelta($expectedResult, $result, 1E-12); | ||
} | ||
|
||
public function providerFDIST2(): array | ||
{ | ||
return require 'tests/data/Calculation/Statistical/FDIST2.php'; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/GammaTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Statistical; | ||
|
||
use PhpOffice\PhpSpreadsheet\Calculation\Statistical; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class GammaTest extends TestCase | ||
{ | ||
/** | ||
* @dataProvider providerGAMMA | ||
* | ||
* @param mixed $expectedResult | ||
* @param mixed $testValue | ||
*/ | ||
public function testGAMMA($expectedResult, $testValue): void | ||
{ | ||
$result = Statistical::GAMMAFunction($testValue); | ||
self::assertEqualsWithDelta($expectedResult, $result, 1E-12); | ||
} | ||
|
||
public function providerGAMMA(): array | ||
{ | ||
return require 'tests/data/Calculation/Statistical/GAMMA.php'; | ||
} | ||
} |
Oops, something went wrong.