add realistic root knowledge mode to treetest

This commit is contained in:
Michael Mikovsky
2026-04-24 16:46:56 -06:00
parent de3a7d3381
commit 18cdefaefb
5 changed files with 656 additions and 76 deletions
+41
View File
@@ -0,0 +1,41 @@
use treetest::{model::NodeId, scenarios::built_in_scenarios, sim::Simulation};
#[test]
fn realistic_mode_memory_reset_forgets_deeper_nodes() {
let scenarios = built_in_scenarios();
let mut simulation = Simulation::new(scenarios[2].clone()).expect("scenario should build");
simulation
.call_echo_leaf(NodeId(2), "echo", "learn this nested leaf")
.expect("echo call should start");
simulation.drain().expect("network should drain");
assert!(
simulation
.root_knowledge
.node(&simulation.node(NodeId(2)).path)
.is_some()
);
simulation.enable_realistic_mode_with_memory_reset();
assert!(simulation.is_realistic_mode());
assert!(
simulation
.root_knowledge
.node(&simulation.node(NodeId(2)).path)
.is_none()
);
assert!(
simulation
.root_knowledge
.node(&simulation.node(NodeId(1)).path)
.is_some()
);
assert!(
simulation
.root_knowledge
.node(&simulation.node(NodeId(0)).path)
.is_some()
);
}