Failed Conditions
Push — master ( 02f37d...f95322 )
by Adrien
09:26
created

ImSumTest::providerIMSUM()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheetTests\Calculation\Functions\Engineering;
4
5
use PhpOffice\PhpSpreadsheet\Calculation\Engineering;
6
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
7
use PhpOffice\PhpSpreadsheetTests\Custom\ComplexAssert;
8
use PHPUnit\Framework\TestCase;
9
10
class ImSumTest extends TestCase
11
{
12
    const COMPLEX_PRECISION = 1E-8;
13
14
    /**
15
     * @var ComplexAssert
16
     */
17
    protected $complexAssert;
18
19
    protected function setUp(): void
20
    {
21
        Functions::setCompatibilityMode(Functions::COMPATIBILITY_EXCEL);
22
        $this->complexAssert = new ComplexAssert();
23
    }
24
25
    /**
26
     * @dataProvider providerIMSUM
27
     *
28
     * @param mixed $expectedResult
29
     */
30
    public function testIMSUM($expectedResult, ...$args): void
31
    {
32
        $result = Engineering::IMSUM(...$args);
33
        self::assertTrue(
34
            $this->complexAssert->assertComplexEquals($expectedResult, $result, self::COMPLEX_PRECISION),
35
            $this->complexAssert->getErrorMessage()
36
        );
37
    }
38
39
    public function providerIMSUM()
40
    {
41
        return require 'tests/data/Calculation/Engineering/IMSUM.php';
42
    }
43
}
44