mirror of
https://github.com/PaddiM8/kalker.git
synced 2025-01-31 17:09:13 +01:00
Added test_undefined_fn for the interpreter.
This commit is contained in:
parent
125499065a
commit
0274721878
@ -358,6 +358,16 @@ mod tests {
|
|||||||
assert_eq!(context.interpret(vec![stmt]).unwrap().unwrap(), 3);
|
assert_eq!(context.interpret(vec![stmt]).unwrap().unwrap(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_undefined_fn() {
|
||||||
|
let stmt = Stmt::Expr(fn_call("f", vec![*literal("1")]));
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
interpret(stmt),
|
||||||
|
Err(CalcError::UndefinedFn(String::from("f")))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test_case("1", "2", 9f64)]
|
#[test_case("1", "2", 9f64)]
|
||||||
#[test_case("1.2", "2.3", 9f64)]
|
#[test_case("1.2", "2.3", 9f64)]
|
||||||
fn test_sum_fn(start: &str, to: &str, result: f64) {
|
fn test_sum_fn(start: &str, to: &str, result: f64) {
|
||||||
|
Loading…
Reference in New Issue
Block a user