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

DecimalCosecTest::testSimple()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
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 cosec
7
 */
8
class DecimalCosecTest extends PHPUnit_Framework_TestCase
9
{
10
    public function cosecProvider() {
11
        // Some values provided by Mathematica
12
        return [
13
            ['1', '1.18839510577812', 14],
14
            ['123.123', '-1.76874094322450309', 17],
15
            ['15000000000', '1.44570405082842149818', 20]
16
        ];
17
    }
18
19
    /**
20
     * @dataProvider cosecProvider
21
     */
22
    public function testSimple($nr, $answer, $digits)
23
    {
24
        $x = Decimal::fromString($nr);
25
        $cosecX = $x->cosec((int)$digits);
26
27
        $this->assertTrue(
28
            Decimal::fromString($answer)->equals($cosecX),
29
            "The answer must be " . $answer . ", but was " . $cosecX
30
        );
31
    }
32
}
33