diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 11:07:12 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 11:07:12 +0200 |
| commit | 8a86e09e8ff40cf45e948562324a47378751690f (patch) | |
| tree | d69e06fc00912e84bbbf0c9bff2fcc0ef96e4534 /tests/run.lua | |
| parent | e36e69073e209c7e3db2f6754e1d04bdc3a3c5ca (diff) | |
Truncate elapsed milliseconds
Diffstat (limited to 'tests/run.lua')
| -rw-r--r-- | tests/run.lua | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/run.lua b/tests/run.lua index 437a3ba..d024c8d 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -3874,7 +3874,7 @@ test("Positive repeat timeout reads the current clock", function() local decision, elapsed_ms = resolver:evaluate_timeout() same(nil, decision) - same(100.5, elapsed_ms) + same(100, elapsed_ms) local reads = 0 for _, operation in ipairs(host:operations()) do if operation.operation == "read_time_ms" then @@ -3884,6 +3884,16 @@ test("Positive repeat timeout reads the current clock", function() same(1, reads) end) +test("Elapsed repeat milliseconds truncate toward zero", function() + same(99, repeat_resolver.truncate_elapsed_ms(99.999)) + same(-99, repeat_resolver.truncate_elapsed_ms(-99.999)) + same(100, repeat_resolver.truncate_elapsed_ms(100)) + same(0, repeat_resolver.truncate_elapsed_ms(-0.75)) + fails(function() + repeat_resolver.truncate_elapsed_ms(0 / 0) + end, "finite") +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
