typos/benches/corrections.rs

23 lines
591 B
Rust
Raw Normal View History

2019-01-22 17:01:33 -05:00
#![feature(test)]
extern crate test;
#[bench]
fn load_corrections(b: &mut test::Bencher) {
2019-04-16 19:27:55 -04:00
b.iter(|| defenestrate::Dictionary::new());
2019-01-22 17:01:33 -05:00
}
#[bench]
fn correction(b: &mut test::Bencher) {
2019-04-16 19:27:55 -04:00
let corrections = defenestrate::Dictionary::new();
2019-01-22 17:01:33 -05:00
assert_eq!(corrections.correct_str("successs"), Some("successes"));
b.iter(|| corrections.correct_str("successs"));
}
#[bench]
fn no_correction(b: &mut test::Bencher) {
2019-04-16 19:27:55 -04:00
let corrections = defenestrate::Dictionary::new();
2019-01-22 17:01:33 -05:00
assert_eq!(corrections.correct_str("success"), None);
b.iter(|| corrections.correct_str("success"));
}