Skip to content

Commit

Permalink
Test getTime 10 times within a second (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
oittaa authored Jan 2, 2022
1 parent 651ce89 commit d0ea93f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions tests/UuidTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,14 @@ public function testKnownGetTime()

public function testGetTimeValid()
{
$now = microtime(true);
$uuid6 = UUID::uuid6();
$uuid7 = UUID::uuid7();
$this->assertEqualsWithDelta($now, UUID::getTime($uuid6), 0.001);
$this->assertEqualsWithDelta($now, UUID::getTime($uuid7), 0.001);
for ($i = 1; $i <= 10; $i++) {
$now = microtime(true);
$uuid6 = UUID::uuid6();
$uuid7 = UUID::uuid7();
$this->assertEqualsWithDelta($now, UUID::getTime($uuid6), 0.001);
$this->assertEqualsWithDelta($now, UUID::getTime($uuid7), 0.001);
usleep(100000);
}
}

public function testGetTimeNull()
Expand Down

0 comments on commit d0ea93f

Please sign in to comment.