Skip to content

Commit

Permalink
Add RandomIntTest::testRandomRange
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-grekas committed Dec 31, 2015
1 parent d762ee5 commit f27e710
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
30 changes: 13 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions tests/unit/RandomIntTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,15 @@ public function testOutput()
$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);
}
}

0 comments on commit f27e710

Please sign in to comment.