This repository was archived by the owner on Dec 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +11
-16
lines changed Expand file tree Collapse file tree 1 file changed +11
-16
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
3
use Litipk \BigNumbers \Decimal as Decimal ;
4
+ use Litipk \Exceptions \InvalidArgumentTypeException as InvalidArgumentTypeException ;
4
5
5
6
6
7
date_default_timezone_set ('UTC ' );
@@ -20,27 +21,21 @@ public function testInfinites()
20
21
$ this ->assertTrue ($ nInf ->isNegative ());
21
22
}
22
23
24
+ /**
25
+ * @expectedException \DomainException
26
+ * @expectedExceptionMessage To ensure consistency, this class doesn't handle NaN objects.
27
+ */
23
28
public function testNaN ()
24
29
{
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 );
32
31
}
33
32
33
+ /**
34
+ * @expectedException Litipk\Exceptions\InvalidArgumentTypeException
35
+ * @expectedExceptionMessage $fltValue must be of type float
36
+ */
34
37
public function testNoFloat ()
35
38
{
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 );
45
40
}
46
41
}
You can’t perform that action at this time.
0 commit comments