Use u64 for operations counter.
This commit is contained in:
@@ -86,14 +86,14 @@ fn test_module_resolver() -> Result<(), Box<EvalAltResult>> {
|
||||
*engine
|
||||
.eval::<INT>(
|
||||
r#"
|
||||
let x = 0;
|
||||
let sum = 0;
|
||||
|
||||
for x in range(0, 10) {
|
||||
import "hello" as h;
|
||||
x += h::answer;
|
||||
sum += h::answer;
|
||||
}
|
||||
|
||||
x
|
||||
sum
|
||||
"#
|
||||
)
|
||||
.expect_err("should error"),
|
||||
@@ -105,18 +105,18 @@ fn test_module_resolver() -> Result<(), Box<EvalAltResult>> {
|
||||
*engine
|
||||
.eval::<INT>(
|
||||
r#"
|
||||
let x = 0;
|
||||
let sum = 0;
|
||||
|
||||
fn foo() {
|
||||
import "hello" as h;
|
||||
x += h::answer;
|
||||
sum += h::answer;
|
||||
}
|
||||
|
||||
for x in range(0, 10) {
|
||||
foo();
|
||||
}
|
||||
|
||||
x
|
||||
sum
|
||||
"#
|
||||
)
|
||||
.expect_err("should error"),
|
||||
|
@@ -16,19 +16,14 @@ fn test_stack_overflow_fn_calls() -> Result<(), Box<EvalAltResult>> {
|
||||
);
|
||||
|
||||
#[cfg(not(feature = "unchecked"))]
|
||||
match engine.eval::<()>(
|
||||
assert!(matches!(
|
||||
*engine.eval::<()>(
|
||||
r"
|
||||
fn foo(n) { if n == 0 { 0 } else { n + foo(n-1) } }
|
||||
foo(1000)
|
||||
",
|
||||
) {
|
||||
Ok(_) => panic!("should be stack overflow"),
|
||||
Err(err) => match *err {
|
||||
EvalAltResult::ErrorInFunctionCall(name, _, _)
|
||||
if name.starts_with("foo > foo > foo") => {}
|
||||
_ => panic!("should be stack overflow"),
|
||||
},
|
||||
}
|
||||
").expect_err("should error"),
|
||||
EvalAltResult::ErrorInFunctionCall(name, _, _) if name.starts_with("foo > foo > foo")
|
||||
));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user