From 92e6b2352870c37153793256f536ba17fd796de6 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 15 Jun 2014 12:13:56 -0500 Subject: [PATCH] BigInteger: unit test update --- tests/Unit/Math/BigInteger/TestCase.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/Unit/Math/BigInteger/TestCase.php b/tests/Unit/Math/BigInteger/TestCase.php index 5b86645e..87addfd4 100644 --- a/tests/Unit/Math/BigInteger/TestCase.php +++ b/tests/Unit/Math/BigInteger/TestCase.php @@ -266,7 +266,7 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase $this->assertSame('18446744073709551616', (string) $y); } - public function testRandom() + public function testRandomTwoArgument() { $min = $this->getInstance(0); $max = $this->getInstance('18446744073709551616'); @@ -276,11 +276,21 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase // chosen it's just not that likely $this->assertTrue($rand1->compare($min) > 0); $this->assertTrue($rand1->compare($max) < 0); + } - $rand2 = $min->random($max); + public function testRandomOneArgument() + { + $min = $this->getInstance(0); + $max = $this->getInstance('18446744073709551616'); + + $rand1 = $min->random($max); $this->assertTrue($rand1->compare($min) > 0); $this->assertTrue($rand1->compare($max) < 0); + $rand2 = $max->random($min); + $this->assertTrue($rand2->compare($min) > 0); + $this->assertTrue($rand2->compare($max) < 0); + $this->assertFalse($rand1->equals($rand2)); }