refine queue test
This commit is contained in:
parent
db76fbb27b
commit
e18a8775d6
12
src/tests.rs
12
src/tests.rs
@ -912,16 +912,18 @@ fn queue() {
|
|||||||
|
|
||||||
let n = rng.gen_range(1..20);
|
let n = rng.gen_range(1..20);
|
||||||
for _ in 0..n {
|
for _ in 0..n {
|
||||||
if rng.gen_bool(0.6) || root.length(transaction) == 0 {
|
let how_many = rng.gen_range(1..20);
|
||||||
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>>();
|
let elements = (i..i + how_many).map(U64::from).collect::<Vec<U64>>();
|
||||||
root = root.enqueue_many(transaction, &elements);
|
root = root.enqueue_many(transaction, &elements);
|
||||||
i += how_many;
|
i += how_many;
|
||||||
} else {
|
} else {
|
||||||
let res;
|
let res;
|
||||||
(root, res) = root.dequeue(transaction).unwrap();
|
(root, res) = root.dequeue_many(transaction, how_many).unwrap();
|
||||||
assert_eq!(res.get(), j);
|
for x in res {
|
||||||
j += 1;
|
assert_eq!(x.get(), j);
|
||||||
|
j += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user