chore: ci script and README

This commit is contained in:
2026-10-17 21:48:37 -07:00
parent 4706004f47
commit ab9b892d94
19 changed files with 468 additions and 137 deletions
+3 -3
View File
@@ -9,10 +9,10 @@
#![deny(warnings)]
pub mod trace;
pub mod world;
pub mod transport;
pub mod sim;
pub mod trace;
pub mod transport;
pub mod world;
pub use sim::{Sim, SimNode};
pub use trace::{Contact, ContactTrace};
+6 -1
View File
@@ -53,7 +53,12 @@ mod tests {
#[test]
fn in_contact_matches_both_orders() {
let mut trace = ContactTrace::default();
trace.contacts.push(Contact { start_ms: 100, end_ms: 200, a: 3, b: 7 });
trace.contacts.push(Contact {
start_ms: 100,
end_ms: 200,
a: 3,
b: 7,
});
assert!(!trace.in_contact(3, 7, 50)); // before the window
assert!(trace.in_contact(3, 7, 100)); // at the start edge
assert!(trace.in_contact(7, 3, 150)); // mid-window, either order
+1 -2
View File
@@ -49,8 +49,7 @@ impl Transport for SimTransport {
if !w.trace.in_contact(self.me, *to, w.prev_t) {
return Err(SendError::Unreachable);
}
if frame.len() > w.cfg.mtu
&& !matches!(Frame::decode(frame), Ok(Frame::Summary { .. })) {
if frame.len() > w.cfg.mtu && !matches!(Frame::decode(frame), Ok(Frame::Summary { .. })) {
return Err(SendError::TooLarge);
}
if w.rng.gen::<f64>() < w.cfg.loss {
+13 -9
View File
@@ -150,9 +150,12 @@ mod tests {
seed,
};
let mut trace = ContactTrace::default();
trace
.contacts
.push(Contact { start_ms: start, end_ms: end, a: 0, b: 1 });
trace.contacts.push(Contact {
start_ms: start,
end_ms: end,
a: 0,
b: 1,
});
SimWorld::new(cfg, trace)
}
@@ -163,9 +166,7 @@ mod tests {
/// The number of `Frame` events queued in `node`'s inbox.
fn frame_count(world: &Rc<RefCell<SimWorld>>, node: usize) -> usize {
world
.borrow()
.inboxes[node]
world.borrow().inboxes[node]
.iter()
.filter(|e| matches!(e, Event::Frame(_, _)))
.count()
@@ -244,9 +245,12 @@ mod tests {
};
let make_trace = || {
let mut trace = ContactTrace::default();
trace
.contacts
.push(Contact { start_ms: 0, end_ms: 1000, a: 0, b: 1 });
trace.contacts.push(Contact {
start_ms: 0,
end_ms: 1000,
a: 0,
b: 1,
});
trace
};
let w1 = SimWorld::new(cfg.clone(), make_trace());