2018-02-08 22:16:39 +00:00
|
|
|
// compile-flags: --test
|
2018-04-12 19:30:37 +00:00
|
|
|
// run-pass
|
2021-12-03 15:32:51 +00:00
|
|
|
// needs-unwind
|
2018-02-08 22:16:39 +00:00
|
|
|
|
2019-08-17 05:08:01 +00:00
|
|
|
|
2018-02-23 01:16:30 +00:00
|
|
|
#![feature(test)]
|
2018-02-08 22:16:39 +00:00
|
|
|
|
2018-02-23 01:16:30 +00:00
|
|
|
extern crate test;
|
2018-02-08 22:16:39 +00:00
|
|
|
use std::num::ParseIntError;
|
2018-02-23 01:16:30 +00:00
|
|
|
use test::Bencher;
|
2018-02-08 22:16:39 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
fn is_a_num() -> Result<(), ParseIntError> {
|
|
|
|
let _: u32 = "22".parse()?;
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
2018-02-23 01:16:30 +00:00
|
|
|
#[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(())
|
|
|
|
}
|