diff options
Diffstat (limited to 'vendor/winnow-0.4.7/examples/arithmetic/bench.rs')
-rw-r--r-- | vendor/winnow-0.4.7/examples/arithmetic/bench.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/vendor/winnow-0.4.7/examples/arithmetic/bench.rs b/vendor/winnow-0.4.7/examples/arithmetic/bench.rs new file mode 100644 index 000000000..0f6ec8eef --- /dev/null +++ b/vendor/winnow-0.4.7/examples/arithmetic/bench.rs @@ -0,0 +1,19 @@ +mod parser; + +use parser::expr; + +#[allow(clippy::eq_op, clippy::erasing_op)] +fn arithmetic(c: &mut criterion::Criterion) { + let data = " 2*2 / ( 5 - 1) + 3 / 4 * (2 - 7 + 567 *12 /2) + 3*(1+2*( 45 /2));"; + + assert_eq!( + expr(data), + Ok((";", 2 * 2 / (5 - 1) + 3 * (1 + 2 * (45 / 2)),)) + ); + c.bench_function("arithmetic", |b| { + b.iter(|| expr(data).unwrap()); + }); +} + +criterion::criterion_group!(benches, arithmetic); +criterion::criterion_main!(benches); |