diff options
author | Nicolas Grekas <nicolas.grekas@gmail.com> | 2015-12-31 14:44:17 +0100 |
---|---|---|
committer | Nicolas Grekas <nicolas.grekas@gmail.com> | 2015-12-31 14:44:17 +0100 |
commit | f27e710b70ea957b1d081b733441947f24b8c10c (patch) | |
tree | a7f4fe32a47d2206ffd41277b915b6571cc83666 | |
parent | d762ee5b099a29044603cd4649851e81aa66cb47 (diff) | |
download | random_compat-f27e710b70ea957b1d081b733441947f24b8c10c.zip random_compat-f27e710b70ea957b1d081b733441947f24b8c10c.tar.gz random_compat-f27e710b70ea957b1d081b733441947f24b8c10c.tar.bz2 |
Add RandomIntTest::testRandomRange
-rw-r--r-- | .travis.yml | 30 | ||||
-rw-r--r-- | tests/unit/RandomIntTest.php | 11 |
2 files changed, 24 insertions, 17 deletions
diff --git a/.travis.yml b/.travis.yml index 43ec127..eee4a11 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,26 +1,22 @@ language: php -php: - -- "7.0" -- "5.6" -- "5.5" -- "5.4" -- "5.3" -- "hhvm" - - sudo: false +php: + - "7.0" + - "5.6" + - "5.5" + - "5.4" + - "5.3" + - "hhvm" + matrix: fast_finish: true allow_failures: - - php: "hhvm" + - php: "hhvm" install: + - composer self-update + - composer update -- composer install -- composer self-update -- composer update -- chmod +x ./phpunit.sh - -script: ./phpunit.sh travis +script: + - ./phpunit.sh 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); + } } |