RankTest.php 914 B

12345678910111213141516171819202122232425262728293031323334
  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 RankTest extends TestCase
  7. {
  8. protected function setUp(): void
  9. {
  10. Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
  11. }
  12. /**
  13. * @dataProvider providerRANK
  14. *
  15. * @param mixed $expectedResult
  16. * @param mixed $value
  17. * @param mixed[] $valueSet
  18. * @param mixed $order
  19. */
  20. public function testRANK($expectedResult, $value, $valueSet, $order = 0): void
  21. {
  22. $result = Statistical::RANK($value, $valueSet, $order);
  23. self::assertEqualsWithDelta($expectedResult, $result, 1E-12);
  24. }
  25. public function providerRANK(): array
  26. {
  27. return require 'tests/data/Calculation/Statistical/RANK.php';
  28. }
  29. }