Add recursive fibonacci as test
This commit is contained in:
parent
aeedfb4ef2
commit
ab059ce18c
18
src/lib.rs
18
src/lib.rs
@ -96,5 +96,23 @@ mod tests {
|
|||||||
|
|
||||||
assert_eq!(interpreter.output(), &expected_output);
|
assert_eq!(interpreter.output(), &expected_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_recursive_fib() {
|
||||||
|
|
||||||
|
let filename = "recursive_fib.nek";
|
||||||
|
let correct_result = 832040;
|
||||||
|
|
||||||
|
let mut interpreter = Interpreter::new();
|
||||||
|
interpreter.capture_output = true;
|
||||||
|
|
||||||
|
let code = read_to_string(format!("examples/{filename}")).unwrap();
|
||||||
|
|
||||||
|
interpreter.run_str(&code);
|
||||||
|
|
||||||
|
let expected_output = [Value::I64(correct_result)];
|
||||||
|
|
||||||
|
assert_eq!(interpreter.output(), &expected_output);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user