LogInvTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Statistical;
  3. use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
  4. use PhpOffice\PhpSpreadsheet\Calculation\Statistical;
  5. use PHPUnit\Framework\TestCase;
  6. class LogInvTest extends TestCase
  7. {
  8. /**
  9. * @dataProvider providerLOGINV
  10. *
  11. * @param mixed $expectedResult
  12. */
  13. public function testLOGINV($expectedResult, ...$args): void
  14. {
  15. $result = Statistical::LOGINV(...$args);
  16. self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
  17. }
  18. public function providerLOGINV(): array
  19. {
  20. return require 'tests/data/Calculation/Statistical/LOGINV.php';
  21. }
  22. /**
  23. * @dataProvider providerLogInvArray
  24. */
  25. public function testLogInvArray(array $expectedResult, string $probabilities, string $mean, string $stdDev): void
  26. {
  27. $calculation = Calculation::getInstance();
  28. $formula = "=LOGINV({$probabilities}, {$mean}, {$stdDev})";
  29. $result = $calculation->_calculateFormulaValue($formula);
  30. self::assertEqualsWithDelta($expectedResult, $result, 1.0e-14);
  31. }
  32. public function providerLogInvArray(): array
  33. {
  34. return [
  35. 'row/column vectors' => [
  36. [[54.598150033144236, 403.4287934927351]],
  37. '0.5',
  38. '{4, 6}',
  39. '7',
  40. ],
  41. ];
  42. }
  43. }