[domistream] ENet host: test that a ping before the verify ack is not acknowledged (kills mutant M36)
This commit is contained in:
@@ -464,6 +464,24 @@ fn data_before_the_verify_ack_is_not_taken() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ping_before_the_verify_ack_is_not_acknowledged() {
|
||||||
|
// Mutation M36: only a connected peer acknowledges a ping (PROTOCOL.md 3.1, the accepting side); before the
|
||||||
|
// client has acknowledged the verify, an acknowledged ping must not be answered with an ACK.
|
||||||
|
let mut h = EnetHostPeer::accept(host_config(), at(0), &connect_datagram(connect_params(3), 0)).unwrap();
|
||||||
|
let _ = transmitted(&mut h, at(0));
|
||||||
|
let ping = cmd(true, 0xFF, 1, CommandBody::Ping);
|
||||||
|
h.handle_datagram(at(1), &to_host(0, Some(1), vec![ping])).unwrap();
|
||||||
|
assert!(
|
||||||
|
!transmitted(&mut h, at(1))
|
||||||
|
.iter()
|
||||||
|
.flat_map(|d| &d.commands)
|
||||||
|
.any(|c| matches!(c.body, CommandBody::Acknowledge { .. })),
|
||||||
|
"no acknowledgement before the verify is acknowledged"
|
||||||
|
);
|
||||||
|
assert_eq!(h.state(), EnetHostState::AcknowledgingConnect);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn lost_verify_is_retransmitted() {
|
fn lost_verify_is_retransmitted() {
|
||||||
let mut w = wire(Impair::clean(5), Impair::clean(5), 2);
|
let mut w = wire(Impair::clean(5), Impair::clean(5), 2);
|
||||||
|
|||||||
Reference in New Issue
Block a user