[domistream] Control host: test first, a refused INPUT_DATA names its input type

This commit is contained in:
2026-12-04 15:47:21 +01:00
parent 90c49c4041
commit a78bde9037
+24
View File
@@ -784,3 +784,27 @@ proptest! {
prop_assert!(messages <= plains.len());
}
}
/// Diagnostics (decision D2 on the host): an INPUT_DATA the host cannot read still says which input type it was, so
/// the black-box log can name what a real client sends (L2 demo: one 10-byte body of an unknown layout, U21).
#[test]
fn refused_input_names_its_type() {
// INPUT_DATA (0x0206): length 10, size (BE) 6 = type + 2 data bytes, type TOUCH 0x55000002 (LE), 2 data bytes.
let mut m = vec![0x06, 0x02, 10, 0];
m.extend_from_slice(&6u32.to_be_bytes());
m.extend_from_slice(&0x5500_0002u32.to_le_bytes());
m.extend_from_slice(&[0xAA, 0xBB]);
match parse_client_message(&m) {
Ok(ClientControlMessage::InputRejected { body_len, input_type, .. }) => {
assert_eq!(body_len, 10);
assert_eq!(input_type, Some(0x5500_0002));
}
other => panic!("{other:?}"),
}
// Too short to carry a type: none.
let short = vec![0x06, 0x02, 2, 0, 0, 0];
match parse_client_message(&short) {
Ok(ClientControlMessage::InputRejected { input_type, .. }) => assert_eq!(input_type, None),
other => panic!("{other:?}"),
}
}