summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNicolas Grekas <nicolas.grekas@gmail.com>2015-12-31 14:44:17 +0100
committerNicolas Grekas <nicolas.grekas@gmail.com>2015-12-31 14:44:17 +0100
commitf27e710b70ea957b1d081b733441947f24b8c10c (patch)
treea7f4fe32a47d2206ffd41277b915b6571cc83666 /tests
parentd762ee5b099a29044603cd4649851e81aa66cb47 (diff)
downloadrandom_compat-f27e710b70ea957b1d081b733441947f24b8c10c.zip
random_compat-f27e710b70ea957b1d081b733441947f24b8c10c.tar.gz
random_compat-f27e710b70ea957b1d081b733441947f24b8c10c.tar.bz2
Add RandomIntTest::testRandomRange
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/RandomIntTest.php11
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);
+ }
}