mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-25 10:31:02 -05:00
23 lines
580 B
Rust
23 lines
580 B
Rust
#![feature(test)]
|
|
|
|
extern crate test;
|
|
|
|
#[bench]
|
|
fn load_corrections(b: &mut test::Bencher) {
|
|
b.iter(|| scorrect::Dictionary::new());
|
|
}
|
|
|
|
#[bench]
|
|
fn correction(b: &mut test::Bencher) {
|
|
let corrections = scorrect::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 = scorrect::Dictionary::new();
|
|
assert_eq!(corrections.correct_str("success"), None);
|
|
b.iter(|| corrections.correct_str("success"));
|
|
}
|
|
|