Lines
100 %
Functions
Branches
// Skipped under Miri: these tests compile+run wasm via wasmtime, whose
// Cranelift backend refuses to run under Miri.
#![cfg(not(miri))]
//! PERSIST: a later unit over many carried instances compiles, runs and
//! reads the right value through the interpreter.
use nms::interpreter::Interpreter;
fn carried(count: u32) -> Interpreter {
let mut interp = Interpreter::new(false).unwrap();
interp.eval("(defstruct pt x)").unwrap();
let fill = format!(
"(defvar *ps* (do ((i 0 (+ i 1)) (acc nil (cons (make-pt :x i) acc))) ((= i {count}) acc)))"
);
interp.eval(&fill).unwrap();
interp
}
#[test]
fn a_later_unit_runs_over_many_carried_instances() {
let mut interp = carried(8_000);
let outcome = interp.eval("(+ 1 (pt-x (car *ps*)))");
assert!(outcome.is_ok(), "{outcome:?}");
assert!(format!("{outcome:?}").contains("8000"), "{outcome:?}");