diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-12-24 00:25:15 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2016-12-24 00:25:15 +0300 |
commit | 492c612f9d2b552cedca6cd7202c768b26585ed3 (patch) | |
tree | dce8e6e30ccab88e2f3561986fc07047defc9c5a /tests/extmod/utimeq_stable.py | |
parent | 7327966da73b1c22d6658489c2a032932467e495 (diff) | |
download | micropython-492c612f9d2b552cedca6cd7202c768b26585ed3.tar.gz micropython-492c612f9d2b552cedca6cd7202c768b26585ed3.zip |
tests/utimeq_stable: Test for partial stability of utimeq queuing.
Diffstat (limited to 'tests/extmod/utimeq_stable.py')
-rw-r--r-- | tests/extmod/utimeq_stable.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/extmod/utimeq_stable.py b/tests/extmod/utimeq_stable.py new file mode 100644 index 0000000000..9f6ba76d4a --- /dev/null +++ b/tests/extmod/utimeq_stable.py @@ -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") |