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

Commit 9d321f8

Browse files
committed
Fix of the exceptions test for tan and cotan
1 parent fd71051 commit 9d321f8

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

tests/Decimal/DecimalCotanTest.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,14 @@ public function testSimple($nr, $answer, $digits)
3131
);
3232
}
3333

34+
/**
35+
* @expectedException \DomainException
36+
* @expectedExceptionMessage The cotangent of this 'angle' is undefined.
37+
*/
3438
public function testCotanPiDiv()
3539
{
3640
$PI = DecimalConstants::PI();
37-
38-
$catched = false;
39-
try {
40-
$PI->cotan();
41-
} catch (\DomainException $e) {
42-
$catched = true;
43-
}
44-
$this->assertTrue($catched);
41+
$PI->cotan();
4542
}
4643

4744
}

tests/Decimal/DecimalTanTest.php

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

3-
use Litipk\BigNumbers\Decimal as Decimal;
3+
use \Litipk\BigNumbers\Decimal as Decimal;
44
use \Litipk\BigNumbers\DecimalConstants as DecimalConstants;
55

66
/**
@@ -31,18 +31,16 @@ public function testSimple($nr, $answer, $digits)
3131
);
3232
}
3333

34+
/**
35+
* @expectedException \DomainException
36+
* @expectedExceptionMessage The tangent of this 'angle' is undefined.
37+
*/
3438
public function testTanPiTwoDiv()
3539
{
3640
$PI = DecimalConstants::PI();
3741
$two = Decimal::fromInteger(2);
3842
$PiDividedByTwo = $PI->div($two);
39-
40-
$catched = false;
41-
try {
42-
$PiDividedByTwo->tan();
43-
} catch (\DomainException $e) {
44-
$catched = true;
45-
}
46-
$this->assertTrue($catched);
43+
$PiDividedByTwo->tan();
4744
}
45+
4846
}

0 commit comments

Comments
 (0)