Make sure the UUIDs are unique too :)
This commit is contained in:
parent
6fc7e5b05b
commit
b00a3cd4e4
@ -21,5 +21,17 @@ class UUIDTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(0x4000, hexdec(substr($result, 14, 4)) & 0xF000);
|
$this->assertEquals(0x4000, hexdec(substr($result, 14, 4)) & 0xF000);
|
||||||
$this->assertEquals(0x8000, hexdec(substr($result, 19, 4)) & 0xC000);
|
$this->assertEquals(0x8000, hexdec(substr($result, 19, 4)) & 0xC000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testUnique()
|
||||||
|
{
|
||||||
|
$reps = 100;
|
||||||
|
$ids = array();
|
||||||
|
|
||||||
|
for ($i = 0; $i < $reps; $i++) {
|
||||||
|
$ids[] = UUID::gen();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->assertEquals(count($ids), count(array_unique($ids)), "UUIDs must be unique");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user