diff options
Diffstat (limited to 'tests/unit/RandomIntTest.php')
-rw-r--r-- | tests/unit/RandomIntTest.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit/RandomIntTest.php b/tests/unit/RandomIntTest.php index f9fc3c3..6b94a99 100644 --- a/tests/unit/RandomIntTest.php +++ b/tests/unit/RandomIntTest.php @@ -49,4 +49,15 @@ class RandomIntTest extends PHPUnit_Framework_TestCase $this->assertTrue($ex instanceof Exception); } } + + public function testRandomRange() + { + $try = 64; + $maxLen = strlen(~PHP_INT_MAX); + do { + $rand = random_int(~PHP_INT_MAX, PHP_INT_MAX); + } while (strlen($rand) !== $maxLen && $try--); + + $this->assertGreaterThan(0, $try); + } } |