2026-03-24 13:40:35 +00:00

30 lines
953 B
Rust

//! Minimal, robust smoke test for the VM crate.
//!
//! Intentionally does not assert legacy ISA behavior. It only ensures that:
//! - The VM type can be instantiated without panicking.
//! - Deterministic test utilities work as expected (reproducible RNG).
use prometeu_test_support::{next_u64, rng_from_seed};
use prometeu_vm::VirtualMachine;
#[test]
fn vm_instantiation_is_stable() {
// Create a VM with empty ROM and empty constant pool.
let vm = VirtualMachine::new(vec![], vec![]);
// Basic invariant checks that should remain stable across refactors.
assert_eq!(vm.pc, 0);
assert!(!vm.halted);
}
#[test]
fn deterministic_rng_sequences_match() {
// Demonstrate deterministic behavior without relying on specific values.
let mut a = rng_from_seed(12345);
let mut b = rng_from_seed(12345);
for _ in 0..8 {
// Same seed => same sequence
assert_eq!(next_u64(&mut a), next_u64(&mut b));
}
}