Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit e566cb0

Browse files
committed
Simplified two tests
1 parent 224a9f6 commit e566cb0

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed
Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use Litipk\BigNumbers\Decimal as Decimal;
4+
use Litipk\Exceptions\InvalidArgumentTypeException as InvalidArgumentTypeException;
45

56

67
date_default_timezone_set('UTC');
@@ -20,27 +21,21 @@ public function testInfinites()
2021
$this->assertTrue($nInf->isNegative());
2122
}
2223

24+
/**
25+
* @expectedException \DomainException
26+
* @expectedExceptionMessage To ensure consistency, this class doesn't handle NaN objects.
27+
*/
2328
public function testNaN()
2429
{
25-
$catched = false;
26-
try {
27-
Decimal::fromFloat(INF - INF);
28-
} catch (\DomainException $e) {
29-
$catched = true;
30-
}
31-
$this->assertTrue($catched);
30+
Decimal::fromFloat(INF - INF);
3231
}
3332

33+
/**
34+
* @expectedException Litipk\Exceptions\InvalidArgumentTypeException
35+
* @expectedExceptionMessage $fltValue must be of type float
36+
*/
3437
public function testNoFloat()
3538
{
36-
$catched = false;
37-
38-
try {
39-
$n = Decimal::fromFloat(5);
40-
} catch (Exception $e) {
41-
$catched = true;
42-
}
43-
44-
$this->assertTrue($catched);
39+
Decimal::fromFloat(5);
4540
}
4641
}

0 commit comments

Comments
 (0)