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

DecimalSecTest::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 sec
7
 */
8
class DecimalSecTest extends PHPUnit_Framework_TestCase
9
{
10
    public function SecProvider() {
11
        // Some values provided by Mathematica
12
        return [
13
            ['5', '3.52532008581609', 14],
14
            ['456.456', '-1.66172995090378344', 17],
15
            ['28000000000', '-1.11551381955633891873', 20],
16
        ];
17
    }
18
19
    /**
20
     * @dataProvider secProvider
21
     */
22
    public function testSimple($nr, $answer, $digits)
23
    {
24
        $x = Decimal::fromString($nr);
25
        $secX = $x->sec((int)$digits);
26
27
        $this->assertTrue(
28
            Decimal::fromString($answer)->equals($secX),
29
            "The answer must be " . $answer . ", but was " . $secX
30
        );
31
    }
32
}
33