Skip to content

Commit

Permalink
Update test/demo dependencies
Browse files Browse the repository at this point in the history
- cgmath 0.17 -> 0.18
- glium 0.28 -> 0.29
- num 0.2 -> 0.3
- rand 0.7 -> 0.8
- rand_xorshift 0.2 -> 0.3
  • Loading branch information
cuviper committed Feb 26, 2021
1 parent a771f12 commit aa063b1
Show file tree
Hide file tree
Showing 13 changed files with 382 additions and 530 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ default-features = false
[dev-dependencies]
docopt = "1"
lazy_static = "1"
rand = "0.7"
rand_xorshift = "0.2"
rand = "0.8"
rand_xorshift = "0.3"

[dev-dependencies.serde]
version = "1.0.85"
Expand Down
841 changes: 344 additions & 497 deletions ci/compat-Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions rayon-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ crossbeam-deque = "0.8.0"
crossbeam-utils = "0.8.0"

[dev-dependencies]
rand = "0.7"
rand_xorshift = "0.2"
rand = "0.8"
rand_xorshift = "0.3"
scoped-tls = "1.0"

[target.'cfg(unix)'.dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions rayon-core/src/scope/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ fn random_tree1(depth: usize, rng: &mut XorShiftRng) -> Tree<u32> {
let children = if depth == 0 {
vec![]
} else {
(0..rng.gen_range(0, 4)) // somewhere between 0 and 3 children at each level
(0..rng.gen_range(0..4)) // somewhere between 0 and 3 children at each level
.map(|_| random_tree1(depth - 1, rng))
.collect()
};

Tree {
value: rng.gen_range(0, 1_000_000),
value: rng.gen_range(0..1_000_000),
children,
}
}
Expand Down
12 changes: 6 additions & 6 deletions rayon-demo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ publish = false

[dependencies]
rayon = { path = "../" }
cgmath = "0.17"
cgmath = "0.18"
docopt = "1"
fixedbitset = "0.3.0"
glium = "0.28.0"
fixedbitset = "0.3"
glium = "0.29"
lazy_static = "1"
rand = "0.7"
rand_xorshift = "0.2"
rand = "0.8"
rand_xorshift = "0.3"
regex = "1"

[dependencies.serde]
Expand All @@ -28,4 +28,4 @@ winapi = { version = "0.3", features = ["processthreadsapi"] }

[dev-dependencies]
doc-comment = "0.3"
num = "0.2"
num = "0.3"
14 changes: 7 additions & 7 deletions rayon-demo/src/nbody/nbody.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,24 @@ impl NBodyBenchmark {
pub fn new<R: Rng>(num_bodies: usize, rng: &mut R) -> NBodyBenchmark {
let bodies0: Vec<_> = (0..num_bodies)
.map(|_| {
let r = rng.gen_range(0.0, 10_000.0);
let theta = rng.gen_range(0.0, PI);
let phi = rng.gen_range(0.0, 2.0 * PI);
let r = rng.gen_range(0.0..10_000.0);
let theta = rng.gen_range(0.0..PI);
let phi = rng.gen_range(0.0..2.0 * PI);
let position = Point3 {
x: r * theta.sin() * phi.cos(),
y: r * theta.sin() * phi.sin(),
z: r * theta.cos(),
};

let velocity = Vector3 {
x: rng.gen_range(-0.5, 0.5) * INITIAL_VELOCITY,
y: rng.gen_range(-0.5, 0.5) * INITIAL_VELOCITY,
x: rng.gen_range(-0.5..0.5) * INITIAL_VELOCITY,
y: rng.gen_range(-0.5..0.5) * INITIAL_VELOCITY,
z: rng.gen::<f64>() * INITIAL_VELOCITY + 10.0,
};

let velocity2 = Vector3 {
x: rng.gen_range(-0.5, 0.5) * INITIAL_VELOCITY,
y: rng.gen_range(-0.5, 0.5) * INITIAL_VELOCITY,
x: rng.gen_range(-0.5..0.5) * INITIAL_VELOCITY,
y: rng.gen_range(-0.5..0.5) * INITIAL_VELOCITY,
z: rng.gen::<f64>() * INITIAL_VELOCITY,
};

Expand Down
8 changes: 4 additions & 4 deletions rayon-demo/src/nbody/visualize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ pub fn visualize_benchmarks(num_bodies: usize, mut mode: ExecutionMode) {
let instances: Vec<_> = (0..num_bodies)
.map(|_| Instance {
color: [
rng.gen_range(0.5, 1.0),
rng.gen_range(0.5, 1.0),
rng.gen_range(0.5, 1.0),
rng.gen_range(0.5..1.0),
rng.gen_range(0.5..1.0),
rng.gen_range(0.5..1.0),
],
world_position: [0.0, 0.0, 0.0],
})
Expand Down Expand Up @@ -171,7 +171,7 @@ pub fn visualize_benchmarks(num_bodies: usize, mut mode: ExecutionMode) {
let aspect = width as f32 / height as f32;

let proj = cgmath::perspective(Rad::full_turn() / 6.0, aspect, 0.1, 3000.0);
let view = Matrix4::look_at(
let view = Matrix4::look_at_rh(
Point3::new(10.0, 10.0, 10.0),
Point3::origin(),
Vector3::unit_z(),
Expand Down
7 changes: 6 additions & 1 deletion rayon-demo/src/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ fn gen_strings(len: usize) -> Vec<String> {
let mut v = vec![];
for _ in 0..len {
let n = rng.sample(&len_dist);
v.push(rng.sample_iter(&Alphanumeric).take(n).collect());
v.push(
rng.sample_iter(&Alphanumeric)
.map(char::from)
.take(n)
.collect(),
);
}
v
}
Expand Down
2 changes: 1 addition & 1 deletion rayon-demo/src/str_split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ lazy_static::lazy_static! {
bytes.shuffle(&mut rng);
String::from_utf8(bytes).unwrap()
};
static ref COUNT: usize = { HAYSTACK.split(' ').count() };
static ref COUNT: usize = HAYSTACK.split(' ').count();
}

fn get_string_count() -> (&'static str, usize) {
Expand Down
8 changes: 4 additions & 4 deletions src/slice/mergesort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,12 +739,12 @@ mod tests {
check(&[1, 2, 2, 2, 2, 3], &[]);
check(&[], &[1, 2, 2, 2, 2, 3]);

let mut rng = thread_rng();
let ref mut rng = thread_rng();

for _ in 0..100 {
let limit: u32 = rng.gen_range(1, 21);
let left_len: usize = rng.gen_range(0, 20);
let right_len: usize = rng.gen_range(0, 20);
let limit: u32 = rng.gen_range(1..21);
let left_len: usize = rng.gen_range(0..20);
let right_len: usize = rng.gen_range(0..20);

let mut left = rng
.sample_iter(&Uniform::new(0, limit))
Expand Down
2 changes: 1 addition & 1 deletion src/slice/quicksort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ mod tests {

#[test]
fn test_heapsort() {
let rng = thread_rng();
let ref mut rng = thread_rng();

for len in (0..25).chain(500..501) {
for &modulus in &[5, 10, 100] {
Expand Down
4 changes: 2 additions & 2 deletions src/slice/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ macro_rules! sort {
($f:ident, $name:ident) => {
#[test]
fn $name() {
let mut rng = thread_rng();
let ref mut rng = thread_rng();

for len in (0..25).chain(500..501) {
for &modulus in &[5, 10, 100] {
Expand Down Expand Up @@ -105,7 +105,7 @@ fn test_par_sort_stability() {
let mut rng = thread_rng();
let mut v: Vec<_> = (0..len)
.map(|_| {
let n: usize = rng.gen_range(0, 10);
let n: usize = rng.gen_range(0..10);
counts[n] += 1;
(n, counts[n])
})
Expand Down
2 changes: 1 addition & 1 deletion tests/sort-panic-safe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ fn sort_panic_safe() {
let mut rng = thread_rng();
let mut input = (0..len)
.map(|id| DropCounter {
x: rng.gen_range(0, modulus),
x: rng.gen_range(0..modulus),
id,
version: Cell::new(0),
})
Expand Down

0 comments on commit aa063b1

Please sign in to comment.