mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-28 11:07:52 +00:00
1b05dfab8b
And quite a bit more manual changes. The idea is that typing of our tests can be a bit more loose, so we assume PHPDoc is mostly correct. If that happens to be wrong, it should be caught by the tests themselves.
30 lines
900 B
PHP
30 lines
900 B
PHP
<?php
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Statistical;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Statistical;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
// TODO run test in spreadsheet context
|
|
class LinEstTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider providerLINEST
|
|
*/
|
|
public function testLINEST(array $expectedResult, mixed $yValues, mixed $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';
|
|
}
|
|
}
|