(tests) rcode parsing tests #22
10
src/proto.rs
10
src/proto.rs
@ -125,7 +125,7 @@ impl From<bool> for DNSMessageType {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub struct DNSHeader {
|
pub struct DNSHeader {
|
||||||
/// used by the requester to match up replies to outstanding queries
|
/// used by the requester to match up replies to outstanding queries
|
||||||
pub id: u16,
|
pub id: u16,
|
||||||
@ -317,15 +317,13 @@ mod tests {
|
|||||||
dns_query[3] = (rcode as u8) << 0;
|
dns_query[3] = (rcode as u8) << 0;
|
||||||
|
|
||||||
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
||||||
let parse_result_clone = parse_result.clone();
|
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
parse_result.err(),
|
parse_result,
|
||||||
Some(DNSParseError::DNSRCodeInvalid),
|
Err(DNSParseError::DNSRCodeInvalid),
|
||||||
"query: {:02x?}, rcode: {}, parsed_rcode: {:?}",
|
"query: {:02x?}, rcode: {}",
|
||||||
dns_query,
|
dns_query,
|
||||||
rcode,
|
rcode,
|
||||||
parse_result_clone.map(|x| x.response_code).unwrap()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user