Rollup merge of #78538 - ssomers:btree_testing_rng, r=Mark-Simulacrum
BTreeMap: document a curious assumption in test cases r? ```@Mark-Simulacrum```
This commit is contained in:
commit
162f400328
@ -1668,6 +1668,7 @@ create_append_test!(test_append_239, 239);
|
|||||||
create_append_test!(test_append_1700, 1700);
|
create_append_test!(test_append_1700, 1700);
|
||||||
|
|
||||||
fn rand_data(len: usize) -> Vec<(u32, u32)> {
|
fn rand_data(len: usize) -> Vec<(u32, u32)> {
|
||||||
|
assert!(len * 2 <= 70029); // from that point on numbers repeat
|
||||||
let mut rng = DeterministicRng::new();
|
let mut rng = DeterministicRng::new();
|
||||||
Vec::from_iter((0..len).map(|_| (rng.next(), rng.next())))
|
Vec::from_iter((0..len).map(|_| (rng.next(), rng.next())))
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ impl DeterministicRng {
|
|||||||
DeterministicRng { x: 0x193a6754, y: 0xa8a7d469, z: 0x97830e05, w: 0x113ba7bb }
|
DeterministicRng { x: 0x193a6754, y: 0xa8a7d469, z: 0x97830e05, w: 0x113ba7bb }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Guarantees that the first 70029 results are unique.
|
||||||
fn next(&mut self) -> u32 {
|
fn next(&mut self) -> u32 {
|
||||||
let x = self.x;
|
let x = self.x;
|
||||||
let t = x ^ (x << 11);
|
let t = x ^ (x << 11);
|
||||||
|
@ -687,6 +687,7 @@ fn test_first_last() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn rand_data(len: usize) -> Vec<u32> {
|
fn rand_data(len: usize) -> Vec<u32> {
|
||||||
|
assert!(len <= 70029); // from that point on numbers repeat
|
||||||
let mut rng = DeterministicRng::new();
|
let mut rng = DeterministicRng::new();
|
||||||
Vec::from_iter((0..len).map(|_| rng.next()))
|
Vec::from_iter((0..len).map(|_| rng.next()))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user