refine queue test
This commit is contained in:
parent
db76fbb27b
commit
e18a8775d6
@ -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
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user