Skip to content

Commit

Permalink
Exception Coverage (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
Beakerboy committed Jul 13, 2021
1 parent 8452203 commit 290c4b9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Sequence/NonInteger.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace MathPHP\Sequence;

use MathPHP\Exception;
use MathPHP\Number\Rational;

/**
Expand Down
16 changes: 16 additions & 0 deletions tests/Sequence/NonIntegerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace MathPHP\Tests\Sequence;

use MathPHP\Exception;
use MathPHP\Sequence\NonInteger;

class NonIntegerTest extends \PHPUnit\Framework\TestCase
Expand Down Expand Up @@ -93,4 +94,19 @@ public function dataProviderForHyperharmonicNumbers(): array
[10, 2, [1 => 1, 5/2, 26/6, 77/12, 87/10, 223/20, 481/35, 4609/280, 4861/252, 55991/2520]],
];
}

/**
* @test hyperharmonic throws a OutOfBoundsException when r is less than zero
*/
public function testHyperharmonicSeriesException()
{
// Given
$r = -1;

// Then
$this->expectException(Exception\OutOfBoundsException::class);

// When
NonInteger::hyperharmonic(10, $r);
}
}

0 comments on commit 290c4b9

Please sign in to comment.