feat: execute source control flow and exact real arithmetic

This commit is contained in:
2026-11-12 10:48:27 +08:00
parent f3e1670c58
commit 5ff1c68f5f
28 changed files with 1045 additions and 117 deletions
+19 -2
View File
@@ -1593,7 +1593,22 @@ fn managed_coroutine_hard_budget_accumulates_and_error_releases_frames() {
use endor_core::CoroutineProgress;
let mut vm = Vm::new().unwrap();
let globals = vm.new_dict().unwrap();
let code = return_constant(&mut vm, Value::Nil);
// Reaching ReturnValue at the limit succeeds; keep a third instruction
// beyond the hard limit to exercise failure before the next Pending yield.
let code = vm
.new_code(
EndorCode::from_instructions(
&[
Instruction::simple(Opcode::Nop),
Instruction::new(Opcode::LoadConst, 0),
Instruction::simple(Opcode::ReturnValue),
],
vec![Value::Nil],
CodeLayout::default(),
)
.unwrap(),
)
.unwrap();
let function = vm
.new_function("limited", code, globals, vec![], vec![])
.unwrap();
@@ -1603,7 +1618,9 @@ fn managed_coroutine_hard_budget_accumulates_and_error_releases_frames() {
&[],
ExecutionLimits {
max_frames: 4,
max_instructions: 1,
// The second resume reaches the cumulative limit before
// the third instruction, without replaying the first.
max_instructions: 2,
},
)
.unwrap();