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

DecimalCosecTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 25
rs 10

2 Methods

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