Completed
Pull Request — master (#51)
by
unknown
08:53
created

DecimalFromDecimalTest::testBasicCase()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
3
use Litipk\BigNumbers\Decimal as Decimal;
4
5
6
date_default_timezone_set('UTC');
7
8
9
class DecimalFromDecimalTest extends PHPUnit_Framework_TestCase
10
{
11
    public function testBasicCase()
12
    {
13
        $n1 = Decimal::fromString('3.45');
14
15
        $this->assertTrue(Decimal::fromDecimal($n1)->equals($n1));
16
        $this->assertTrue(Decimal::fromDecimal($n1, 2)->equals($n1));
17
18
        $this->assertTrue(Decimal::fromDecimal($n1, 1)->equals(Decimal::fromString('3.5')));
19
        $this->assertTrue(Decimal::fromDecimal($n1, 0)->equals(Decimal::fromString('3')));
20
    }
21
}
22