test(sim): addressed relay scenario and property tests

This commit is contained in:
2026-10-18 03:22:35 -07:00
parent db39dc1df0
commit c9ee3684f0
3 changed files with 168 additions and 1 deletions
+14 -1
View File
@@ -13,7 +13,7 @@ use crate::world::{SimWorld, WorldConfig};
use std::cell::RefCell;
use std::collections::{BTreeMap, BTreeSet};
use std::rc::Rc;
use tines_core::{MemStore, Node, ObservationId, Store};
use tines_core::{MemStore, Node, NodeId, ObservationId, Store};
/// A single node as seen through the simulation transport.
pub type SimNode = Node<MemStore, SimTransport>;
@@ -67,6 +67,19 @@ impl Sim {
.expect("observe")
}
pub fn observe_to(
&mut self,
node: usize,
to: NodeId,
lifetime_ms: u64,
topic: &[u8],
payload: &[u8],
) -> ObservationId {
self.nodes[node]
.observe_to(to, lifetime_ms, topic, payload, None, self.t)
.expect("observe_to")
}
pub fn id_set(&self, node: usize) -> BTreeSet<ObservationId> {
let mut set = BTreeSet::new();
self.nodes[node].store().for_each_id(&mut |id| {