Skip to content

Commit 9309c8b

Browse files
bors[bot]cuviper
andcommitted
Merge #52
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]>
2 parents f87f2e7 + 40a8e91 commit 9309c8b

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

benches/bigint.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(test)]
2+
#![cfg(feature = "rand")]
23

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

1415
fn get_rng() -> StdRng {
15-
let seed: &[_] = &[1, 2, 3, 4];
16+
let mut seed = [0; 32];
17+
for i in 1..32 {
18+
seed[usize::from(i)] = i;
19+
}
1620
SeedableRng::from_seed(seed)
1721
}
1822

benches/gcd.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(test)]
2+
#![cfg(feature = "rand")]
23

34
extern crate test;
45
extern crate num_bigint;
@@ -13,7 +14,10 @@ use num_traits::Zero;
1314
use rand::{SeedableRng, StdRng};
1415

1516
fn get_rng() -> StdRng {
16-
let seed: &[_] = &[1, 2, 3, 4];
17+
let mut seed = [0; 32];
18+
for i in 1..32 {
19+
seed[usize::from(i)] = i;
20+
}
1721
SeedableRng::from_seed(seed)
1822
}
1923

ci/test_full.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,8 @@ done
2929
# test all supported features together
3030
cargo build --features="std $FEATURES"
3131
cargo test --features="std $FEATURES"
32+
33+
# make sure benchmarks can be built
34+
if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then
35+
cargo bench --all-features --no-run
36+
fi

0 commit comments

Comments
 (0)