Refactoring of math trig tests (#1102)

* Merge branch 'master' of C:\Projects\PHPOffice\PHPSpreadsheet\develop with conflicts.

* First pass at moving MathTrig tests into individual test files

* Appeasement to the great goddess PHPCS

* Appeasement to the great goddess PHPCS

* Minor scrutinizer issue resolved

* More refactoring of tests into individual test files fr each math/trig function

* More work on the math/trig test refactoring, plus a bit of tidyup of date/time tests as well

* Fix test

* Fix docblock in test

* Finish refactoring Math/Trig tests into separate files

* Fix SubTotal Test

* Import additional classes for SubTotal test
This commit is contained in:
Mark Baker 2019-07-23 00:50:30 +02:00 committed by GitHub
parent 9ad6de620e
commit 342ffb629b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 1780 additions and 1454 deletions

View File

@ -20,10 +20,13 @@ class DateDifTest extends TestCase
* @dataProvider providerDATEDIF * @dataProvider providerDATEDIF
* *
* @param mixed $expectedResult * @param mixed $expectedResult
* @param $startDate
* @param $endDate
* @param $unit
*/ */
public function testDATEDIF($expectedResult, ...$args) public function testDATEDIF($expectedResult, $startDate, $endDate, $unit)
{ {
$result = DateTime::DATEDIF(...$args); $result = DateTime::DATEDIF($startDate, $endDate, $unit);
$this->assertEquals($expectedResult, $result, '', 1E-8); $this->assertEquals($expectedResult, $result, '', 1E-8);
} }

View File

@ -20,10 +20,13 @@ class DateTest extends TestCase
* @dataProvider providerDATE * @dataProvider providerDATE
* *
* @param mixed $expectedResult * @param mixed $expectedResult
* @param $year
* @param $month
* @param $day
*/ */
public function testDATE($expectedResult, ...$args) public function testDATE($expectedResult, $year, $month, $day)
{ {
$result = DateTime::DATE(...$args); $result = DateTime::DATE($year, $month, $day);
$this->assertEquals($expectedResult, $result, '', 1E-8); $this->assertEquals($expectedResult, $result, '', 1E-8);
} }

View File

@ -20,10 +20,11 @@ class DateValueTest extends TestCase
* @dataProvider providerDATEVALUE * @dataProvider providerDATEVALUE
* *
* @param mixed $expectedResult * @param mixed $expectedResult
* @param $dateValue
*/ */
public function testDATEVALUE($expectedResult, ...$args) public function testDATEVALUE($expectedResult, $dateValue)
{ {
$result = DateTime::DATEVALUE(...$args); $result = DateTime::DATEVALUE($dateValue);
$this->assertEquals($expectedResult, $result, '', 1E-8); $this->assertEquals($expectedResult, $result, '', 1E-8);
} }

View File

@ -21,15 +21,16 @@ class DayTest extends TestCase
* *
* @param mixed $expectedResultExcel * @param mixed $expectedResultExcel
* @param mixed $expectedResultOpenOffice * @param mixed $expectedResultOpenOffice
* @param $dateValue
*/ */
public function testDAY($expectedResultExcel, $expectedResultOpenOffice, ...$args) public function testDAY($expectedResultExcel, $expectedResultOpenOffice, $dateValue)
{ {
$resultExcel = DateTime::DAYOFMONTH(...$args); $resultExcel = DateTime::DAYOFMONTH($dateValue);
$this->assertEquals($expectedResultExcel, $resultExcel, '', 1E-8); $this->assertEquals($expectedResultExcel, $resultExcel, '', 1E-8);
Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE); Functions::setCompatibilityMode(Functions::COMPATIBILITY_OPENOFFICE);
$resultOpenOffice = DateTime::DAYOFMONTH(...$args); $resultOpenOffice = DateTime::DAYOFMONTH($dateValue);
$this->assertEquals($expectedResultOpenOffice, $resultOpenOffice, '', 1E-8); $this->assertEquals($expectedResultOpenOffice, $resultOpenOffice, '', 1E-8);
} }

View File

@ -20,10 +20,13 @@ class Days360Test extends TestCase
* @dataProvider providerDAYS360 * @dataProvider providerDAYS360
* *
* @param mixed $expectedResult * @param mixed $expectedResult
* @param $startDate
* @param $endDate
* @param $method
*/ */
public function testDAYS360($expectedResult, ...$args) public function testDAYS360($expectedResult, $startDate, $endDate, $method)
{ {
$result = DateTime::DAYS360(...$args); $result = DateTime::DAYS360($startDate, $endDate, $method);
$this->assertEquals($expectedResult, $result, '', 1E-8); $this->assertEquals($expectedResult, $result, '', 1E-8);
} }

View File

@ -20,10 +20,12 @@ class DaysTest extends TestCase
* @dataProvider providerDAYS * @dataProvider providerDAYS
* *
* @param mixed $expectedResult * @param mixed $expectedResult
* @param $endDate
* @param $startDate
*/ */
public function testDAYS($expectedResult, ...$args) public function testDAYS($expectedResult, $endDate, $startDate)
{ {
$result = DateTime::DAYS(...$args); $result = DateTime::DAYS($endDate, $startDate);
$this->assertEquals($expectedResult, $result, '', 1E-8); $this->assertEquals($expectedResult, $result, '', 1E-8);
} }

View File

@ -20,10 +20,12 @@ class EDateTest extends TestCase
* @dataProvider providerEDATE * @dataProvider providerEDATE
* *
* @param mixed $expectedResult * @param mixed $expectedResult
* @param $dateValue
* @param $adjustmentMonths
*/ */
public function testEDATE($expectedResult, ...$args) public function testEDATE($expectedResult, $dateValue, $adjustmentMonths)
{ {
$result = DateTime::EDATE(...$args); $result = DateTime::EDATE($dateValue, $adjustmentMonths);
$this->assertEquals($expectedResult, $result, '', 1E-8); $this->assertEquals($expectedResult, $result, '', 1E-8);
} }

View File

@ -20,10 +20,12 @@ class EoMonthTest extends TestCase
* @dataProvider providerEOMONTH * @dataProvider providerEOMONTH
* *
* @param mixed $expectedResult * @param mixed $expectedResult
* @param $dateValue
* @param $adjustmentMonths
*/ */
public function testEOMONTH($expectedResult, ...$args) public function testEOMONTH($expectedResult, $dateValue, $adjustmentMonths)
{ {
$result = DateTime::EOMONTH(...$args); $result = DateTime::EOMONTH($dateValue, $adjustmentMonths);
$this->assertEquals($expectedResult, $result, '', 1E-8); $this->assertEquals($expectedResult, $result, '', 1E-8);
} }

View File

