DecimalArccotTest::arccotProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
use Litipk\BigNumbers\Decimal as Decimal;
4
use PHPUnit\Framework\TestCase;
5
6
/**
7
 * @group arccot
8
 */
9
class DecimalArccotTest extends TestCase
10
{
11
    public function arccotProvider() {
12
        // Some values provided by wolframalpha
13
        return [
14
            ['0.154', '1.41799671285823', 14],
15
            ['0', '1.57079632679489662', 17],
16
            ['-1', '-0.78540', 5],
17
        ];
18
    }
19
20
    /**
21
     * @dataProvider arccotProvider
22
     */
23
    public function testSimple($nr, $answer, $digits)
24
    {
25
        $x = Decimal::fromString($nr);
26
        $arccotX = $x->arccot($digits);
27
28
        $this->assertTrue(
29
            Decimal::fromString($answer)->equals($arccotX),
30
            "The answer must be " . $answer . ", but was " . $arccotX
31
        );
32
    }
33
34
}
35