mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
29 lines
476 B
Rust
29 lines
476 B
Rust
// compile-flags: --test
|
|
// run-pass
|
|
// needs-unwind
|
|
|
|
|
|
#![feature(test)]
|
|
|
|
extern crate test;
|
|
use std::num::ParseIntError;
|
|
use test::Bencher;
|
|
|
|
#[test]
|
|
fn is_a_num() -> Result<(), ParseIntError> {
|
|
let _: u32 = "22".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(())
|
|
}
|