@ -0,0 +1,32 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class AcotTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerACOT
*
* @param mixed $expectedResult
* @param mixed $number
*/
public function testACOT($expectedResult, $number)
{
$result = MathTrig::ACOT($number);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerACOT()
{
return require 'data/Calculation/MathTrig/ACOT.php';
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class AcothTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerACOTH
*
* @param mixed $expectedResult
* @param mixed $number
*/
public function testACOTH($expectedResult, $number)
{
$result = MathTrig::ACOTH($number);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerACOTH()
{
return require 'data/Calculation/MathTrig/ACOTH.php';
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class Atan2Test extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerATAN2
*
* @param mixed $expectedResult
* @param mixed $x
* @param mixed $y
*/
public function testATAN2($expectedResult, $x, $y)
{
$result = MathTrig::ATAN2($x, $y);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerATAN2()
{
return require 'data/Calculation/MathTrig/ATAN2.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class CeilingTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerCEILING
*
* @param mixed $expectedResult
*/
public function testCEILING($expectedResult, ...$args)
{
$result = MathTrig::CEILING(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerCEILING()
{
return require 'data/Calculation/MathTrig/CEILING.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class CombinTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerCOMBIN
*
* @param mixed $expectedResult
*/
public function testCOMBIN($expectedResult, ...$args)
{
$result = MathTrig::COMBIN(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerCOMBIN()
{
return require 'data/Calculation/MathTrig/COMBIN.php';
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class CotTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerCOT
*
* @param mixed $expectedResult
* @param mixed $angle
*/
public function testCOT($expectedResult, $angle)
{
$result = MathTrig::COT($angle);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerCOT()
{
return require 'data/Calculation/MathTrig/COT.php';
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class CothTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerCOTH
*
* @param mixed $expectedResult
* @param mixed $angle
*/
public function testCOTH($expectedResult, $angle)
{
$result = MathTrig::COTH($angle);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerCOTH()
{
return require 'data/Calculation/MathTrig/COTH.php';
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class CscTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerCSC
*
* @param mixed $expectedResult
* @param mixed $angle
*/
public function testCSC($expectedResult, $angle)
{
$result = MathTrig::CSC($angle);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerCSC()
{
return require 'data/Calculation/MathTrig/CSC.php';
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class CschTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerCSCH
*
* @param mixed $expectedResult
* @param mixed $angle
*/
public function testCSCH($expectedResult, $angle)
{
$result = MathTrig::CSCH($angle);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerCSCH()
{
return require 'data/Calculation/MathTrig/CSCH.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class EvenTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerEVEN
*
* @param mixed $expectedResult
*/
public function testEVEN($expectedResult, ...$args)
{
$result = MathTrig::EVEN(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerEVEN()
{
return require 'data/Calculation/MathTrig/EVEN.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class FactDoubleTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerFACTDOUBLE
*
* @param mixed $expectedResult
*/
public function testFACTDOUBLE($expectedResult, ...$args)
{
$result = MathTrig::FACTDOUBLE(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerFACTDOUBLE()
{
return require 'data/Calculation/MathTrig/FACTDOUBLE.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class FactTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerFACT
*
* @param mixed $expectedResult
*/
public function testFACT($expectedResult, ...$args)
{
$result = MathTrig::FACT(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerFACT()
{
return require 'data/Calculation/MathTrig/FACT.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class FloorTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerFLOOR
*
* @param mixed $expectedResult
*/
public function testFLOOR($expectedResult, ...$args)
{
$result = MathTrig::FLOOR(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerFLOOR()
{
return require 'data/Calculation/MathTrig/FLOOR.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class GcdTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerGCD
*
* @param mixed $expectedResult
*/
public function testGCD($expectedResult, ...$args)
{
$result = MathTrig::GCD(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerGCD()
{
return require 'data/Calculation/MathTrig/GCD.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class IntTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerINT
*
* @param mixed $expectedResult
*/
public function testINT($expectedResult, ...$args)
{
$result = MathTrig::INT(...$args);
$this->assertEquals($expectedResult, $result);
}
public function providerINT()
{
return require 'data/Calculation/MathTrig/INT.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class LcmTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerLCM
*
* @param mixed $expectedResult
*/
public function testLCM($expectedResult, ...$args)
{
$result = MathTrig::LCM(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerLCM()
{
return require 'data/Calculation/MathTrig/LCM.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class LogTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerLOG
*
* @param mixed $expectedResult
*/
public function testLOG($expectedResult, ...$args)
{
$result = MathTrig::logBase(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerLOG()
{
return require 'data/Calculation/MathTrig/LOG.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class MInverseTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerMINVERSE
*
* @param mixed $expectedResult
*/
public function testMINVERSE($expectedResult, ...$args)
{
$result = MathTrig::MINVERSE(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-8);
}
public function providerMINVERSE()
{
return require 'data/Calculation/MathTrig/MINVERSE.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class MMultTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerMMULT
*
* @param mixed $expectedResult
*/
public function testMMULT($expectedResult, ...$args)
{
$result = MathTrig::MMULT(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-8);
}
public function providerMMULT()
{
return require 'data/Calculation/MathTrig/MMULT.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class MRoundTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerMROUND
*
* @param mixed $expectedResult
*/
public function testMROUND($expectedResult, ...$args)
{
$result = MathTrig::MROUND(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerMROUND()
{
return require 'data/Calculation/MathTrig/MROUND.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class MdeTermTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerMDETERM
*
* @param mixed $expectedResult
*/
public function testMDETERM($expectedResult, ...$args)
{
$result = MathTrig::MDETERM(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerMDETERM()
{
return require 'data/Calculation/MathTrig/MDETERM.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class ModTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerMOD
*
* @param mixed $expectedResult
*/
public function testMOD($expectedResult, ...$args)
{
$result = MathTrig::MOD(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerMOD()
{
return require 'data/Calculation/MathTrig/MOD.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class MultinomialTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerMULTINOMIAL
*
* @param mixed $expectedResult
*/
public function testMULTINOMIAL($expectedResult, ...$args)
{
$result = MathTrig::MULTINOMIAL(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerMULTINOMIAL()
{
return require 'data/Calculation/MathTrig/MULTINOMIAL.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class OddTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerODD
*
* @param mixed $expectedResult
*/
public function testODD($expectedResult, ...$args)
{
$result = MathTrig::ODD(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerODD()
{
return require 'data/Calculation/MathTrig/ODD.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class PowerTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerPOWER
*
* @param mixed $expectedResult
*/
public function testPOWER($expectedResult, ...$args)
{
$result = MathTrig::POWER(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerPOWER()
{
return require 'data/Calculation/MathTrig/POWER.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class ProductTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerPRODUCT
*
* @param mixed $expectedResult
*/
public function testPRODUCT($expectedResult, ...$args)
{
$result = MathTrig::PRODUCT(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerPRODUCT()
{
return require 'data/Calculation/MathTrig/PRODUCT.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class QuotientTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerQUOTIENT
*
* @param mixed $expectedResult
*/
public function testQUOTIENT($expectedResult, ...$args)
{
$result = MathTrig::QUOTIENT(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerQUOTIENT()
{
return require 'data/Calculation/MathTrig/QUOTIENT.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class RomanTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerROMAN
*
* @param mixed $expectedResult
*/
public function testROMAN($expectedResult, ...$args)
{
$result = MathTrig::ROMAN(...$args);
$this->assertEquals($expectedResult, $result);
}
public function providerROMAN()
{
return require 'data/Calculation/MathTrig/ROMAN.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class RoundDownTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerROUNDDOWN
*
* @param mixed $expectedResult
*/
public function testROUNDDOWN($expectedResult, ...$args)
{
$result = MathTrig::ROUNDDOWN(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerROUNDDOWN()
{
return require 'data/Calculation/MathTrig/ROUNDDOWN.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class RoundUpTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerROUNDUP
*
* @param mixed $expectedResult
*/
public function testROUNDUP($expectedResult, ...$args)
{
$result = MathTrig::ROUNDUP(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerROUNDUP()
{
return require 'data/Calculation/MathTrig/ROUNDUP.php';
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class SecTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerSEC
*
* @param mixed $expectedResult
* @param mixed $angle
*/
public function testSEC($expectedResult, $angle)
{
$result = MathTrig::SEC($angle);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSEC()
{
return require 'data/Calculation/MathTrig/SEC.php';
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class SechTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerSECH
*
* @param mixed $expectedResult
* @param mixed $angle
*/
public function testSECH($expectedResult, $angle)
{
$result = MathTrig::SECH($angle);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSECH()
{
return require 'data/Calculation/MathTrig/SECH.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class SeriesSumTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerSERIESSUM
*
* @param mixed $expectedResult
*/
public function testSERIESSUM($expectedResult, ...$args)
{
$result = MathTrig::SERIESSUM(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSERIESSUM()
{
return require 'data/Calculation/MathTrig/SERIESSUM.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class SignTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerSIGN
*
* @param mixed $expectedResult
*/
public function testSIGN($expectedResult, ...$args)
{
$result = MathTrig::SIGN(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSIGN()
{
return require 'data/Calculation/MathTrig/SIGN.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class SqrtPiTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerSQRTPI
*
* @param mixed $expectedResult
*/
public function testSQRTPI($expectedResult, ...$args)
{
$result = MathTrig::SQRTPI(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSQRTPI()
{
return require 'data/Calculation/MathTrig/SQRTPI.php';
}
}

View File

@ -0,0 +1,198 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Worksheet\ColumnDimension;
use PhpOffice\PhpSpreadsheet\Worksheet\RowDimension;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use PHPUnit\Framework\TestCase;
class SubTotalTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerSUBTOTAL
*
* @param mixed $expectedResult
*/
public function testSUBTOTAL($expectedResult, ...$args)
{
$cell = $this->getMockBuilder(Cell::class)
->setMethods(['getValue', 'isFormula'])
->disableOriginalConstructor()
->getMock();
$cell->method('getValue')
->willReturn(null);
$cell->method('getValue')
->willReturn(false);
$worksheet = $this->getMockBuilder(Worksheet::class)
->setMethods(['cellExists', 'getCell'])
->disableOriginalConstructor()
->getMock();
$worksheet->method('cellExists')
->willReturn(true);
$worksheet->method('getCell')
->willReturn($cell);
$cellReference = $this->getMockBuilder(Cell::class)
->setMethods(['getWorksheet'])
->disableOriginalConstructor()
->getMock();
$cellReference->method('getWorksheet')
->willReturn($worksheet);
array_push($args, $cellReference);
$result = MathTrig::SUBTOTAL(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSUBTOTAL()
{
return require 'data/Calculation/MathTrig/SUBTOTAL.php';
}
protected function rowVisibility()
{
$data = [1 => false, 2 => true, 3 => false, 4 => true, 5 => false, 6 => false, 7 => false, 8 => true, 9 => false, 10 => true, 11 => true];
foreach ($data as $k => $v) {
yield $k => $v;
}
}
/**
* @dataProvider providerHiddenSUBTOTAL
*
* @param mixed $expectedResult
*/
public function testHiddenSUBTOTAL($expectedResult, ...$args)
{
$visibilityGenerator = $this->rowVisibility();
$rowDimension = $this->getMockBuilder(RowDimension::class)
->setMethods(['getVisible'])
->disableOriginalConstructor()
->getMock();
$rowDimension->method('getVisible')
->will($this->returnCallback(function () use ($visibilityGenerator) {
$result = $visibilityGenerator->current();
$visibilityGenerator->next();
return $result;
}));
$columnDimension = $this->getMockBuilder(ColumnDimension::class)
->setMethods(['getVisible'])
->disableOriginalConstructor()
->getMock();
$columnDimension->method('getVisible')
->willReturn(true);
$cell = $this->getMockBuilder(Cell::class)
->setMethods(['getValue', 'isFormula'])
->disableOriginalConstructor()
->getMock();
$cell->method('getValue')
->willReturn('');
$cell->method('getValue')
->willReturn(false);
$worksheet = $this->getMockBuilder(Worksheet::class)
->setMethods(['cellExists', 'getCell', 'getRowDimension', 'getColumnDimension'])
->disableOriginalConstructor()
->getMock();
$worksheet->method('cellExists')
->willReturn(true);
$worksheet->method('getCell')
->willReturn($cell);
$worksheet->method('getRowDimension')
->willReturn($rowDimension);
$worksheet->method('getColumnDimension')
->willReturn($columnDimension);
$cellReference = $this->getMockBuilder(Cell::class)
->setMethods(['getWorksheet'])
->disableOriginalConstructor()
->getMock();
$cellReference->method('getWorksheet')
->willReturn($worksheet);
array_push($args, $cellReference);
$result = MathTrig::SUBTOTAL(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerHiddenSUBTOTAL()
{
return require 'data/Calculation/MathTrig/SUBTOTALHIDDEN.php';
}
protected function cellValues(array $cellValues)
{
foreach ($cellValues as $k => $v) {
yield $k => $v;
}
}
protected function cellIsFormula(array $cellValues)
{
foreach ($cellValues as $cellValue) {
yield $cellValue[0] === '=';
}
}
/**
* @dataProvider providerNestedSUBTOTAL
*
* @param mixed $expectedResult
*/
public function testNestedSUBTOTAL($expectedResult, ...$args)
{
$cellValueGenerator = $this->cellValues(Functions::flattenArray(array_slice($args, 1)));
$cellIsFormulaGenerator = $this->cellIsFormula(Functions::flattenArray(array_slice($args, 1)));
$cell = $this->getMockBuilder(Cell::class)
->setMethods(['getValue', 'isFormula'])
->disableOriginalConstructor()
->getMock();
$cell->method('getValue')
->will($this->returnCallback(function () use ($cellValueGenerator) {
$result = $cellValueGenerator->current();
$cellValueGenerator->next();
return $result;
}));
$cell->method('isFormula')
->will($this->returnCallback(function () use ($cellIsFormulaGenerator) {
$result = $cellIsFormulaGenerator->current();
$cellIsFormulaGenerator->next();
return $result;
}));
$worksheet = $this->getMockBuilder(Worksheet::class)
->setMethods(['cellExists', 'getCell'])
->disableOriginalConstructor()
->getMock();
$worksheet->method('cellExists')
->willReturn(true);
$worksheet->method('getCell')
->willReturn($cell);
$cellReference = $this->getMockBuilder(Cell::class)
->setMethods(['getWorksheet'])
->disableOriginalConstructor()
->getMock();
$cellReference->method('getWorksheet')
->willReturn($worksheet);
array_push($args, $cellReference);
$result = MathTrig::SUBTOTAL(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerNestedSUBTOTAL()
{
return require 'data/Calculation/MathTrig/SUBTOTALNESTED.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class SumIfTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerSUMIF
*
* @param mixed $expectedResult
*/
public function testSUMIF($expectedResult, ...$args)
{
$result = MathTrig::SUMIF(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSUMIF()
{
return require 'data/Calculation/MathTrig/SUMIF.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class SumIfsTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerSUMIFS
*
* @param mixed $expectedResult
*/
public function testSUMIFS($expectedResult, ...$args)
{
$result = MathTrig::SUMIFS(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSUMIFS()
{
return require 'data/Calculation/MathTrig/SUMIFS.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class SumProductTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerSUMPRODUCT
*
* @param mixed $expectedResult
*/
public function testSUMPRODUCT($expectedResult, ...$args)
{
$result = MathTrig::SUMPRODUCT(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSUMPRODUCT()
{
return require 'data/Calculation/MathTrig/SUMPRODUCT.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class SumSqTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerSUMSQ
*
* @param mixed $expectedResult
*/
public function testSUMSQ($expectedResult, ...$args)
{
$result = MathTrig::SUMSQ(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSUMSQ()
{
return require 'data/Calculation/MathTrig/SUMSQ.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class SumX2MY2Test extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerSUMX2MY2
*
* @param mixed $expectedResult
*/
public function testSUMX2MY2($expectedResult, ...$args)
{
$result = MathTrig::SUMX2MY2(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSUMX2MY2()
{
return require 'data/Calculation/MathTrig/SUMX2MY2.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class SumX2PY2Test extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerSUMX2PY2
*
* @param mixed $expectedResult
*/
public function testSUMX2PY2($expectedResult, ...$args)
{
$result = MathTrig::SUMX2PY2(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSUMX2PY2()
{
return require 'data/Calculation/MathTrig/SUMX2PY2.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class SumXMY2Test extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerSUMXMY2
*
* @param mixed $expectedResult
*/
public function testSUMXMY2($expectedResult, ...$args)
{
$result = MathTrig::SUMXMY2(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSUMXMY2()
{
return require 'data/Calculation/MathTrig/SUMXMY2.php';
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\MathTrig;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PHPUnit\Framework\TestCase;
class TruncTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerTRUNC
*
* @param mixed $expectedResult
*/
public function testTRUNC($expectedResult, ...$args)
{
$result = MathTrig::TRUNC(...$args);
$this->assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerTRUNC()
{
return require 'data/Calculation/MathTrig/TRUNC.php';
}
}

View File

@ -1,893 +0,0 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
use PhpOffice\PhpSpreadsheet\Calculation\MathTrig;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Worksheet\ColumnDimension;
use PhpOffice\PhpSpreadsheet\Worksheet\RowDimension;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use PHPUnit\Framework\TestCase;
class MathTrigTest extends TestCase
{
public function setUp()
{
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
}
/**
* @dataProvider providerATAN2
*
* @param mixed $expectedResult
*/
public function testATAN2($expectedResult, ...$args)
{
$result = MathTrig::ATAN2(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerATAN2()
{
return require 'data/Calculation/MathTrig/ATAN2.php';
}
/**
* @dataProvider providerCEILING
*
* @param mixed $expectedResult
*/
public function testCEILING($expectedResult, ...$args)
{
$result = MathTrig::CEILING(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerCEILING()
{
return require 'data/Calculation/MathTrig/CEILING.php';
}
/**
* @dataProvider providerCOMBIN
*
* @param mixed $expectedResult
*/
public function testCOMBIN($expectedResult, ...$args)
{
$result = MathTrig::COMBIN(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerCOMBIN()
{
return require 'data/Calculation/MathTrig/COMBIN.php';
}
/**
* @dataProvider providerEVEN
*
* @param mixed $expectedResult
*/
public function testEVEN($expectedResult, ...$args)
{
$result = MathTrig::EVEN(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerEVEN()
{
return require 'data/Calculation/MathTrig/EVEN.php';
}
/**
* @dataProvider providerODD
*
* @param mixed $expectedResult
*/
public function testODD($expectedResult, ...$args)
{
$result = MathTrig::ODD(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerODD()
{
return require 'data/Calculation/MathTrig/ODD.php';
}
/**
* @dataProvider providerFACT
*
* @param mixed $expectedResult
*/
public function testFACT($expectedResult, ...$args)
{
$result = MathTrig::FACT(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerFACT()
{
return require 'data/Calculation/MathTrig/FACT.php';
}
/**
* @dataProvider providerFACTDOUBLE
*
* @param mixed $expectedResult
*/
public function testFACTDOUBLE($expectedResult, ...$args)
{
$result = MathTrig::FACTDOUBLE(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerFACTDOUBLE()
{
return require 'data/Calculation/MathTrig/FACTDOUBLE.php';
}
/**
* @dataProvider providerFLOOR
*
* @param mixed $expectedResult
*/
public function testFLOOR($expectedResult, ...$args)
{
$result = MathTrig::FLOOR(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerFLOOR()
{
return require 'data/Calculation/MathTrig/FLOOR.php';
}
/**
* @dataProvider providerGCD
*
* @param mixed $expectedResult
*/
public function testGCD($expectedResult, ...$args)
{
$result = MathTrig::GCD(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerGCD()
{
return require 'data/Calculation/MathTrig/GCD.php';
}
/**
* @dataProvider providerLCM
*
* @param mixed $expectedResult
*/
public function testLCM($expectedResult, ...$args)
{
$result = MathTrig::LCM(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerLCM()
{
return require 'data/Calculation/MathTrig/LCM.php';
}
/**
* @dataProvider providerINT
*
* @param mixed $expectedResult
*/
public function testINT($expectedResult, ...$args)
{
$result = MathTrig::INT(...$args);
self::assertEquals($expectedResult, $result);
}
public function providerINT()
{
return require 'data/Calculation/MathTrig/INT.php';
}
/**
* @dataProvider providerSIGN
*
* @param mixed $expectedResult
*/
public function testSIGN($expectedResult, ...$args)
{
$result = MathTrig::SIGN(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSIGN()
{
return require 'data/Calculation/MathTrig/SIGN.php';
}
/**
* @dataProvider providerPOWER
*
* @param mixed $expectedResult
*/
public function testPOWER($expectedResult, ...$args)
{
$result = MathTrig::POWER(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerPOWER()
{
return require 'data/Calculation/MathTrig/POWER.php';
}
/**
* @dataProvider providerLOG
*
* @param mixed $expectedResult
*/
public function testLOG($expectedResult, ...$args)
{
$result = MathTrig::logBase(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerLOG()
{
return require 'data/Calculation/MathTrig/LOG.php';
}
/**
* @dataProvider providerMOD
*
* @param mixed $expectedResult
*/
public function testMOD($expectedResult, ...$args)
{
$result = MathTrig::MOD(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerMOD()
{
return require 'data/Calculation/MathTrig/MOD.php';
}
/**
* @dataProvider providerMDETERM
*
* @param mixed $expectedResult
*/
public function testMDETERM($expectedResult, ...$args)
{
$result = MathTrig::MDETERM(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerMDETERM()
{
return require 'data/Calculation/MathTrig/MDETERM.php';
}
/**
* @dataProvider providerMINVERSE
*
* @param mixed $expectedResult
*/
public function testMINVERSE($expectedResult, ...$args)
{
$result = MathTrig::MINVERSE(...$args);
self::assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerMINVERSE()
{
return require 'data/Calculation/MathTrig/MINVERSE.php';
}
/**
* @dataProvider providerMMULT
*
* @param mixed $expectedResult
*/
public function testMMULT($expectedResult, ...$args)
{
$result = MathTrig::MMULT(...$args);
self::assertEquals($expectedResult, $result, null, 1E-8);
}
public function providerMMULT()
{
return require 'data/Calculation/MathTrig/MMULT.php';
}
/**
* @dataProvider providerMULTINOMIAL
*
* @param mixed $expectedResult
*/
public function testMULTINOMIAL($expectedResult, ...$args)
{
$result = MathTrig::MULTINOMIAL(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerMULTINOMIAL()
{
return require 'data/Calculation/MathTrig/MULTINOMIAL.php';
}
/**
* @dataProvider providerMROUND
*
* @param mixed $expectedResult
*/
public function testMROUND($expectedResult, ...$args)
{
Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_VALUE);
$result = MathTrig::MROUND(...$args);
Calculation::setArrayReturnType(Calculation::RETURN_ARRAY_AS_ARRAY);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerMROUND()
{
return require 'data/Calculation/MathTrig/MROUND.php';
}
/**
* @dataProvider providerPRODUCT
*
* @param mixed $expectedResult
*/
public function testPRODUCT($expectedResult, ...$args)
{
$result = MathTrig::PRODUCT(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerPRODUCT()
{
return require 'data/Calculation/MathTrig/PRODUCT.php';
}
/**
* @dataProvider providerQUOTIENT
*
* @param mixed $expectedResult
*/
public function testQUOTIENT($expectedResult, ...$args)
{
$result = MathTrig::QUOTIENT(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerQUOTIENT()
{
return require 'data/Calculation/MathTrig/QUOTIENT.php';
}
/**
* @dataProvider providerROUNDUP
*
* @param mixed $expectedResult
*/
public function testROUNDUP($expectedResult, ...$args)
{
$result = MathTrig::ROUNDUP(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerROUNDUP()
{
return require 'data/Calculation/MathTrig/ROUNDUP.php';
}
/**
* @dataProvider providerROUNDDOWN
*
* @param mixed $expectedResult
*/
public function testROUNDDOWN($expectedResult, ...$args)
{
$result = MathTrig::ROUNDDOWN(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerROUNDDOWN()
{
return require 'data/Calculation/MathTrig/ROUNDDOWN.php';
}
/**
* @dataProvider providerSERIESSUM
*
* @param mixed $expectedResult
*/
public function testSERIESSUM($expectedResult, ...$args)
{
$result = MathTrig::SERIESSUM(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSERIESSUM()
{
return require 'data/Calculation/MathTrig/SERIESSUM.php';
}
/**
* @dataProvider providerSUMSQ
*
* @param mixed $expectedResult
*/
public function testSUMSQ($expectedResult, ...$args)
{
$result = MathTrig::SUMSQ(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSUMSQ()
{
return require 'data/Calculation/MathTrig/SUMSQ.php';
}
/**
* @dataProvider providerSUMPRODUCT
*
* @param mixed $expectedResult
*/
public function testSUMPRODUCT($expectedResult, ...$args)
{
$result = MathTrig::SUMPRODUCT(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSUMPRODUCT()
{
return require 'data/Calculation/MathTrig/SUMPRODUCT.php';
}
/**
* @dataProvider providerSUMX2MY2
*
* @param mixed $expectedResult
*/
public function testSUMX2MY2($expectedResult, ...$args)
{
$result = MathTrig::SUMX2MY2(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSUMX2MY2()
{
return require 'data/Calculation/MathTrig/SUMX2MY2.php';
}
/**
* @dataProvider providerSUMX2PY2
*
* @param mixed $expectedResult
*/
public function testSUMX2PY2($expectedResult, ...$args)
{
$result = MathTrig::SUMX2PY2(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSUMX2PY2()
{
return require 'data/Calculation/MathTrig/SUMX2PY2.php';
}
/**
* @dataProvider providerSUMXMY2
*
* @param mixed $expectedResult
*/
public function testSUMXMY2($expectedResult, ...$args)
{
$result = MathTrig::SUMXMY2(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSUMXMY2()
{
return require 'data/Calculation/MathTrig/SUMXMY2.php';
}
/**
* @dataProvider providerTRUNC
*
* @param mixed $expectedResult
*/
public function testTRUNC($expectedResult, ...$args)
{
$result = MathTrig::TRUNC(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerTRUNC()
{
return require 'data/Calculation/MathTrig/TRUNC.php';
}
/**
* @dataProvider providerROMAN
*
* @param mixed $expectedResult
*/
public function testROMAN($expectedResult, ...$args)
{
$result = MathTrig::ROMAN(...$args);
self::assertEquals($expectedResult, $result);
}
public function providerROMAN()
{
return require 'data/Calculation/MathTrig/ROMAN.php';
}
/**
* @dataProvider providerSQRTPI
*
* @param mixed $expectedResult
*/
public function testSQRTPI($expectedResult, ...$args)
{
$result = MathTrig::SQRTPI(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSQRTPI()
{
return require 'data/Calculation/MathTrig/SQRTPI.php';
}
/**
* @dataProvider providerSUMIF
*
* @param mixed $expectedResult
*/
public function testSUMIF($expectedResult, ...$args)
{
$result = MathTrig::SUMIF(...$args);
self::assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSUMIF()
{
return require 'data/Calculation/MathTrig/SUMIF.php';
}
/**
* @dataProvider providerSUMIFS
*
* @param mixed $expectedResult
*/
public function testSUMIFS($expectedResult, ...$args)
{
$result = MathTrig::SUMIFS(...$args);
self::assertEquals($expectedResult, $result, '', 1E-12);
}
public function providerSUMIFS()
{
return require 'data/Calculation/MathTrig/SUMIFS.php';
}
/**
* @dataProvider providerSUBTOTAL
*
* @param mixed $expectedResult
*/
public function testSUBTOTAL($expectedResult, ...$args)
{
$cell = $this->getMockBuilder(Cell::class)
->setMethods(['getValue'])
->disableOriginalConstructor()
->getMock();
$cell->method('getValue')
->willReturn(null);
$worksheet = $this->getMockBuilder(Worksheet::class)
->setMethods(['cellExists', 'getCell'])
->disableOriginalConstructor()
->getMock();
$worksheet->method('cellExists')
->willReturn(true);
$worksheet->method('getCell')
->willReturn($cell);
$cellReference = $this->getMockBuilder(Cell::class)
->setMethods(['getWorksheet'])
->disableOriginalConstructor()
->getMock();
$cellReference->method('getWorksheet')
->willReturn($worksheet);
array_push($args, $cellReference);
$result = MathTrig::SUBTOTAL(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSUBTOTAL()
{
return require 'data/Calculation/MathTrig/SUBTOTAL.php';
}
protected function rowVisibility()
{
$data = [1 => false, 2 => true, 3 => false, 4 => true, 5 => false, 6 => false, 7 => false, 8 => true, 9 => false, 10 => true, 11 => true];
foreach ($data as $k => $v) {
yield $k => $v;
}
}
/**
* @dataProvider providerHiddenSUBTOTAL
*
* @param mixed $expectedResult
*/
public function testHiddenSUBTOTAL($expectedResult, ...$args)
{
$visibilityGenerator = $this->rowVisibility();
$rowDimension = $this->getMockBuilder(RowDimension::class)
->setMethods(['getVisible'])
->disableOriginalConstructor()
->getMock();
$rowDimension->method('getVisible')
->will($this->returnCallback(function () use ($visibilityGenerator) {
$result = $visibilityGenerator->current();
$visibilityGenerator->next();
return $result;
}));
$columnDimension = $this->getMockBuilder(ColumnDimension::class)
->setMethods(['getVisible'])
->disableOriginalConstructor()
->getMock();
$columnDimension->method('getVisible')
->willReturn(true);
$cell = $this->getMockBuilder(Cell::class)
->setMethods(['getValue'])
->disableOriginalConstructor()
->getMock();
$cell->method('getValue')
->willReturn('');
$worksheet = $this->getMockBuilder(Worksheet::class)
->setMethods(['cellExists', 'getCell', 'getRowDimension', 'getColumnDimension'])
->disableOriginalConstructor()
->getMock();
$worksheet->method('cellExists')
->willReturn(true);
$worksheet->method('getCell')
->willReturn($cell);
$worksheet->method('getRowDimension')
->willReturn($rowDimension);
$worksheet->method('getColumnDimension')
->willReturn($columnDimension);
$cellReference = $this->getMockBuilder(Cell::class)
->setMethods(['getWorksheet'])
->disableOriginalConstructor()
->getMock();
$cellReference->method('getWorksheet')
->willReturn($worksheet);
array_push($args, $cellReference);
$result = MathTrig::SUBTOTAL(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerHiddenSUBTOTAL()
{
return require 'data/Calculation/MathTrig/SUBTOTALHIDDEN.php';
}
protected function cellValues(array $cellValues)
{
foreach ($cellValues as $k => $v) {
yield $k => $v;
}
}
protected function cellIsFormula(array $cellValues)
{
foreach ($cellValues as $cellValue) {
yield $cellValue[0] === '=';
}
}
/**
* @dataProvider providerNestedSUBTOTAL
*
* @param mixed $expectedResult
*/
public function testNestedSUBTOTAL($expectedResult, ...$args)
{
$cellValueGenerator = $this->cellValues(Functions::flattenArray(array_slice($args, 1)));
$cellIsFormulaGenerator = $this->cellIsFormula(Functions::flattenArray(array_slice($args, 1)));
$cell = $this->getMockBuilder(Cell::class)
->setMethods(['getValue', 'isFormula'])
->disableOriginalConstructor()
->getMock();
$cell->method('getValue')
->will($this->returnCallback(function () use ($cellValueGenerator) {
$result = $cellValueGenerator->current();
$cellValueGenerator->next();
return $result;
}));
$cell->method('isFormula')
->will($this->returnCallback(function () use ($cellIsFormulaGenerator) {
$result = $cellIsFormulaGenerator->current();
$cellIsFormulaGenerator->next();
return $result;
}));
$worksheet = $this->getMockBuilder(Worksheet::class)
->setMethods(['cellExists', 'getCell'])
->disableOriginalConstructor()
->getMock();
$worksheet->method('cellExists')
->willReturn(true);
$worksheet->method('getCell')
->willReturn($cell);
$cellReference = $this->getMockBuilder(Cell::class)
->setMethods(['getWorksheet'])
->disableOriginalConstructor()
->getMock();
$cellReference->method('getWorksheet')
->willReturn($worksheet);
array_push($args, $cellReference);
$result = MathTrig::SUBTOTAL(...$args);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerNestedSUBTOTAL()
{
return require 'data/Calculation/MathTrig/SUBTOTALNESTED.php';
}
/**
* @dataProvider providerSEC
*
* @param mixed $expectedResult
* @param mixed $angle
*/
public function testSEC($expectedResult, $angle)
{
$result = MathTrig::SEC($angle);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSEC()
{
return require 'data/Calculation/MathTrig/SEC.php';
}
/**
* @dataProvider providerSECH
*
* @param mixed $expectedResult
* @param mixed $angle
*/
public function testSECH($expectedResult, $angle)
{
$result = MathTrig::SECH($angle);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerSECH()
{
return require 'data/Calculation/MathTrig/SECH.php';
}
/**
* @dataProvider providerCSC
*
* @param mixed $expectedResult
* @param mixed $angle
*/
public function testCSC($expectedResult, $angle)
{
$result = MathTrig::CSC($angle);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerCSC()
{
return require 'data/Calculation/MathTrig/CSC.php';
}
/**
* @dataProvider providerCSCH
*
* @param mixed $expectedResult
* @param mixed $angle
*/
public function testCSCH($expectedResult, $angle)
{
$result = MathTrig::CSCH($angle);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerCSCH()
{
return require 'data/Calculation/MathTrig/CSCH.php';
}
/**
* @dataProvider providerCOT
*
* @param mixed $expectedResult
* @param mixed $angle
*/
public function testCOT($expectedResult, $angle)
{
$result = MathTrig::COT($angle);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerCOT()
{
return require 'data/Calculation/MathTrig/COT.php';
}
/**
* @dataProvider providerCOTH
*
* @param mixed $expectedResult
* @param mixed $angle
*/
public function testCOTH($expectedResult, $angle)
{
$result = MathTrig::COTH($angle);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerCOTH()
{
return require 'data/Calculation/MathTrig/COTH.php';
}
/**
* @dataProvider providerACOT
*
* @param mixed $expectedResult
* @param mixed $number
*/
public function testACOT($expectedResult, $number)
{
$result = MathTrig::ACOT($number);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerACOT()
{
return require 'data/Calculation/MathTrig/ACOT.php';
}
/**
* @dataProvider providerACOTH
*
* @param mixed $expectedResult
* @param mixed $number
*/
public function testACOTH($expectedResult, $number)
{
$result = MathTrig::ACOTH($number);
self::assertEquals($expectedResult, $result, null, 1E-12);
}
public function providerACOTH()
{
return require 'data/Calculation/MathTrig/ACOTH.php';
}
}

View File

@ -3,614 +3,410 @@
return [ return [
[ [
365, 365,
'2016-01-01', '2016-01-01', '2016-12-31', 'YD',
'2016-12-31',
'YD',
], ],
[ [
364, 364,
'2015-01-01', '2015-01-01', '2015-12-31', 'YD',
'2015-12-31',
'YD',
], ],
[ [
364, 364,
'2015-01-01', '2015-01-01', '2016-12-31', 'YD',
'2016-12-31',
'YD',
], ],
[ [
365, 365,
'2016-01-01', '2016-01-01', '2017-12-31', 'YD',
'2017-12-31',
'YD',
], ],
[ [
364, 364,
'2017-01-01', '2017-01-01', '2018-12-31', 'YD',
'2018-12-31',
'YD',
], ],
[ [
'#VALUE!', '#VALUE!',
'ABC', 'ABC', '2007-1-10', 'Y',
'2007-1-10',
'Y',
], ],
[ [
'#VALUE!', '#VALUE!',
'2007-1-1', '2007-1-1', 'DEF', 'Y',
'DEF',
'Y',
], ],
[ [
'#VALUE!', '#VALUE!',
'2007-1-1', '2007-1-1', '2007-1-10', 'XYZ',
'2007-1-10',
'XYZ',
], ],
[ [
'#NUM!', '#NUM!',
'2007-1-10', '2007-1-10', '2007-1-1', 'Y',
'2007-1-1',
'Y',
], ],
[ [
0, 0,
'2007-12-31', '2007-12-31', '2008-1-10', 'Y',
'2008-1-10',
'Y',
], ],
[ [
0, 0,
'2007-1-1', '2007-1-1', '2007-1-10', 'Y',
'2007-1-10',
'Y',
], ],
[ [
0, 0,
'2007-1-1', '2007-1-1', '2007-1-10', 'M',
'2007-1-10',
'M',
], ],
[ [
9, 9,
'2007-1-1', '2007-1-1', '2007-1-10', 'D',
'2007-1-10',
'D',
], ],
[ [
0, 0,
'2007-1-1', '2007-1-1', '2007-1-10', 'YM',
'2007-1-10',
'YM',
], ],
[ [
9, 9,
'2007-1-1', '2007-1-1', '2007-1-10', 'YD',
'2007-1-10',
'YD',
], ],
[ [
9, 9,
'2007-1-1', '2007-1-1', '2007-1-10', 'MD',
'2007-1-10',
'MD',
], ],
[ [
0, 0,
'2007-1-1', '2007-1-1', '2007-12-31', 'Y',
'2007-12-31',
'Y',
], ],
[ [
11, 11,
'2007-1-1', '2007-1-1', '2007-12-31', 'M',
'2007-12-31',
'M',
], ],
[ [
364, 364,
'2007-1-1', '2007-1-1', '2007-12-31', 'D',
'2007-12-31',
'D',
], ],
[ [
11, 11,
'2007-1-1', '2007-1-1', '2007-12-31', 'YM',
'2007-12-31',
'YM',
], ],
[ [
364, 364,
'2007-1-1', '2007-1-1', '2007-12-31', 'YD',
'2007-12-31',
'YD',
], ],
[ [
30, 30,
'2007-1-1', '2007-1-1', '2007-12-31', 'MD',
'2007-12-31',
'MD',
], ],
[ [
1, 1,
'2007-1-1', '2007-1-1', '2008-7-1', 'Y',
'2008-7-1',
'Y',
], ],
[ [
18, 18,
'2007-1-1', '2007-1-1', '2008-7-1', 'M',
'2008-7-1',
'M',
], ],
[ [
547, 547,
'2007-1-1', '2007-1-1', '2008-7-1', 'D',
'2008-7-1',
'D',
], ],
[ [
6, 6,
'2007-1-1', '2007-1-1', '2008-7-1', 'YM',
'2008-7-1',
'YM',
], ],
[ [
181, 181,
'2007-1-1', '2007-1-1', '2008-7-1', 'YD',
'2008-7-1',
'YD',
], ],
[ [
0, 0,
'2007-1-1', '2007-1-1', '2008-7-1', 'MD',
'2008-7-1',
'MD',
], ],
[ [
0, 0,
'2007-1-1', '2007-1-1', '2007-1-31', 'Y',
'2007-1-31',
'Y',
], ],
[ [
0, 0,
'2007-1-1', '2007-1-1', '2007-1-31', 'M',
'2007-1-31',
'M',
], ],
[ [
30, 30,
'2007-1-1', '2007-1-1', '2007-1-31', 'D',
'2007-1-31',
'D',
], ],
[ [
0, 0,
'2007-1-1', '2007-1-1', '2007-1-31', 'YM',
'2007-1-31',
'YM',
], ],
[ [
30, 30,
'2007-1-1', '2007-1-1', '2007-1-31', 'YD',
'2007-1-31',
'YD',
], ],
[ [
30, 30,
'2007-1-1', '2007-1-1', '2007-1-31', 'MD',
'2007-1-31',
'MD',
], ],
[ [
0, 0,
'2007-1-1', '2007-1-1', '2007-2-1', 'Y',
'2007-2-1',
'Y',
], ],
[ [
1, 1,
'2007-1-1', '2007-1-1', '2007-2-1', 'M',
'2007-2-1',
'M',
], ],
[ [
31, 31,
'2007-1-1', '2007-1-1', '2007-2-1', 'D',
'2007-2-1',
'D',
], ],
[ [
1, 1,
'2007-1-1', '2007-1-1', '2007-2-1', 'YM',
'2007-2-1',
'YM',
], ],
[ [
31, 31,
'2007-1-1', '2007-1-1', '2007-2-1', 'YD',
'2007-2-1',
'YD',
], ],
[ [
0, 0,
'2007-1-1', '2007-1-1', '2007-2-1', 'MD',
'2007-2-1',
'MD',
], ],
[ [
0, 0,
'2007-1-1', '2007-1-1', '2007-2-28', 'Y',
'2007-2-28',
'Y',
], ],
[ [
1, 1,
'2007-1-1', '2007-1-1', '2007-2-28', 'M',
'2007-2-28',
'M',
], ],
[ [
58, 58,
'2007-1-1', '2007-1-1', '2007-2-28', 'D',
'2007-2-28',
'D',
], ],
[ [
1, 1,
'2007-1-1', '2007-1-1', '2007-2-28', 'YM',
'2007-2-28',
'YM',
], ],
[ [
58, 58,
'2007-1-1', '2007-1-1', '2007-2-28', 'YD',
'2007-2-28',
'YD',
], ],
[ [
27, 27,
'2007-1-1', '2007-1-1', '2007-2-28', 'MD',
'2007-2-28',
'MD',
], ],
[ [
0, 0,
'2007-1-31', '2007-1-31', '2007-2-1', 'Y',
'2007-2-1',
'Y',
], ],
[ [
0, 0,
'2007-1-31', '2007-1-31', '2007-2-1', 'M',
'2007-2-1',
'M',
], ],
[ [
1, 1,
'2007-1-31', '2007-1-31', '2007-2-1', 'D',
'2007-2-1',
'D',
], ],
[ [
0, 0,
'2007-1-31', '2007-1-31', '2007-2-1', 'YM',
'2007-2-1',
'YM',
], ],
[ [
1, 1,
'2007-1-31', '2007-1-31', '2007-2-1', 'YD',
'2007-2-1',
'YD',
], ],
[ [
1, 1,
'2007-1-31', '2007-1-31', '2007-2-1', 'MD',
'2007-2-1',
'MD',
], ],
[ [
0, 0,
'2007-1-31', '2007-1-31', '2007-3-1', 'Y',
'2007-3-1',
'Y',
], ],
[ [
1, 1,
'2007-1-31', '2007-1-31', '2007-3-1', 'M',
'2007-3-1',
'M',
], ],
[ [
29, 29,
'2007-1-31', '2007-1-31', '2007-3-1', 'D',
'2007-3-1',
'D',
], ],
[ [
1, 1,
'2007-1-31', '2007-1-31', '2007-3-1', 'YM',
'2007-3-1',
'YM',
], ],
[ [
29, 29,
'2007-1-31', '2007-1-31', '2007-3-1', 'YD',
'2007-3-1',
'YD',
], ],
[ [
-2, -2,
'2007-1-31', '2007-1-31', '2007-3-1', 'MD',
'2007-3-1',
'MD',
], ],
[ [
0, 0,
'2007-1-31', '2007-1-31', '2007-3-31', 'Y',
'2007-3-31',
'Y',
], ],
[ [
2, 2,
'2007-1-31', '2007-1-31', '2007-3-31', 'M',
'2007-3-31',
'M',
], ],
[ [
59, 59,
'2007-1-31', '2007-1-31', '2007-3-31', 'D',
'2007-3-31',
'D',
], ],
[ [
2, 2,
'2007-1-31', '2007-1-31', '2007-3-31', 'YM',
'2007-3-31',
'YM',
], ],
[ [
59, 59,
'2007-1-31', '2007-1-31', '2007-3-31', 'YD',
'2007-3-31',
'YD',
], ],
[ [
0, 0,
'2007-1-31', '2007-1-31', '2007-3-31', 'MD',
'2007-3-31',
'MD',
], ],
[ [
0, 0,
'2008-1-1', '2008-1-1', '2008-9-1', 'Y',
'2008-9-1',
'Y',
], ],
[ [
8, 8,
'2008-1-1', '2008-1-1', '2008-9-1', 'M',
'2008-9-1',
'M',
], ],
[ [
244, 244,
'2008-1-1', '2008-1-1', '2008-9-1', 'D',
'2008-9-1',
'D',
], ],
[ [
8, 8,
'2008-1-1', '2008-1-1', '2008-9-1', 'YM',
'2008-9-1',
'YM',
], ],
[ [
244, 244,
'2008-1-1', '2008-1-1', '2008-9-1', 'YD',
'2008-9-1',
'YD',
], ],
[ [
0, 0,
'2008-1-1', '2008-1-1', '2008-9-1', 'MD',
'2008-9-1',
'MD',
], ],
[ [
1, 1,
'2007-2-1', '2007-2-1', '2008-4-1', 'Y',
'2008-4-1',
'Y',
], ],
[ [
14, 14,
'2007-2-1', '2007-2-1', '2008-4-1', 'M',
'2008-4-1',
'M',
], ],
[ [
425, 425,
'2007-2-1', '2007-2-1', '2008-4-1', 'D',
'2008-4-1',
'D',
], ],
[ [
2, 2,
'2007-2-1', '2007-2-1', '2008-4-1', 'YM',
'2008-4-1',
'YM',
], ],
[ [
59, 59,
'2007-2-1', '2007-2-1', '2008-4-1', 'YD',
'2008-4-1',
'YD',
], ],
[ [
0, 0,
'2007-2-1', '2007-2-1', '2008-4-1', 'MD',
'2008-4-1',
'MD',
], ],
[ [
47, 47,
'1960-12-19', '1960-12-19', '2008-6-28', 'Y',
'2008-6-28',
'Y',
], ],
[ [
570, 570,
'1960-12-19', '1960-12-19', '2008-6-28', 'M',
'2008-6-28',
'M',
], ],
[ [
17358, 17358,
'1960-12-19', '1960-12-19', '2008-6-28', 'D',
'2008-6-28',
'D',
], ],
[ [
6, 6,
'1960-12-19', '1960-12-19', '2008-6-28', 'YM',
'2008-6-28',
'YM',
], ],
[ [
191, 191,
'1960-12-19', '1960-12-19', '2008-6-28', 'YD',
'2008-6-28',
'YD',
], ],
[ [
9, 9,
'1960-12-19', '1960-12-19', '2008-6-28', 'MD',
'2008-6-28',
'MD',
], ],
[ [
25, 25,
'1982-12-7', '1982-12-7', '2008-6-28', 'Y',
'2008-6-28',
'Y',
], ],
[ [
306, 306,
'1982-12-7', '1982-12-7', '2008-6-28', 'M',
'2008-6-28',
'M',
], ],
[ [
9335, 9335,
'1982-12-7', '1982-12-7', '2008-6-28', 'D',
'2008-6-28',
'D',
], ],
[ [
6, 6,
'1982-12-7', '1982-12-7', '2008-6-28', 'YM',
'2008-6-28',
'YM',
], ],
[ [
203, 203,
'1982-12-7', '1982-12-7', '2008-6-28', 'YD',
'2008-6-28',
'YD',
], ],
[ [
21, 21,
'1982-12-7', '1982-12-7', '2008-6-28', 'MD',
'2008-6-28',
'MD',
], ],
[ [
2, 2,
'2007-12-25', '2007-12-25', '2010-3-17', 'Y',
'2010-3-17',
'Y',
], ],
[ [
26, 26,
'2007-12-25', '2007-12-25', '2010-3-17', 'M',
'2010-3-17',
'M',
], ],
[ [
813, 813,
'2007-12-25', '2007-12-25', '2010-3-17', 'D',
'2010-3-17',
'D',
], ],
[ [
2, 2,
'2007-12-25', '2007-12-25', '2010-3-17', 'YM',
'2010-3-17',
'YM',
], ],
[ [
82, 82,
'2007-12-25', '2007-12-25', '2010-3-17', 'YD',
'2010-3-17',
'YD',
], ],
[ [
20, 20,
'2007-12-25', '2007-12-25', '2010-3-17', 'MD',
'2010-3-17',
'MD',
], ],
[ [
51, 51,
'19-12-1960', '19-12-1960', '26-01-2012', 'Y',
'26-01-2012',
'Y',
], ],
[ [
613, 613,
'19-12-1960', '19-12-1960', '26-01-2012', 'M',
'26-01-2012',
'M',
], ],
[ [
18665, 18665,
'19-12-1960', '19-12-1960', '26-01-2012', 'D',
'26-01-2012',
'D',
], ],
[ [
1, 1,
'19-12-1960', '19-12-1960', '26-01-2012', 'YM',
'26-01-2012',
'YM',
], ],
[ [
38, 38,
'19-12-1960', '19-12-1960', '26-01-2012', 'YD',
'26-01-2012',
'YD',
], ],
[ [
7, 7,
'19-12-1960', '19-12-1960', '26-01-2012', 'MD',
'26-01-2012',
'MD',
], ],
[ [
50, 50,
'19-12-1960', '19-12-1960', '12-12-2012', 'Y',
'12-12-2012',
'Y',
], ],
[ [
0, 0,
'1982-12-07', '1982-12-07', '1982-12-7', 'D',
'1982-12-7',
'D',
], ],
]; ];

View File

@ -3,97 +3,78 @@
return [ return [
[ [
'#VALUE!', '#VALUE!',
'2007-1-10', '2007-1-10', 'ABC',
'ABC',
], ],
[ [
'#VALUE!', '#VALUE!',
'DEF', 'DEF', '2007-1-1',
'2007-1-1',
], ],
[ [
9, 9,
'2007-1-10', '2007-1-10', '2007-1-1',
'2007-1-1',
], ],
[ [
364, 364,
'2007-12-31', '2007-12-31', '2007-1-1',
'2007-1-1',
], ],
[ [
547, 547,
'2008-7-1', '2008-7-1', '2007-1-1',
'2007-1-1',
], ],
[ [
30, 30,
'2007-1-31', '2007-1-31', '2007-1-1',
'2007-1-1',
], ],
[ [
31, 31,
'2007-2-1', '2007-2-1', '2007-1-1',
'2007-1-1',
], ],
[ [
58, 58,
'2007-2-28', '2007-2-28', '2007-1-1',
'2007-1-1',
], ],
[ [
1, 1,
'2007-2-1', '2007-2-1', '2007-1-31',
'2007-1-31',
], ],
[ [
29, 29,
'2007-3-1', '2007-3-1', '2007-1-31',
'2007-1-31',
], ],
[ [
59, 59,
'2007-3-31', '2007-3-31', '2007-1-31',
'2007-1-31',
], ],
[ [
244, 244,
'2008-9-1', '2008-9-1', '2008-1-1',
'2008-1-1',
], ],
[ [
425, 425,
'2008-4-1', '2008-4-1', '2007-2-1',
'2007-2-1',
], ],
[ [
17358, 17358,
'2008-6-28', '2008-6-28', '1960-12-19',
'1960-12-19',
], ],
[ [
9335, 9335,
'2008-6-28', '2008-6-28', '1982-12-7',
'1982-12-7',
], ],
[ [
32, 32,
'2000-3-31', '2000-3-31', '2000-2-28',
'2000-2-28',
], ],
[ [
31, 31,
'2000-3-31', '2000-3-31', '2000-2-29',
'2000-2-29',
], ],
[ [
31, 31,
new \DateTime('2000-3-31'), new \DateTime('2000-3-31'), new \DateTimeImmutable('2000-2-29'),
new \DateTimeImmutable('2000-2-29'),
], ],
[ [
31, 31,
36616, 36616, 36585,
36585,
], ],
]; ];

View File

@ -3,206 +3,138 @@
return [ return [
[ [
'#VALUE!', '#VALUE!',
'ABC', 'ABC', '2007-1-10', false,
'2007-1-10',
false,
], ],
[ [
'#VALUE!', '#VALUE!',
'2007-1-1', '2007-1-1', 'DEF', true,
'DEF',
true,
], ],
[ [
'#VALUE!', '#VALUE!',
'2007-1-1', '2007-1-1', '2007-1-10', 'XYZ',
'2007-1-10',
'XYZ',
], ],
[ [
'#VALUE!', '#VALUE!',
'2007-1-10', '2007-1-10', '2007-1-1', 'Y',
'2007-1-1',
'Y',
], ],
[ [
9, 9,
'2007-1-1', '2007-1-1', '2007-1-10', false,
'2007-1-10',
false,
], ],
[ [
9, 9,
'2007-1-1', '2007-1-1', '2007-1-10', true,
'2007-1-10',
true,
], ],
[ [
360, 360,
'2007-1-1', '2007-1-1', '2007-12-31', false,
'2007-12-31',
false,
], ],
[ [
359, 359,
'2007-1-1', '2007-1-1', '2007-12-31', true,
'2007-12-31',
true,
], ],
[ [
540, 540,
'2007-1-1', '2007-1-1', '2008-7-1', false,
'2008-7-1',
false,
], ],
[ [
540, 540,
'2007-1-1', '2007-1-1', '2008-7-1', true,
'2008-7-1',
true,
], ],
[ [
30, 30,
'2007-1-1', '2007-1-1', '2007-1-31', false,
'2007-1-31',
false,
], ],
[ [
29, 29,
'2007-1-1', '2007-1-1', '2007-1-31', true,
'2007-1-31',
true,
], ],
[ [
30, 30,
'2007-1-1', '2007-1-1', '2007-2-1', false,
'2007-2-1',
false,
], ],
[ [
30, 30,
'2007-1-1', '2007-1-1', '2007-2-1', true,
'2007-2-1',
true,
], ],
[ [
57, 57,
'2007-1-1', '2007-1-1', '2007-2-28', false,
'2007-2-28',
false,
], ],
[ [
57, 57,
'2007-1-1', '2007-1-1', '2007-2-28', true,
'2007-2-28',
true,
], ],
[ [
1, 1,
'2007-1-31', '2007-1-31', '2007-2-1', false,
'2007-2-1',
false,
], ],
[ [
1, 1,
'2007-1-31', '2007-1-31', '2007-2-1', true,
'2007-2-1',
true,
], ],
[ [
31, 31,
'2007-1-31', '2007-1-31', '2007-3-1', false,
'2007-3-1',
false,
], ],
[ [
31, 31,
'2007-1-31', '2007-1-31', '2007-3-1', true,
'2007-3-1',
true,
], ],
[ [
60, 60,
'2007-1-31', '2007-1-31', '2007-3-31', false,
'2007-3-31',
false,
], ],
[ [
60, 60,
'2007-1-31', '2007-1-31', '2007-3-31', true,
'2007-3-31',
true,
], ],
[ [
240, 240,
'2008-1-1', '2008-1-1', '2008-9-1', false,
'2008-9-1',
false,
], ],
[ [
240, 240,
'2008-1-1', '2008-1-1', '2008-9-1', true,
'2008-9-1',
true,
], ],
[ [
420, 420,
'2007-2-1', '2007-2-1', '2008-4-1', false,
'2008-4-1',
false,
], ],
[ [
420, 420,
'2007-2-1', '2007-2-1', '2008-4-1', true,
'2008-4-1',
true,
], ],
[ [
17109, 17109,
'1960-12-19', '1960-12-19', '2008-6-28', false,
'2008-6-28',
false,
], ],
[ [
17109, 17109,
'1960-12-19', '1960-12-19', '2008-6-28', true,
'2008-6-28',
true,
], ],
[ [
9201, 9201,
'1982-12-7', '1982-12-7', '2008-6-28', false,
'2008-6-28',
false,
], ],
[ [
9201, 9201,
'1982-12-7', '1982-12-7', '2008-6-28', true,
'2008-6-28',
true,
], ],
[ [
33, 33,
'2000-2-28', '2000-2-28', '2000-3-31', false,
'2000-3-31',
false,
], ],
[ [
32, 32,
'2000-2-28', '2000-2-28', '2000-3-31', true,
'2000-3-31',
true,
], ],
[ [
30, 30,
'2000-2-29', '2000-2-29', '2000-3-31', false,
'2000-3-31',
false,
], ],
[ [
31, 31,
'2000-2-29', '2000-2-29', '2000-3-31', true,
'2000-3-31',
true,
], ],
]; ];

View File

@ -3,77 +3,62 @@
return [ return [
[ [
39493, 39493,
'15-Jan-2008', '15-Jan-2008', 1,
1,
], ],
[ [
39431, 39431,
'15-Jan-2008', '15-Jan-2008', -1,
-1,
], ],
[ [
39522, 39522,
'15-Jan-2008', '15-Jan-2008', 2,
2,
], ],
[ [
39202, 39202,
'31-Mar-2007', '31-Mar-2007', 1,
1,
], ],
[ [
39141, 39141,
'31-Mar-2007', '31-Mar-2007', -1,
-1,
], ],
[ [
39507, 39507,
'31-Mar-2008', '31-Mar-2008', -1,
-1,
], ],
[ [
39416, 39416,
'31-Mar-2008', '31-Mar-2008', -4,
-4,
], ],
[ [
39141, 39141,
'29-Feb-2008', '29-Feb-2008', -12,
-12,
], ],
[ [
39248, 39248,
'15-Mar-2007', '15-Mar-2007', 3,
3,
], ],
[ [
22269, 22269,
22269.0, 22269.0, 0,
0,
], ],
[ [
22331, 22331,
22269.0, 22269.0, 2,
2,
], ],
[ [
25618, 25618,
22269.0, 22269.0, 110,
110,
], ],
[ [
18920, 18920,
22269.0, 22269.0, -110,
-110,
], ],
[ [
'#VALUE!', '#VALUE!',
'15-Mar-2007', '15-Mar-2007', 'ABC',
'ABC',
], ],
[ [
'#VALUE!', '#VALUE!',
'Invalid', 'Invalid', 12,
12,
], ],
]; ];

View File

@ -3,87 +3,70 @@
return [ return [
[ [
39507, 39507,
'15-Jan-2008', '15-Jan-2008', 1,
1,
], ],
[ [
39447, 39447,
'15-Jan-2008', '15-Jan-2008', -1,
-1,
], ],
[ [
39538, 39538,
'15-Jan-2008', '15-Jan-2008', 2,
2,
], ],
[ [
39202, 39202,
'31-Mar-2007', '31-Mar-2007', 1,
1,
], ],
[ [
39141, 39141,
'31-Mar-2007', '31-Mar-2007', -1,
-1,
], ],
[ [
39507, 39507,
'31-Mar-2008', '31-Mar-2008', -1,
-1,
], ],
[ [
39416, 39416,
'31-Mar-2008', '31-Mar-2008', -4,
-4,
], ],
[ [
39141, 39141,
'29-Feb-2008', '29-Feb-2008', -12,
-12,
], ],
[ [
39263, 39263,
'15-Mar-2007', '15-Mar-2007', 3,
3,
], ],
[ [
22281, 22281,
22269.0, 22269.0, 0,
0,
], ],
[ [
22340, 22340,
22269.0, 22269.0, 2,
2,
], ],
[ [
25627, 25627,
22269.0, 22269.0, 110,
110,
], ],
[ [
18932, 18932,
22269.0, 22269.0, -110,
-110,
], ],
[ [
22371, 22371,
22269.0, 22269.0, 3,
3,
], ],
[ [
22371, 22371,
22269.0, 22269.0, 3.75,
3.75,
], ],
[ [
'#VALUE!', '#VALUE!',
'15-Mar-2007', '15-Mar-2007', 'ABC',
'ABC',
], ],
[ [
'#VALUE!', '#VALUE!',
'Invalid', 'Invalid', 12,
12,
], ],
]; ];

View File

@ -5,82 +5,66 @@
return [ return [
[ [
'#DIV/0!', '#DIV/0!',
0, 0, 0,
0,
], ],
[ [
0.78539816339699997, 0.78539816339699997,
1, 1, 1,
1,
], ],
[ [
-2.3561944901919998, -2.3561944901919998,
-1, -1, -1,
-1,
], ],
[ [
2.3561944901919998, 2.3561944901919998,
-1, -1, 1,
1,
], ],
[ [
-0.78539816339699997, -0.78539816339699997,
1, 1, -1,
-1,
], ],
[ [
1.107148717794, 1.107148717794,
0.5, 0.5, 1,
1,
], ],
[ [
1.8157749899219999, 1.8157749899219999,
-0.5, -0.5, 2,
2,
], ],
[ [
0.67474094222400005, 0.67474094222400005,
1, 1, 0.80000000000000004,
0.80000000000000004,
], ],
[ [
-0.64350110879300004, -0.64350110879300004,
0.80000000000000004, 0.80000000000000004, -0.59999999999999998,
-0.59999999999999998,
], ],
[ [
-1.460139105621, -1.460139105621,
1, 1, -9,
-9,
], ],
[ [
0.0, 0.0,
0.20000000000000001, 0.20000000000000001, 0,
0,
], ],
[ [
1.107148717794, 1.107148717794,
0.10000000000000001, 0.10000000000000001, 0.20000000000000001,
0.20000000000000001,
], ],
[ [
1.570796326795, 1.570796326795,
0, 0, 0.20000000000000001,
0.20000000000000001,
], ],
[ [
'#VALUE!', '#VALUE!',
'A', 'A', 0.20000000000000001,
0.20000000000000001,
], ],
[ [
0.78539816339699997, 0.78539816339699997,
true, true, 1,
1,
], ],
[ [
-1.570796326795, -1.570796326795,
false, false, -2.5,
-2.5,
], ],
]; ];