aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_indexedbheap_spec.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-07-08 21:39:10 +0200
committerKim Alvefur <zash@zash.se>2020-07-08 21:39:10 +0200
commitdd63e1dfcaae4bcb38253ebdb4480264a7e904b4 (patch)
treef3e54a0f8b9aa72329455973abf76c3a36c224f1 /spec/util_indexedbheap_spec.lua
parentc248dbebd67a205debbce46027a3259b90c91966 (diff)
downloadprosody-dd63e1dfcaae4bcb38253ebdb4480264a7e904b4.tar.gz
prosody-dd63e1dfcaae4bcb38253ebdb4480264a7e904b4.zip
util.indexedbheap: Add failing test case for #1572
This approximates what happens if you add a timer far in the future, then reschedule it to right now.
Diffstat (limited to 'spec/util_indexedbheap_spec.lua')
-rw-r--r--spec/util_indexedbheap_spec.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/util_indexedbheap_spec.lua b/spec/util_indexedbheap_spec.lua
new file mode 100644
index 00000000..a76f94cb
--- /dev/null
+++ b/spec/util_indexedbheap_spec.lua
@@ -0,0 +1,15 @@
+local ibh = require"util.indexedbheap";
+local h
+setup(function ()
+ h = ibh.create();
+end)
+describe("util.indexedbheap", function ()
+ pending("item can be moved from end to top", function ()
+ h:insert("a", 1);
+ h:insert("b", 2);
+ h:insert("c", 3);
+ local id = h:insert("*", 10);
+ h:reprioritize(id, 0);
+ assert.same({ 0, "*", id }, { h:pop() });
+ end)
+end);