Assemble a minimal kernel and run it via `VirtualMachine::new_kernel`. Returns (uart_output, exit_code).
(src: &str, max_steps: u64)
| 21 | .map(|l| { |
| 22 | if let Some(name) = l.strip_suffix(':') { |
| 23 | RvInstruction::Label(name.to_owned()) |
| 24 | } else if l.starts_with('.') { |
| 25 | RvInstruction::Directive(l.to_owned()) |
| 26 | } else { |
| 27 | RvInstruction::Directive(format!("\t{l}")) |
| 28 | } |
| 29 | }) |
| 30 | .collect(); |
| 31 | |
| 32 | let output = Assembler::assemble(&tokens).expect("kernel assembly failed"); |
| 33 | let mut vm = VirtualMachine::new_kernel(&output); |
| 34 | let result = vm.run(max_steps); |
| 35 | let code = match result.outcome { |
| 36 | StepOutcome::Halted(c) => c, |
| 37 | StepOutcome::Continue => i64::MIN, |
| 38 | }; |
| 39 | (result.uart_output, code) |
| 40 | } |
| 41 | |
| 42 | // --- ROM structure tests --- |
| 43 | |
| 44 | #[test] |
| 45 | fn rom_assembles_without_error() { |
| 46 | let bytes = generate_rom_image(); |
| 47 | assert!(!bytes.is_empty(), "ROM image must not be empty"); |
| 48 | } |
| 49 | |
| 50 | #[test] |
no test coverage detected