aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_data.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_data.lua')
-rw-r--r--test/test_data.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test_data.lua b/test/test_data.lua
index ec95fae..2d4d5c7 100644
--- a/test/test_data.lua
+++ b/test/test_data.lua
@@ -478,3 +478,10 @@ assert(not up[6].behind and not up[6].bump, 'updates row 6: current')
assert(up.upgrade == 3 and up.bump == 1 and up.current == 46 and up.missing == 18,
'updates summary')
assert(data.nvtable_parse('') == nil, 'updates: empty cache is nil')
+
+-- new_gate: opens at most once per interval on the clock it is given.
+local gate = data.new_gate(1.9)
+assert(gate(100.0) == true, 'gate: first call opens')
+assert(gate(100.5) == false, 'gate: closed inside the interval')
+assert(gate(101.95) == true, 'gate: opens after it')
+assert(gate(102.0) == false, 'gate: interval restarts from the last open')