smoketest that libtest doesn't panic in #[bench]
This commit is contained in:
parent
b56cb9e032
commit
8c71820e17
9
src/test/run-make/test-benches/Makefile
Normal file
9
src/test/run-make/test-benches/Makefile
Normal file
@ -0,0 +1,9 @@
|
||||
include ../../run-make-fulldeps/tools.mk
|
||||
|
||||
all:
|
||||
# Smoke-test that `#[bench]` isn't entirely broken.
|
||||
$(RUSTC) --test smokebench.rs -O
|
||||
$(call RUN,smokebench --bench)
|
||||
$(call RUN,smokebench --bench noiter)
|
||||
$(call RUN,smokebench --bench yesiter)
|
||||
$(call RUN,smokebench)
|
14
src/test/run-make/test-benches/smokebench.rs
Normal file
14
src/test/run-make/test-benches/smokebench.rs
Normal file
@ -0,0 +1,14 @@
|
||||
#![feature(test)]
|
||||
extern crate test;
|
||||
|
||||
#[bench]
|
||||
fn smoke_yesiter(b: &mut test::Bencher) {
|
||||
let mut i = 0usize;
|
||||
b.iter(|| {
|
||||
i = i.wrapping_add(1);
|
||||
i
|
||||
})
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn smoke_noiter(_: &mut test::Bencher) {}
|
Loading…
x
Reference in New Issue
Block a user