-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
smoketest that libtest doesn't panic in
#[bench]
- Loading branch information
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) {} |