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

DecimalArccotTest::testSimple()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 3
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