BigInteger: unit test update

This commit is contained in:
terrafrost 2014-06-15 12:13:56 -05:00
parent 34a971d317
commit 92e6b23528

View File

@ -266,7 +266,7 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
$this->assertSame('18446744073709551616', (string) $y); $this->assertSame('18446744073709551616', (string) $y);
} }
public function testRandom() public function testRandomTwoArgument()
{ {
$min = $this->getInstance(0); $min = $this->getInstance(0);
$max = $this->getInstance('18446744073709551616'); $max = $this->getInstance('18446744073709551616');
@ -276,11 +276,21 @@ abstract class Unit_Math_BigInteger_TestCase extends PhpseclibTestCase
// chosen it's just not that likely // chosen it's just not that likely
$this->assertTrue($rand1->compare($min) > 0); $this->assertTrue($rand1->compare($min) > 0);
$this->assertTrue($rand1->compare($max) < 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($min) > 0);
$this->assertTrue($rand1->compare($max) < 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)); $this->assertFalse($rand1->equals($rand2));
} }