diff --git a/tests/PhpSpreadsheetTests/Calculation/StatisticalTest.php b/tests/PhpSpreadsheetTests/Calculation/StatisticalTest.php index 97238913..92b52116 100644 --- a/tests/PhpSpreadsheetTests/Calculation/StatisticalTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/StatisticalTest.php @@ -253,6 +253,22 @@ class StatisticalTest extends TestCase return require 'data/Calculation/Statistical/FORECAST.php'; } + /** + * @dataProvider providerINTERCEPT + * + * @param mixed $expectedResult + */ + public function testINTERCEPT($expectedResult, array $xargs, array $yargs) + { + $result = Statistical::INTERCEPT($xargs, $yargs); + self::assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerINTERCEPT() + { + return require 'data/Calculation/Statistical/INTERCEPT.php'; + } + /** * @dataProvider providerMAXIFS * @@ -284,4 +300,52 @@ class StatisticalTest extends TestCase { return require 'data/Calculation/Statistical/MINIFS.php'; } + + /** + * @dataProvider providerRSQ + * + * @param mixed $expectedResult + */ + public function testRSQ($expectedResult, array $xargs, array $yargs) + { + $result = Statistical::RSQ($xargs, $yargs); + self::assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerRSQ() + { + return require 'data/Calculation/Statistical/RSQ.php'; + } + + /** + * @dataProvider providerSLOPE + * + * @param mixed $expectedResult + */ + public function testSLOPE($expectedResult, array $xargs, array $yargs) + { + $result = Statistical::SLOPE($xargs, $yargs); + self::assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSLOPE() + { + return require 'data/Calculation/Statistical/SLOPE.php'; + } + + /** + * @dataProvider providerSTEYX + * + * @param mixed $expectedResult + */ + public function testSTEYX($expectedResult, array $xargs, array $yargs) + { + $result = Statistical::STEYX($xargs, $yargs); + self::assertEquals($expectedResult, $result, '', 1E-12); + } + + public function providerSTEYX() + { + return require 'data/Calculation/Statistical/STEYX.php'; + } } diff --git a/tests/data/Calculation/Statistical/FORECAST.php b/tests/data/Calculation/Statistical/FORECAST.php index c6abbb65..77d2ab8f 100644 --- a/tests/data/Calculation/Statistical/FORECAST.php +++ b/tests/data/Calculation/Statistical/FORECAST.php @@ -37,4 +37,10 @@ return [ [-1, -2, -3, -4], [10, 20, 30, 40], ], + [ + 32.666666666667, + 7, + [3, 7, 15, 20, 22, 27], + [1, 2, 3, 4, 5, 6], + ], ]; diff --git a/tests/data/Calculation/Statistical/INTERCEPT.php b/tests/data/Calculation/Statistical/INTERCEPT.php new file mode 100644 index 00000000..f68fdd98 --- /dev/null +++ b/tests/data/Calculation/Statistical/INTERCEPT.php @@ -0,0 +1,29 @@ +