Add more tests.
This commit is contained in:
parent
e4e2bb3356
commit
683cf31de2
@ -106,6 +106,21 @@ fn bench_eval_call(bench: &mut Bencher) {
|
||||
bench.iter(|| engine.eval::<bool>(script).unwrap());
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_eval_deeply_nested(bench: &mut Bencher) {
|
||||
let script = r#"
|
||||
(1 + 2 * 3 - 9) * 4 < 5 * 6 - 70 / 8 &&
|
||||
(42 + 99 > 1 + 2 - 3 + 4 * 5 || 123 - 88 < 123 + 88 - 99 + 100)
|
||||
&& true
|
||||
&& !!!!!!!!false
|
||||
"#;
|
||||
|
||||
let mut engine = Engine::new();
|
||||
engine.set_optimization_level(OptimizationLevel::None);
|
||||
|
||||
bench.iter(|| engine.eval::<bool>(script).unwrap());
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_eval_loop_number(bench: &mut Bencher) {
|
||||
let script = "
|
||||
|
@ -120,6 +120,18 @@ fn test_arrays() -> Result<(), Box<EvalAltResult>> {
|
||||
.into_typed_array::<INT>()?,
|
||||
[1, 2, 3, 4, 5]
|
||||
);
|
||||
#[cfg(not(feature = "no_closure"))]
|
||||
assert!(!engine.eval::<bool>(
|
||||
"
|
||||
let x = 42;
|
||||
let y = [];
|
||||
let f = || x;
|
||||
for n in 0..10 {
|
||||
y += x;
|
||||
}
|
||||
some(y, |x| is_shared(x))
|
||||
"
|
||||
)?);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user