mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-23 00:30:09 +00:00
95b8c4d59b
* Continue MathTrig Breakup - Completion! Continuing the process of breaking MathTrip.php up into smaller classes. This round takes care of everything that was left: - ABS - DEGREES - EXP - RADIANS - SQRT - SQRTPI - SUMSQ, SUMX2MY2, SUMX2PY2, SUMXMY2 The only notable logic change was that the 3 SUMX* functions had accepted arrays of unlike length; in that condition, they now return N/A, as Excel does. There had been no tests for this condition. All the functions in MathTrig.php are now deprecated. Except for COMBIN, the test suite executes them only from MathTrig MovedFunctionsTest. COMBIN is still directly called by some Statistics Binomial functions which have not yet had the opportunity to be re-coded for the new location. Co-authored-by: Mark Baker <mark@lange.demon.co.uk>
34 lines
937 B
PHP
34 lines
937 B
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
|
|
|
|
class SqrtPiTest extends AllSetupTeardown
|
|
{
|
|
/**
|
|
* @dataProvider providerSQRTPI
|
|
*
|
|
* @param mixed $expectedResult
|
|
* @param mixed $number
|
|
*/
|
|
public function testSQRTPI($expectedResult, $number): void
|
|
{
|
|
$this->mightHaveException($expectedResult);
|
|
$sheet = $this->sheet;
|
|
if ($number !== null) {
|
|
$sheet->getCell('A1')->setValue($number);
|
|
}
|
|
if ($number === 'omitted') {
|
|
$sheet->getCell('B1')->setValue('=SQRTPI()');
|
|
} else {
|
|
$sheet->getCell('B1')->setValue('=SQRTPI(A1)');
|
|
}
|
|
$result = $sheet->getCell('B1')->getCalculatedValue();
|
|
self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
|
|
}
|
|
|
|
public function providerSQRTPI()
|
|
{
|
|
return require 'tests/data/Calculation/MathTrig/SQRTPI.php';
|
|
}
|
|
}
|