message: add test of sequentiell pi calculation
diff: extern crate test;
  +use std::f64::consts::PI;
  +
  #[cfg(test)]
  mod tests {
  use super::*;
  use std::thread;
  use test::Bencher;
  - fn pi(nthreads: u64, num_steps: u64)
  - {
  + fn pi_sequentiel(num_steps: u64) -> f64 {
  + let step = 1.0 / num_steps as f64;
  + let mut sum = 0 as f64;
  +
  + for i in 0..num_steps {
  + let x = (i as f64 + 0.5) * step;
  + sum += 4.0 / (1.0 + x * x);
  + }
  +
  + let mypi = sum * (1.0 / num_steps as f64);
  + println!("Pi: {} (sequentiell)", mypi);
  +
  + mypi
  + }
  +
  + fn pi_parallel(nthreads: u64, num_steps: u64) -> f64 {
  let step = 1.0 / num_steps as f64;
  let mut sum = 0.0 as f64;
  @@ -33,13 +49,23 @@ mod tests {
  sum += t.join().unwrap();
  }
  - println!("Pi: {}", sum * (1.0 / num_steps as f64));
  + let mypi = sum * (1.0 / num_steps as f64);
  + println!("Pi: {} (with {} threads)", mypi, nthreads);
  +
  + mypi
  }
  #[bench]
  - fn bench_pi(b: &mut Bencher) {
  - b.iter(|| pi(2, 10000000));
  + fn bench_pi_sequentiel(b: &mut Bencher) {
  + b.iter(|| pi_sequentiel(50000000));
  + }
  +
  + #[test]
  + fn pi_sequentiel_test() {
  + let mypi = pi_sequentiel(50000000);
  +
  + assert!((mypi - PI).abs() < 0.00001);
  }
  #[test]
  