Completed
Push — master ( d0e894...b9f967 )
by Andreu
7s
created

DecimalArccotTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2
Metric Value
wmc 2
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
5
/**
6
 * @group arccot
7
 */
8
class DecimalArccotTest extends PHPUnit_Framework_TestCase
9
{
10
    public function arccotProvider() {
11
        // Some values provided by wolframalpha
12
        return [
13
            ['0.154', '1.41799671285823', 14],
14
            ['0', '1.57079632679489662', 17],
15
            ['-1', '-0.78540', 5],
16
        ];
17
    }
18
19
    /**
20
     * @dataProvider arccotProvider
21
     */
22
    public function testSimple($nr, $answer, $digits)
23
    {
24
        $x = Decimal::fromString($nr);
25
        $arccotX = $x->arccot($digits);
26
27
        $this->assertTrue(
28
            Decimal::fromString($answer)->equals($arccotX),
29
            "The answer must be " . $answer . ", but was " . $arccotX
30
        );
31
    }
32
33
}
34