Skip to content

Commit

Permalink
Merge #52
Browse files Browse the repository at this point in the history
52: Make sure benchmarks can be built r=cuviper a=cuviper

This fixes the rand seeds, and builds benches in nightly CI.

Co-authored-by: Josh Stone <[email protected]>
  • Loading branch information
bors[bot] and cuviper committed May 30, 2018
2 parents f87f2e7 + 40a8e91 commit 9309c8b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion benches/bigint.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(test)]
#![cfg(feature = "rand")]

extern crate test;
extern crate num_bigint;
Expand All @@ -12,7 +13,10 @@ use num_traits::{Zero, One, FromPrimitive, Num};
use rand::{SeedableRng, StdRng};

fn get_rng() -> StdRng {
let seed: &[_] = &[1, 2, 3, 4];
let mut seed = [0; 32];
for i in 1..32 {
seed[usize::from(i)] = i;
}
SeedableRng::from_seed(seed)
}

Expand Down
6 changes: 5 additions & 1 deletion benches/gcd.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(test)]
#![cfg(feature = "rand")]

extern crate test;
extern crate num_bigint;
Expand All @@ -13,7 +14,10 @@ use num_traits::Zero;
use rand::{SeedableRng, StdRng};

fn get_rng() -> StdRng {
let seed: &[_] = &[1, 2, 3, 4];
let mut seed = [0; 32];
for i in 1..32 {
seed[usize::from(i)] = i;
}
SeedableRng::from_seed(seed)
}

Expand Down
5 changes: 5 additions & 0 deletions ci/test_full.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ done
# test all supported features together
cargo build --features="std $FEATURES"
cargo test --features="std $FEATURES"

# make sure benchmarks can be built
if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
cargo bench --all-features --no-run
fi

0 comments on commit 9309c8b

Please sign in to comment.