EmbarkStudios / cervo

Utility wrappers for tract
Apache License 2.0
40 stars 1 forks source link

Replace `drain()` with `while` + `pop()` to preserve queue ordering #37

Closed jaxs-ribs closed 1 year ago

jaxs-ribs commented 1 year ago

BinaryHeaps drain() method only drains the heap in arbitrary order. The rotation test didn't catch it, as the arbitrary order is deterministic and happened to be correct. This PR changes the test so that the old drain method fails and replaces drain with a while + pop combination.