fix: complete logical clock wall-time isolation

This commit is contained in:
2026-08-03 16:09:35 +00:00
parent ed3c84aa8e
commit 41ec80c96b
67 changed files with 689 additions and 231 deletions
+8
View File
@@ -5,6 +5,7 @@ namespace sammo;
use PHPUnit\Framework\TestCase;
require_once __DIR__ . '/../src/sammo/GameClock.php';
require_once __DIR__ . '/../hwe/sammo/TurnExecutionHelper.php';
final class GameClockTest extends TestCase
{
@@ -58,6 +59,7 @@ final class GameClockTest extends TestCase
);
self::assertSame(123_456, $clock->nowTick());
self::assertSame($clock->formatTick(123_456), $clock->formatNow());
self::assertFalse($wallRead);
}
@@ -96,4 +98,10 @@ final class GameClockTest extends TestCase
$this->expectException(\OverflowException::class);
GameClock::addTicks(GameClock::MAX_SAFE_TICK, 1);
}
public function testGlobalCompletionTickIsMonotonicAcrossSubTickExecution(): void
{
self::assertSame(36_000_000, TurnExecutionHelper::monotonicCompletionTick(36_000_000, 35_500_000));
self::assertSame(36_500_000, TurnExecutionHelper::monotonicCompletionTick(36_000_000, 36_500_000));
}
}