Improve tests

This commit is contained in:
Tobias Ottenweller 2022-04-03 21:02:24 +02:00 committed by ddidderr
parent 00ac8cbb4f
commit e0cc382eeb
Signed by: ddidderr
GPG Key ID: 3841F1C27E6F0E14

View File

@ -237,7 +237,7 @@ mod tests {
assert_eq!(
parse_result.err(),
Some(DNSParseError::DNSOpCodeInvalid),
"query: {:?}, opcode: {}",
"query: {:02x?}, opcode: {}",
dns_query,
opcode
);
@ -261,7 +261,11 @@ mod tests {
for (idx, opcode) in valid_opcodes.iter().enumerate() {
dns_query[2] = opcode << 3;
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
assert_eq!(parse_result?.opcode, valid_parsed_opcodes[idx]);
assert_eq!(
parse_result?.opcode, valid_parsed_opcodes[idx],
"query: {:02x?}, opcode: {}",
dns_query, opcode
);
}
Ok(())
}