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

testZeroAdditiveInverse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
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 DecimalAdditiveInverseTest extends PHPUnit_Framework_TestCase
10
{
11
    public function testZeroAdditiveInverse()
12
    {
13
        $this->assertTrue(Decimal::fromInteger(0)->additiveInverse()->equals(Decimal::fromInteger(0)));
14
    }
15
16
    public function testNegativeAdditiveInverse()
17
    {
18
        $this->assertTrue(Decimal::fromInteger(-1)->additiveInverse()->equals(Decimal::fromInteger(1)));
19
        $this->assertTrue(Decimal::fromString('-1.768')->additiveInverse()->equals(Decimal::fromString('1.768')));
20
    }
21
22
    public function testPositiveAdditiveInverse()
23
    {
24
        $this->assertTrue(Decimal::fromInteger(1)->additiveInverse()->equals(Decimal::fromInteger(-1)));
25
        $this->assertTrue(Decimal::fromString('1.768')->additiveInverse()->equals(Decimal::fromString('-1.768')));
26
    }
27
}
28