move test to the proper directory and test #[bench]

This commit is contained in:
Niko Matsakis 2018-02-22 20:16:30 -05:00
parent a0562ec369
commit 0a5f4aebb1

View file

@ -11,8 +11,11 @@
// compile-flags: --test
#![feature(termination_trait)]
#![feature(test)]
extern crate test;
use std::num::ParseIntError;
use test::Bencher;
#[test]
fn is_a_num() -> Result<(), ParseIntError> {
@ -26,3 +29,15 @@ fn not_a_num() -> Result<(), ParseIntError> {
let _: u32 = "abc".parse()?;
Ok(())
}
#[bench]
fn test_a_positive_bench(_: &mut Bencher) -> Result<(), ParseIntError> {
Ok(())
}
#[bench]
#[should_panic]
fn test_a_neg_bench(_: &mut Bencher) -> Result<(), ParseIntError> {
let _: u32 = "abc".parse()?;
Ok(())
}