MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / drive

Function drive

compiler/tests/vm.rs:47–60  ·  view source on GitHub ↗

Resume on each PendingEvent by pushing the next interactive_events entry.

(vm: &mut VM, interactive: &[String])

Source from the content-addressed store, hash-verified

45
46 // Resume on each PendingEvent by pushing the next interactive_events entry.
47 fn drive(vm: &mut VM, interactive: &[String]) -> Result<(), VmErr> {
48 let mut idx = 0;
49 loop {
50 match vm.run() {
51 Ok(_) => return Ok(()),
52 Err(VmErr::HostYield(SchedulerStatus::PendingEvent)) => {
53 if idx >= interactive.len() { return Ok(()); }
54 vm.push_event(&interactive[idx]).expect("push_event");
55 idx += 1;
56 }
57 Err(e) => return Err(e),
58 }
59 }
60 }
61
62 /* Runs every vm.json case under `Limits::sandbox()` rather than `none()`: the budget / heap / call-depth guards are off under `none` (`sandbox_off` short-circuits them), so only the bounded profile exercises the charge_step / charge_steps / back-edge-budget paths and lets cases assert that runaway allocation, recursion, and materialisation surface as `MemoryError` / `RecursionError` instead of hanging. Every case must therefore stay within the sandbox budget. */
63 #[test]

Callers 2

test_casesFunction · 0.85
strict_casesFunction · 0.85

Calls 4

push_eventMethod · 0.80
runMethod · 0.45
lenMethod · 0.45
expectMethod · 0.45

Tested by

no test coverage detected