1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Calculation; |
4
|
|
|
|
5
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Functions; |
6
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Statistical; |
7
|
|
|
use PHPUnit\Framework\TestCase; |
8
|
|
|
|
9
|
|
|
class StatisticalTest extends TestCase |
10
|
|
|
{ |
11
|
|
|
public function setUp() |
12
|
|
|
{ |
13
|
|
|
Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL); |
14
|
|
|
} |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @dataProvider providerCOUNTIF |
18
|
|
|
* |
19
|
|
|
* @param mixed $expectedResult |
20
|
|
|
*/ |
21
|
|
|
public function testCOUNTIF($expectedResult, ...$args) |
22
|
|
|
{ |
23
|
|
|
$result = Statistical::COUNTIF(...$args); |
24
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-12); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
public function providerCOUNTIF() |
28
|
|
|
{ |
29
|
|
|
return require 'data/Calculation/Statistical/COUNTIF.php'; |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @dataProvider providerCOUNTIFS |
34
|
|
|
* |
35
|
|
|
* @param mixed $expectedResult |
36
|
|
|
*/ |
37
|
|
|
public function testCOUNTIFS($expectedResult, ...$args) |
38
|
|
|
{ |
39
|
|
|
$result = Statistical::COUNTIFS(...$args); |
40
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-12); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function providerCOUNTIFS() |
44
|
|
|
{ |
45
|
|
|
return require 'data/Calculation/Statistical/COUNTIFS.php'; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @dataProvider providerMAXIFS |
50
|
|
|
* |
51
|
|
|
* @param mixed $expectedResult |
52
|
|
|
*/ |
53
|
|
|
public function testMAXIFS($expectedResult, ...$args) |
54
|
|
|
{ |
55
|
|
|
$result = Statistical::MAXIFS(...$args); |
56
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-12); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function providerMAXIFS() |
60
|
|
|
{ |
61
|
|
|
return require 'data/Calculation/Statistical/MAXIFS.php'; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @dataProvider providerMINIFS |
66
|
|
|
* |
67
|
|
|
* @param mixed $expectedResult |
68
|
|
|
*/ |
69
|
|
|
public function testMINIFS($expectedResult, ...$args) |
70
|
|
|
{ |
71
|
|
|
$result = Statistical::MINIFS(...$args); |
72
|
|
|
self::assertEquals($expectedResult, $result, '', 1E-12); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function providerMINIFS() |
76
|
|
|
{ |
77
|
|
|
return require 'data/Calculation/Statistical/MINIFS.php'; |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|