Skip to content

Commit

Permalink
Fix benchmarks and no_std
Browse files Browse the repository at this point in the history
  • Loading branch information
pitdicker committed Jan 13, 2018
1 parent 7c4d8a2 commit 99c7029
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
2 changes: 1 addition & 1 deletion benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod distributions;

use std::mem::size_of;
use test::{black_box, Bencher};
use rand::{StdRng, Rng};
use rand::{StdRng, Rng, NewSeeded};

#[bench]
fn rand_f32(b: &mut Bencher) {
Expand Down
2 changes: 1 addition & 1 deletion benches/generators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const BYTES_LEN: usize = 1024;
use std::mem::size_of;
use test::{black_box, Bencher};

use rand::{Rng, StdRng, OsRng, JitterRng};
use rand::{Rng, NewSeeded, StdRng, OsRng, JitterRng};
use rand::{XorShiftRng, Hc128Rng, IsaacRng, Isaac64Rng, ChaChaRng};

macro_rules! gen_bytes {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ use prng::Isaac64Rng as IsaacWordRng;

use distributions::{Range, IndependentSample};
use distributions::range::SampleRange;
use reseeding::{ReseedingRng, ReseedWithNew};
#[cfg(feature="std")]use reseeding::{ReseedingRng, ReseedWithNew};

// public modules
pub mod distributions;
Expand Down
12 changes: 1 addition & 11 deletions src/reseeding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ impl<R: Rng + NewSeeded> Reseeder<R> for ReseedWithNew {
}

#[cfg(test)]
#[cfg(feature="std")]
mod test {
use {impls, le};
use core::default::Default;
Expand Down Expand Up @@ -154,15 +155,4 @@ mod test {
i += 1;
}
}

const FILL_BYTES_V_LEN: usize = 13579;
#[test]
fn test_rng_fill_bytes() {
let mut v = [0u8; FILL_BYTES_V_LEN];
::test::rng(321).fill_bytes(&mut v);

// To test that `fill_bytes` actually did something, check that not all
// bytes are zero.
assert!(!v.iter().all(|&x| x == 0));
}
}

0 comments on commit 99c7029

Please sign in to comment.