protected function doTestGenerate(\PasswordLib\Random\Generator $generator, $times) { $inside = 0; $outside = 0; $on = 0; for ($i = 0; $i < $times; $i++) { $byte = $generator->generate(2); $byte = unpack('n', $byte); $byte = array_shift($byte); $xCoord = $byte >> 8; $yCoord = $byte & 0xff; if ($xCoord < $yCoord) { $outside++; } elseif ($xCoord == $yCoord) { $on++; } else { $inside++; } } $this->assertGreaterThan(0, $outside, 'Outside Is 0'); $this->assertGreaterThan(0, $inside, 'Inside Is 0'); $ratio = $inside / $outside; return $ratio; }
/** * @covers PasswordLib\Random\Generator::getSources */ public function testGetSources() { $sources = array(new Source()); $obj = new Generator($sources, new Mixer()); $this->assertSame($sources, $obj->getSources()); }