refine queue test

This commit is contained in:
soruh 2023-08-13 21:09:31 +02:00
parent db76fbb27b
commit e18a8775d6

View File

@ -912,18 +912,20 @@ fn queue() {
let n = rng.gen_range(1..20);
for _ in 0..n {
if rng.gen_bool(0.6) || root.length(transaction) == 0 {
let how_many = rng.gen_range(1..20);
if rng.gen_bool(0.6) || root.length(transaction) < how_many {
let elements = (i..i + how_many).map(U64::from).collect::<Vec<U64>>();
root = root.enqueue_many(transaction, &elements);
i += how_many;
} else {
let res;
(root, res) = root.dequeue(transaction).unwrap();
assert_eq!(res.get(), j);
(root, res) = root.dequeue_many(transaction, how_many).unwrap();
for x in res {
assert_eq!(x.get(), j);
j += 1;
}
}
}
root
});