StDevATest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 StDevATest extends TestCase
  7. {
  8. protected function tearDown(): void
  9. {
  10. Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
  11. }
  12. /**
  13. * @dataProvider providerSTDEVA
  14. *
  15. * @param mixed $expectedResult
  16. * @param mixed $values
  17. */
  18. public function testSTDEVA($expectedResult, $values): void
  19. {
  20. $result = Statistical::STDEVA($values);
  21. self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
  22. }
  23. public function providerSTDEVA(): array
  24. {
  25. return require 'tests/data/Calculation/Statistical/STDEVA.php';
  26. }
  27. /**
  28. * @dataProvider providerOdsSTDEVA
  29. *
  30. * @param mixed $expectedResult
  31. * @param mixed $values
  32. */
  33. public function testOdsSTDEVA($expectedResult, $values): void
  34. {
  35. Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE);
  36. $result = Statistical::STDEVA($values);
  37. self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
  38. }
  39. public function providerOdsSTDEVA(): array
  40. {
  41. return require 'tests/data/Calculation/Statistical/STDEVA_ODS.php';
  42. }
  43. }