Files
PhpSpreadsheet/tests/PhpSpreadsheetTests/Calculation/Functions/Statistical/StDevATest.php
T
Mark Baker a34dd71cce Difference in variance calculations between Excel/Gnumeric and Open/LibreOffice (#1959)
* Difference in variance calculations between Excel/Gnumeric and Open/LibreOffice
* Simplify STDEV() function logic by remembering that STDEV() is simply the square root of VAR(), so we can simply use the VAR() calculaion rather than duplicating the basic logic... and also allow for the differences between Excel/Gnumeric and Open/LibreOffice
2021-03-27 18:31:24 +01:00

52 lines
1.3 KiB
PHP

<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Statistical;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\Statistical;
use PHPUnit\Framework\TestCase;
class StDevATest extends TestCase
{
protected function tearDown(): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerSTDEVA
*
* @param mixed $expectedResult
* @param mixed $values
*/
public function testSTDEVA($expectedResult, $values): void
{
$result = Statistical::STDEVA($values);
self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
}
public function providerSTDEVA()
{
return require 'tests/data/Calculation/Statistical/STDEVA.php';
}
/**
* @dataProvider providerOdsSTDEVA
*
* @param mixed $expectedResult
* @param mixed $values
*/
public function testOdsSTDEVA($expectedResult, $values): void
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE);
$result = Statistical::STDEVA($values);
self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
}
public function providerOdsSTDEVA()
{
return require 'tests/data/Calculation/Statistical/STDEVA_ODS.php';
}
}