mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-28 16:08:11 +00:00
a34dd71cce
* 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
52 lines
1.3 KiB
PHP
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 VarATest extends TestCase
|
|
{
|
|
protected function tearDown(): void
|
|
{
|
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
|
|
}
|
|
|
|
/**
|
|
* @dataProvider providerVARA
|
|
*
|
|
* @param mixed $expectedResult
|
|
* @param mixed $values
|
|
*/
|
|
public function testVARA($expectedResult, $values): void
|
|
{
|
|
$result = Statistical::VARA($values);
|
|
self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
|
|
}
|
|
|
|
public function providerVARA()
|
|
{
|
|
return require 'tests/data/Calculation/Statistical/VARA.php';
|
|
}
|
|
|
|
/**
|
|
* @dataProvider providerOdsVARA
|
|
*
|
|
* @param mixed $expectedResult
|
|
* @param mixed $values
|
|
*/
|
|
public function testOdsVARA($expectedResult, $values): void
|
|
{
|
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE);
|
|
|
|
$result = Statistical::VARA($values);
|
|
self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
|
|
}
|
|
|
|
public function providerOdsVARA()
|
|
{
|
|
return require 'tests/data/Calculation/Statistical/VARA_ODS.php';
|
|
}
|
|
}
|