Skip to content

Commit

Permalink
apply review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Apr 23, 2019
1 parent ee0ddcf commit 39a312c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
3 changes: 0 additions & 3 deletions src/distributions/gamma.rs
Expand Up @@ -304,9 +304,6 @@ mod test {
use distributions::Distribution;
use super::{Beta, ChiSquared, StudentT, FisherF};

#[cfg(not(miri))] // Miri is too slow
const N: u32 = 1000;
#[cfg(miri)]
const N: u32 = 100;

#[test]
Expand Down
14 changes: 5 additions & 9 deletions src/distributions/poisson.rs
Expand Up @@ -108,20 +108,16 @@ mod test {
use distributions::Distribution;
use super::Poisson;

#[cfg(not(miri))] // Miri is too slow
const N: u32 = 1000;
#[cfg(miri)]
const N: u32 = 100;

#[test]
#[cfg(not(miri))] // Miri is too slow
fn test_poisson_10() {
let poisson = Poisson::new(10.0);
let mut rng = ::test::rng(123);
let mut sum = 0;
for _ in 0..N {
for _ in 0..1000 {
sum += poisson.sample(&mut rng);
}
let avg = (sum as f64) / (N as f64);
let avg = (sum as f64) / 1000.0;
println!("Poisson average: {}", avg);
assert!((avg - 10.0).abs() < 0.5); // not 100% certain, but probable enough
}
Expand All @@ -133,10 +129,10 @@ mod test {
let poisson = Poisson::new(15.0);
let mut rng = ::test::rng(123);
let mut sum = 0;
for _ in 0..N {
for _ in 0..1000 {
sum += poisson.sample(&mut rng);
}
let avg = (sum as f64) / (N as f64);
let avg = (sum as f64) / 1000.0;
println!("Poisson average: {}", avg);
assert!((avg - 15.0).abs() < 0.5); // not 100% certain, but probable enough
}
Expand Down

0 comments on commit 39a312c

Please sign in to comment.