GeoMeanTest.php 808 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Statistical;
  3. use PhpOffice\PhpSpreadsheet\Calculation\Functions;
  4. use PhpOffice\PhpSpreadsheet\Calculation\Statistical;
  5. use PHPUnit\Framework\TestCase;
  6. class GeoMeanTest extends TestCase
  7. {
  8. protected function setUp(): void
  9. {
  10. Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
  11. }
  12. /**
  13. * @dataProvider providerGEOMEAN
  14. *
  15. * @param mixed $expectedResult
  16. */
  17. public function testGEOMEAN($expectedResult, ...$args): void
  18. {
  19. $result = Statistical::GEOMEAN(...$args);
  20. self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
  21. }
  22. public function providerGEOMEAN(): array
  23. {
  24. return require 'tests/data/Calculation/Statistical/GEOMEAN.php';
  25. }
  26. }