diff options
| author | Liigo Zhuang <com.liigo@gmail.com> | 2014-04-01 09:16:35 +0800 |
|---|---|---|
| committer | Liigo Zhuang <com.liigo@gmail.com> | 2014-04-11 17:31:13 +0800 |
| commit | 408f484b660d507617d5293c03942b5b5dd7bc0a (patch) | |
| tree | 0985ff6b425cefd60bc47303a47be722a67fae64 /src/libstd/num | |
| parent | 9af93ad54ddf2ac7a04d5ea0c07ad362537e8126 (diff) | |
| download | rust-408f484b660d507617d5293c03942b5b5dd7bc0a.tar.gz rust-408f484b660d507617d5293c03942b5b5dd7bc0a.zip | |
libtest: rename `BenchHarness` to `Bencher`
Closes #12640
Diffstat (limited to 'src/libstd/num')
| -rw-r--r-- | src/libstd/num/mod.rs | 4 | ||||
| -rw-r--r-- | src/libstd/num/strconv.rs | 50 |
2 files changed, 27 insertions, 27 deletions
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 9d0b53f945f..52167fa58b9 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -1773,13 +1773,13 @@ mod tests { #[cfg(test)] mod bench { extern crate test; - use self::test::BenchHarness; + use self::test::Bencher; use num; use slice; use prelude::*; #[bench] - fn bench_pow_function(b: &mut BenchHarness) { + fn bench_pow_function(b: &mut Bencher) { let v = slice::from_fn(1024, |n| n); b.iter(|| {v.iter().fold(0, |old, new| num::pow(old, *new));}); } diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index b15b5872fc2..3ce9a3d0764 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -815,86 +815,86 @@ mod bench { extern crate test; mod uint { - use super::test::BenchHarness; + use super::test::Bencher; use rand::{XorShiftRng, Rng}; use num::ToStrRadix; #[bench] - fn to_str_bin(bh: &mut BenchHarness) { + fn to_str_bin(b: &mut Bencher) { let mut rng = XorShiftRng::new().unwrap(); - bh.iter(|| { rng.gen::<uint>().to_str_radix(2); }) + b.iter(|| { rng.gen::<uint>().to_str_radix(2); }) } #[bench] - fn to_str_oct(bh: &mut BenchHarness) { + fn to_str_oct(b: &mut Bencher) { let mut rng = XorShiftRng::new().unwrap(); - bh.iter(|| { rng.gen::<uint>().to_str_radix(8); }) + b.iter(|| { rng.gen::<uint>().to_str_radix(8); }) } #[bench] - fn to_str_dec(bh: &mut BenchHarness) { + fn to_str_dec(b: &mut Bencher) { let mut rng = XorShiftRng::new().unwrap(); - bh.iter(|| { rng.gen::<uint>().to_str_radix(10); }) + b.iter(|| { rng.gen::<uint>().to_str_radix(10); }) } #[bench] - fn to_str_hex(bh: &mut BenchHarness) { + fn to_str_hex(b: &mut Bencher) { let mut rng = XorShiftRng::new().unwrap(); - bh.iter(|| { rng.gen::<uint>().to_str_radix(16); }) + b.iter(|| { rng.gen::<uint>().to_str_radix(16); }) } #[bench] - fn to_str_base_36(bh: &mut BenchHarness) { + fn to_str_base_36(b: &mut Bencher) { let mut rng = XorShiftRng::new().unwrap(); - bh.iter(|| { rng.gen::<uint>().to_str_radix(36); }) + b.iter(|| { rng.gen::<uint>().to_str_radix(36); }) } } mod int { - use super::test::BenchHarness; + use super::test::Bencher; use rand::{XorShiftRng, Rng}; use num::ToStrRadix; #[bench] - fn to_str_bin(bh: &mut BenchHarness) { + fn to_str_bin(b: &mut Bencher) { let mut rng = XorShiftRng::new().unwrap(); - bh.iter(|| { rng.gen::<int>().to_str_radix(2); }) + b.iter(|| { rng.gen::<int>().to_str_radix(2); }) } #[bench] - fn to_str_oct(bh: &mut BenchHarness) { + fn to_str_oct(b: &mut Bencher) { let mut rng = XorShiftRng::new().unwrap(); - bh.iter(|| { rng.gen::<int>().to_str_radix(8); }) + b.iter(|| { rng.gen::<int>().to_str_radix(8); }) } #[bench] - fn to_str_dec(bh: &mut BenchHarness) { + fn to_str_dec(b: &mut Bencher) { let mut rng = XorShiftRng::new().unwrap(); - bh.iter(|| { rng.gen::<int>().to_str_radix(10); }) + b.iter(|| { rng.gen::<int>().to_str_radix(10); }) } #[bench] - fn to_str_hex(bh: &mut BenchHarness) { + fn to_str_hex(b: &mut Bencher) { let mut rng = XorShiftRng::new().unwrap(); - bh.iter(|| { rng.gen::<int>().to_str_radix(16); }) + b.iter(|| { rng.gen::<int>().to_str_radix(16); }) } #[bench] - fn to_str_base_36(bh: &mut BenchHarness) { + fn to_str_base_36(b: &mut Bencher) { let mut rng = XorShiftRng::new().unwrap(); - bh.iter(|| { rng.gen::<int>().to_str_radix(36); }) + b.iter(|| { rng.gen::<int>().to_str_radix(36); }) } } mod f64 { - use super::test::BenchHarness; + use super::test::Bencher; use rand::{XorShiftRng, Rng}; use f64; #[bench] - fn float_to_str(bh: &mut BenchHarness) { + fn float_to_str(b: &mut Bencher) { let mut rng = XorShiftRng::new().unwrap(); - bh.iter(|| { f64::to_str(rng.gen()); }) + b.iter(|| { f64::to_str(rng.gen()); }) } } } |
