summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJackson Moore <jacksonmoore@tuta.io>2026-09-04 11:06:49 +0200
committerJackson Moore <jacksonmoore@tuta.io>2026-09-04 11:06:49 +0200
commite36e69073e209c7e3db2f6754e1d04bdc3a3c5ca (patch)
tree2ba74b6097cd74bdc676ab2006286d7debfb6434 /tests
parentd1edd420463cdda399d8acb8124b137cbfd7a898 (diff)
Read repeat clock
Diffstat (limited to 'tests')
-rw-r--r--tests/run.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua
index a2bf7e1..437a3ba 100644
--- a/tests/run.lua
+++ b/tests/run.lua
@@ -3860,6 +3860,30 @@ test("Repeated primary timeout is sampled from live policy", function()
end, "requires a policy")
end)
+test("Positive repeat timeout reads the current clock", function()
+ local _, transitions = fresh_sequence_state()
+ transitions:SetRepeatTimestamp(25.25)
+ local host = MemoryHost.new({
+ configuration = { repeat_timeout_ms = 100 },
+ time_values_ms = { 125.75 },
+ })
+ local resolver = repeat_resolver.new({
+ clock = host,
+ policy = policy.new(host),
+ })
+
+ local decision, elapsed_ms = resolver:evaluate_timeout()
+ same(nil, decision)
+ same(100.5, elapsed_ms)
+ local reads = 0
+ for _, operation in ipairs(host:operations()) do
+ if operation.operation == "read_time_ms" then
+ reads = reads + 1
+ end
+ end
+ same(1, reads)
+end)
+
for _, item in ipairs(tests) do
local ok, failure = xpcall(item.body, debug.traceback)
if not ok then