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

DecimalIsZeroTest::testNegativeNumbers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 5
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 DecimalIsZeroTest extends PHPUnit_Framework_TestCase
10
{
11
    public function testZeros()
12
    {
13
        $this->assertTrue(Decimal::fromInteger(0)->isZero());
14
        $this->assertTrue(Decimal::fromFloat(0.0)->isZero());
15
        $this->assertTrue(Decimal::fromString('0')->isZero());
16
    }
17
18
    public function testPositiveNumbers()
19
    {
20
        $this->assertFalse(Decimal::fromInteger(1)->isZero());
21
        $this->assertFalse(Decimal::fromFloat(1.0)->isZero());
22
        $this->assertFalse(Decimal::fromFloat(0.1)->isZero());
23
        $this->assertFalse(Decimal::fromString('1')->isZero());
24
    }
25
26
    public function testNegativeNumbers()
27
    {
28
        $this->assertFalse(Decimal::fromInteger(-1)->isZero());
29
        $this->assertFalse(Decimal::fromFloat(-1.0)->isZero());
30
        $this->assertFalse(Decimal::fromFloat(-0.1)->isZero());
31
        $this->assertFalse(Decimal::fromString('-1')->isZero());
32
    }
33
}
34