Skip to content

Commit

Permalink
fixed tcp client query test
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscaOrtegaG committed Nov 15, 2023
1 parent d7b13cb commit 4bd4d06
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,21 @@ mod client_test {
domain_name.set_name(String::from("test.test2.com."));
let qtype = "A";
let qclass= "IN";
let response = tcp_client.query(domain_name, qtype, qclass);
let response = tcp_client.query(domain_name, qtype, qclass).unwrap();

println!("Response: {:?}", response);

// let expected_ip: [u8; 4] = [93, 184, 216, 34];
// let answers = response.get_answer();
// for answer in answers {
// let a_rdata = answer.get_rdata();
// match a_rdata {
// Rdata::SomeARdata(val) => {
// assert_eq!(val.get_address(), IpAddr::from(expected_ip))
// },
// _ => {}
// }
// }
let expected_ip: [u8; 4] = [93, 184, 216, 34];
let answers = response.get_answer();
for answer in answers {
let a_rdata = answer.get_rdata();
match a_rdata {
Rdata::SomeARdata(val) => {
assert_eq!(val.get_address(), IpAddr::from(expected_ip))
},
_ => {}
}
}
}

// Constructor test
Expand Down

0 comments on commit 4bd4d06

Please sign in to comment.