Files
prometeu-runtime/crates/tools/pbxgen-dummy-boy/tests/visual_cartridge.rs
T
bquarkz c2bf8d055c feat(stress): add a deterministic particle demo with sequenced music
Move Storm Eagle playback and source assets to Stress Console and keep Dummy Boy silent. Exercise VM math, seeded Random and persistent typed particles with a projected tunnel, bounded 512-sprite heavy workload, reproducible replays and measured costs.
2026-11-20 22:15:47 +00:00

36 lines
1.5 KiB
Rust

use prometeu_host_headless::{AdvanceFrameOutcome, HeadlessHost};
use std::path::PathBuf;
#[test]
fn dummy_boy_is_visual_only_and_silent() {
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("../../../test-cartridges/dummy-boy");
assert!(!root.join("assets.pa").exists());
assert_eq!(std::fs::read(root.join("program.pbx")).unwrap(), pbxgen_dummy_boy::build_program());
assert_eq!(
std::fs::read(root.join("manifest.json")).unwrap(),
pbxgen_dummy_boy::manifest_json()
);
let manifest: serde_json::Value =
serde_json::from_slice(&pbxgen_dummy_boy::manifest_json()).unwrap();
assert_eq!(manifest["capabilities"], serde_json::json!(["gfx2d"]));
let mut host = HeadlessHost::new();
host.boot(root.to_string_lossy()).unwrap();
let expected = [10098790910174709541_u64, 9216878996269485861, 8328467396362782501];
for index in 0..6 {
assert!(matches!(
host.advance_frame().unwrap(),
AdvanceFrameOutcome::FrameCompleted { .. }
));
let frame = host.capture_frame().unwrap();
let hash = frame.frame.pixels.iter().fold(0xcbf29ce484222325_u64, |hash, byte| {
(hash ^ u64::from(*byte)).wrapping_mul(0x100000001b3)
});
assert_eq!(hash, expected[index % 3]);
host.resume().unwrap();
let mut pcm = [1.0; 1600];
host.render_audio(&mut pcm);
assert_eq!(pcm, [0.0; 1600]);
}
assert_eq!(host.audio_diagnostics().maximum_voices, 0);
}