typos/benches/corrections.rs
2019-06-14 06:45:39 -06:00

22 lines
591 B
Rust

#![feature(test)]
extern crate test;
#[bench]
fn load_corrections(b: &mut test::Bencher) {
b.iter(|| defenestrate::Dictionary::new());
}
#[bench]
fn correction(b: &mut test::Bencher) {
let corrections = defenestrate::Dictionary::new();
assert_eq!(corrections.correct_str("successs"), Some("successes"));
b.iter(|| corrections.correct_str("successs"));
}
#[bench]
fn no_correction(b: &mut test::Bencher) {
let corrections = defenestrate::Dictionary::new();
assert_eq!(corrections.correct_str("success"), None);
b.iter(|| corrections.correct_str("success"));
}