Use result for test
This commit is contained in:
parent
0dc41ef845
commit
00ac8cbb4f
10
src/proto.rs
10
src/proto.rs
@ -245,7 +245,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn parse_dns_header_opcode_valid() {
|
fn parse_dns_header_opcode_valid() -> Result<(), DNSParseError> {
|
||||||
let mut dns_query = [
|
let mut dns_query = [
|
||||||
0xff, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0xff, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
];
|
];
|
||||||
@ -261,10 +261,8 @@ mod tests {
|
|||||||
for (idx, opcode) in valid_opcodes.iter().enumerate() {
|
for (idx, opcode) in valid_opcodes.iter().enumerate() {
|
||||||
dns_query[2] = opcode << 3;
|
dns_query[2] = opcode << 3;
|
||||||
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
let parse_result = DNSHeader::from_udp_datagram(&dns_query);
|
||||||
assert_eq!(
|
assert_eq!(parse_result?.opcode, valid_parsed_opcodes[idx]);
|
||||||
parse_result.map(|x| x.opcode),
|
}
|
||||||
Ok(valid_parsed_opcodes[idx])
|
Ok(())
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user