Skip to content

Commit eae8be3

Browse files
authored
getTime() tests with overflowing subsecond part (#52)
1 parent f625a0c commit eae8be3

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

tests/FutureTimeTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public function testFutureTimeVersion6()
4545
$uuid1,
4646
$uuid2
4747
);
48+
$this->assertLessThan(
49+
0,
50+
strcmp(UUID::getTime($uuid1), UUID::getTime($uuid2))
51+
);
4852
$uuid1 = $uuid2;
4953
}
5054
}
@@ -58,6 +62,10 @@ public function testFutureTimeVersion7()
5862
$uuid1,
5963
$uuid2
6064
);
65+
$this->assertLessThan(
66+
0,
67+
strcmp(UUID::getTime($uuid1), UUID::getTime($uuid2))
68+
);
6169
$uuid1 = $uuid2;
6270
}
6371
}

tests/UuidTest.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ public function testCanGenerateValidVersion6()
5858
$uuid1,
5959
$uuid2
6060
);
61-
$this->assertGreaterThan(
62-
UUID::getTime($uuid1),
63-
UUID::getTime($uuid2)
64-
);
6561
$this->assertLessThan(
6662
0,
6763
UUID::cmp($uuid1, $uuid2)
@@ -83,10 +79,6 @@ public function testCanGenerateValidVersion7()
8379
$uuid1,
8480
$uuid2
8581
);
86-
$this->assertGreaterThan(
87-
UUID::getTime($uuid1),
88-
UUID::getTime($uuid2)
89-
);
9082
$this->assertLessThan(
9183
0,
9284
UUID::cmp($uuid1, $uuid2)

0 commit comments

Comments
 (0)