DecimalIsZeroTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testZeros() 0 6 1
A testPositiveNumbers() 0 7 1
A testNegativeNumbers() 0 7 1
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 DecimalIsZeroTest extends TestCase
9
{
10
    public function testZeros()
11
    {
12
        $this->assertTrue(Decimal::fromInteger(0)->isZero());
13
        $this->assertTrue(Decimal::fromFloat(0.0)->isZero());
14
        $this->assertTrue(Decimal::fromString('0')->isZero());
15
    }
16
17
    public function testPositiveNumbers()
18
    {
19
        $this->assertFalse(Decimal::fromInteger(1)->isZero());
20
        $this->assertFalse(Decimal::fromFloat(1.0)->isZero());
21
        $this->assertFalse(Decimal::fromFloat(0.1)->isZero());
22
        $this->assertFalse(Decimal::fromString('1')->isZero());
23
    }
24
25
    public function testNegativeNumbers()
26
    {
27
        $this->assertFalse(Decimal::fromInteger(-1)->isZero());
28
        $this->assertFalse(Decimal::fromFloat(-1.0)->isZero());
29
        $this->assertFalse(Decimal::fromFloat(-0.1)->isZero());
30
        $this->assertFalse(Decimal::fromString('-1')->isZero());
31
    }
32
}
33