Skip to content

Commit

Permalink
Use more elements for tests, and run travis tests one at a time.
Browse files Browse the repository at this point in the history
  • Loading branch information
huonw committed May 2, 2015
1 parent 4758321 commit 0f54a19
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ before_script:
script:
- |
travis-cargo build &&
travis-cargo test &&
RUST_TEST_THREADS=1 travis-cargo test &&
travis-cargo bench &&
travis-cargo doc
after_success:
Expand Down
11 changes: 4 additions & 7 deletions tests/for_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ extern crate simple_parallel;

use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};

// with this many elements, its (hopefully) likely that the
// threads won't execute sequentially.
const N: usize = 10000;

#[test]
fn probabilistic_out_of_ordering() {
// with this many elements, its (hopefully) likely that the
// threads won't execute sequentially.
const N: usize = 1000;

let mut index = (0..N).map(|_| 0).collect::<Vec<_>>();

static ORDER: AtomicUsize = ATOMIC_USIZE_INIT;
Expand All @@ -23,9 +23,6 @@ fn probabilistic_out_of_ordering() {
#[test]
fn pool() {
let mut pool = simple_parallel::Pool::new(8);
// with this many elements, its (hopefully) likely that the
// threads won't execute sequentially.
const N: usize = 1000;

let mut index = (0..N).map(|_| 0usize).collect::<Vec<_>>();

Expand Down
20 changes: 4 additions & 16 deletions tests/map.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#![feature(core)]
extern crate simple_parallel;

// with this many elements, its (hopefully) likely that the
// threads won't execute sequentially.
const N: usize = 10000;

#[test]
fn unordered_map_probabilistic_out_of_ordering() {
// with this many elements, its (hopefully) likely that the
// threads won't execute sequentially.
const N: usize = 1000;

let f = |_: usize| ();
let iter = simple_parallel::unordered_map(0..N, &f);

Expand All @@ -18,10 +18,6 @@ fn unordered_map_probabilistic_out_of_ordering() {

#[test]
fn map_in_order() {
// with this many elements, its (hopefully) likely that the
// threads won't execute sequentially.
const N: usize = 1000;

let f = |i: usize| i;
let iter = simple_parallel::map(0..N, &f);

Expand All @@ -33,10 +29,6 @@ fn map_in_order() {
fn pool_unordered() {
let mut pool = simple_parallel::Pool::new(8);

// with this many elements, its (hopefully) likely that the
// threads won't execute sequentially.
const N: usize = 1000;

let f = |_: usize| {};
let iter = pool.unordered_map(0..N, &f);

Expand All @@ -52,10 +44,6 @@ fn pool_unordered() {
fn pool_map_in_order() {
let mut pool = simple_parallel::Pool::new(8);

// with this many elements, its (hopefully) likely that the
// threads won't execute sequentially.
const N: usize = 1000;

let f = |i: usize| i;
let iter = pool.map(0..N, &f);

Expand Down

0 comments on commit 0f54a19

Please sign in to comment.