MInverseTest.php 949 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
  3. use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
  4. class MInverseTest extends AllSetupTeardown
  5. {
  6. /**
  7. * @dataProvider providerMINVERSE
  8. *
  9. * @param mixed $expectedResult
  10. */
  11. public function testMINVERSE($expectedResult, array $args): void
  12. {
  13. $result = MathTrig\MatrixFunctions::inverse($args);
  14. self::assertEqualsWithDelta($expectedResult, $result, 1E-8);
  15. }
  16. public function providerMINVERSE(): array
  17. {
  18. return require 'tests/data/Calculation/MathTrig/MINVERSE.php';
  19. }
  20. public function testOnSpreadsheet(): void
  21. {
  22. // very limited ability to test this in the absence of dynamic arrays
  23. $sheet = $this->getSheet();
  24. $sheet->getCell('A1')->setValue('=MINVERSE({1,2,3})'); // not square
  25. self::assertSame('#VALUE!', $sheet->getCell('A1')->getCalculatedValue());
  26. }
  27. }