test(sim): property tests for convergence, order independence, monotonicity

This commit is contained in:
2026-10-17 21:42:16 -07:00
parent 9de7157ee2
commit 4706004f47
2 changed files with 270 additions and 1 deletions
+13 -1
View File
@@ -10,7 +10,7 @@ use rand::{rngs::StdRng, SeedableRng};
use std::cell::RefCell;
use std::collections::VecDeque;
use std::rc::Rc;
use tines_core::transport::Event;
use tines_core::transport::{Event, FrameBuf};
/// World configuration for a `SimWorld`.
#[derive(Clone, Debug)]
@@ -105,6 +105,18 @@ impl SimWorld {
pub fn frames_dropped(&self) -> u64 {
self.frames_dropped
}
/// Inject a raw inbound `Frame` into `node`'s mailbox without going through
/// the transport's reachability, MTU, or loss checks.
///
/// A test seam: it lets tests feed arbitrary or malformed byte strings
/// straight to a node's exchange, which is where the "never panic on
/// untrusted wire input" guarantee lives. The frame is not validated here —
/// a malformed frame is dropped by the receiving node's
/// [`Exchange`](tines_core::Exchange) rather than stored.
pub fn inject_frame(&mut self, node: usize, peer: usize, bytes: FrameBuf) {
self.inboxes[node].push_back(Event::Frame(peer, bytes));
}
}
// ---------------------------------------------------------------------------