Skip to content

Commit a64ece6

Browse files
committed
Add test for End of Data PDU versions
1 parent 9d9ba00 commit a64ece6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/rtr/pdu.rs

+27
Original file line numberDiff line numberDiff line change
@@ -1879,6 +1879,33 @@ mod test {
18791879
);
18801880
}
18811881

1882+
#[tokio::test]
1883+
async fn end_of_data_versions() {
1884+
for (version, raw) in [
1885+
(0,
1886+
vec![0, 7, 0x12, 0x34, 0, 0, 0, 12, 0xde, 0xad, 0xbe, 0xef]
1887+
),
1888+
(1,
1889+
vec![0x01, 0x07, 0x8e, 0xef, 0x00, 0x00, 0x00, 0x18,
1890+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x8f,
1891+
0x00, 0x00, 0x02, 0x58, 0x00, 0x00, 0x1c, 0x20
1892+
]
1893+
),
1894+
(2,
1895+
vec![0x02, 0x07, 0x8e, 0xef, 0x00, 0x00, 0x00, 0x18,
1896+
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x8f,
1897+
0x00, 0x00, 0x02, 0x58, 0x00, 0x00, 0x1c, 0x20
1898+
]
1899+
)
1900+
] {
1901+
if let Err(eod) = Payload::read(&mut raw.as_slice()).await.unwrap() {
1902+
assert_eq!(version, eod.version());
1903+
} else {
1904+
panic!("expected End of Data PDU");
1905+
}
1906+
}
1907+
}
1908+
18821909
#[tokio::test]
18831910
async fn read_write_cache_reset() {
18841911
read_write!(

0 commit comments

Comments
 (0)