DecimalArccotTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A arccotProvider() 0 8 1
A testSimple() 0 10 1
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