-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* develop: specify next release fix proofs name remove wip tags fix comparing 2 high resolution points in time when more than a second has elapsed do not allow to generate a diff lower than a millisecond use innmind/static-analysis
- Loading branch information
Showing
9 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
|
||
use Innmind\TimeContinuum\PointInTime\HighResolution; | ||
use Innmind\BlackBox\Set; | ||
|
||
return static function() { | ||
yield proof( | ||
'HighResolution::aheadOf() on different seconds', | ||
given( | ||
Set\Integers::above(0), | ||
Set\Integers::above(0), | ||
Set\Integers::between(0, 999_999_999), | ||
Set\Integers::between(0, 999_999_999), | ||
)->filter(static fn($start, $end) => $start < $end), | ||
static function($assert, $start, $end, $startNanoseconds, $endNanoseconds) { | ||
$start = HighResolution::of($start, $startNanoseconds); | ||
$end = HighResolution::of($end, $endNanoseconds); | ||
|
||
$assert->true($end->aheadOf($start)); | ||
$assert->false($start->aheadOf($end)); | ||
}, | ||
); | ||
|
||
yield proof( | ||
'HighResolution::aheadOf() in same second', | ||
given( | ||
Set\Integers::above(0), | ||
Set\Integers::between(0, 999_999_999), | ||
Set\Integers::between(0, 999_999_999), | ||
)->filter(static fn($_, $start, $end) => $start < $end), | ||
static function($assert, $second, $start, $end) { | ||
$start = HighResolution::of($second, $start); | ||
$end = HighResolution::of($second, $end); | ||
|
||
$assert->true($end->aheadOf($start)); | ||
$assert->false($start->aheadOf($end)); | ||
}, | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters