DecimalFromDecimalTest::testBasicCase()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
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
use PHPUnit\Framework\TestCase;
5
6
date_default_timezone_set('UTC');
7
8
class DecimalFromDecimalTest extends TestCase
9
{
10
    public function testBasicCase()
11
    {
12
        $n1 = Decimal::fromString('3.45');
13
14
        $this->assertTrue(Decimal::fromDecimal($n1)->equals($n1));
15
        $this->assertTrue(Decimal::fromDecimal($n1, 2)->equals($n1));
16
17
        $this->assertTrue(Decimal::fromDecimal($n1, 1)->equals(Decimal::fromString('3.5')));
18
        $this->assertTrue(Decimal::fromDecimal($n1, 0)->equals(Decimal::fromString('3')));
19
    }
20
}
21