-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for the FLOOR.MATH and FLOOR.PRECISE functions
- Loading branch information
Showing
8 changed files
with
295 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,6 +139,8 @@ FISHER | |
FISHERINV | ||
FIXED | ||
FLOOR | ||
FLOOR.MATH | ||
FLOOR.PRECISE | ||
FORECAST | ||
FREQUENCY | ||
FTEST | ||
|
31 changes: 31 additions & 0 deletions
31
tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorMathTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 FloorMathTest extends TestCase | ||
{ | ||
public function setUp() | ||
{ | ||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); | ||
} | ||
|
||
/** | ||
* @dataProvider providerFLOORMATH | ||
* | ||
* @param mixed $expectedResult | ||
*/ | ||
public function testFLOORMATH($expectedResult, ...$args) | ||
{ | ||
$result = MathTrig::FLOORMATH(...$args); | ||
$this->assertEquals($expectedResult, $result, '', 1E-12); | ||
} | ||
|
||
public function providerFLOORMATH() | ||
{ | ||
return require 'data/Calculation/MathTrig/FLOORMATH.php'; | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/FloorPreciseTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 FloorPreciseTest extends TestCase | ||
{ | ||
public function setUp() | ||
{ | ||
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); | ||
} | ||
|
||
/** | ||
* @dataProvider providerFLOORPRECISE | ||
* | ||
* @param mixed $expectedResult | ||
*/ | ||
public function testFLOOR($expectedResult, ...$args) | ||
{ | ||
$result = MathTrig::FLOORPRECISE(...$args); | ||
$this->assertEquals($expectedResult, $result, '', 1E-12); | ||
} | ||
|
||
public function providerFLOORPRECISE() | ||
{ | ||
return require 'data/Calculation/MathTrig/FLOORPRECISE.php'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
|
||
return [ | ||
[ | ||
2, | ||
2.5, | ||
1, | ||
], | ||
[ | ||
-4, | ||
-2.5, | ||
-2, | ||
], | ||
[ | ||
-4, | ||
-2.5, | ||
2, | ||
], | ||
[ | ||
2, | ||
2.5, | ||
-2, | ||
], | ||
[ | ||
'#DIV/0!', | ||
123.456, | ||
0, | ||
], | ||
[ | ||
1.5, | ||
1.5, | ||
0.10000000000000001, | ||
], | ||
[ | ||
0.23000000000000001, | ||
0.23400000000000001, | ||
0.01, | ||
], | ||
[ | ||
123, | ||
123.456, | ||
], | ||
[ | ||
'#VALUE!', | ||
'ABC', | ||
], | ||
[ | ||
15, | ||
17, | ||
3, | ||
], | ||
[ | ||
16, | ||
19, | ||
4, | ||
], | ||
[ | ||
20, | ||
24.3, | ||
5 | ||
], | ||
[ | ||
6, | ||
6.7 | ||
], | ||
[ | ||
-10, | ||
-8.1, | ||
2 | ||
], | ||
[ | ||
-4, | ||
-5.5, | ||
2, | ||
-1 | ||
], | ||
[ | ||
-4, | ||
-5.5, | ||
2, | ||
1 | ||
], | ||
[ | ||
-6, | ||
-5.5, | ||
2, | ||
0 | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
return [ | ||
[ | ||
2, | ||
2.5, | ||
1, | ||
], | ||
[ | ||
-4, | ||
-2.5, | ||
-2, | ||
], | ||
[ | ||
-4, | ||
-2.5, | ||
2, | ||
], | ||
[ | ||
2, | ||
2.5, | ||
-2, | ||
], | ||
[ | ||
'#DIV/0!', | ||
123.456, | ||
0, | ||
], | ||
[ | ||
1.5, | ||
1.5, | ||
0.10000000000000001, | ||
], | ||
[ | ||
0.23000000000000001, | ||
0.23400000000000001, | ||
0.01, | ||
], | ||
[ | ||
123, | ||
123.456, | ||
], | ||
[ | ||
'#VALUE!', | ||
'ABC', | ||
], | ||
[ | ||
15, | ||
17, | ||
3, | ||
], | ||
[ | ||
16, | ||
19, | ||
4, | ||
], | ||
]; |