mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-31 04:28:51 +00:00
5a9055ca6a
Fix all of Statistical. We can now use Level 10 going forward.
35 lines
1.0 KiB
PHP
35 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Statistical;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Statistical;
|
|
use PHPUnit\Framework\Attributes\DataProvider;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
// TODO run test in spreadsheet context
|
|
class LinEstTest extends TestCase
|
|
{
|
|
/**
|
|
* @param mixed[] $yValues
|
|
* @param mixed[] $xValues
|
|
*/
|
|
#[DataProvider('providerLINEST')]
|
|
public function testLINEST(array $expectedResult, array $yValues, array $xValues, mixed $const, mixed $stats): void
|
|
{
|
|
$result = Statistical\Trends::LINEST($yValues, $xValues, $const, $stats);
|
|
self::assertIsArray($result);
|
|
|
|
$elements = count($expectedResult);
|
|
for ($element = 0; $element < $elements; ++$element) {
|
|
self::assertEqualsWithDelta($expectedResult[$element], $result[$element], 1E-12);
|
|
}
|
|
}
|
|
|
|
public static function providerLINEST(): array
|
|
{
|
|
return require 'tests/data/Calculation/Statistical/LINEST.php';
|
|
}
|
|
}
|