test(core): PairTransport helper

This commit is contained in:
2026-10-17 15:19:25 -07:00
parent 566b217be2
commit 12e7c79730
2 changed files with 113 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
mod common;
use common::PairTransport;
use tines_core::transport::{Event, FrameBuf, Transport};
#[test]
fn pair_transport_connect_then_frame() {
let (mut a, mut b) = PairTransport::pair(1500);
a.connect();
assert_eq!(a.poll(), Some(Event::Contact(1)));
a.send(&1, b"hi").unwrap();
assert_eq!(
b.poll(),
Some(Event::Frame(0, FrameBuf::from_slice(b"hi").unwrap()))
);
}