tests/utimeq_stable: Test for partial stability of utimeq queuing.

This commit is contained in:
Paul Sokolovsky 2016-12-24 00:25:15 +03:00
parent 7327966da7
commit 492c612f9d
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,23 @@
try:
from utimeq import utimeq
except ImportError:
print("SKIP")
import sys
sys.exit()
h = utimeq(10)
# Check that for 2 same-key items, the queue is stable (pops items
# in the same order they were pushed). Unfortunately, this no longer
# holds for more same-key values, as the underlying heap structure
# is not stable itself.
h.push(100, 20, 0)
h.push(100, 10, 0)
res = [0, 0, 0]
h.pop(res)
assert res == [100, 20, 0]
h.pop(res)
assert res == [100, 10, 0]
print("OK")

View File

@ -0,0 +1 @@
OK