Skip to content

Commit

Permalink
Cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
hrzlgnm committed Aug 14, 2024
1 parent dc38e0b commit a540e57
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions tests/mdns_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ fn integration_success() {

let all_interfaces = my_ip_interfaces();
// as we send only once per interface and ip we need a count of unique addresses to verify number of sent unregisters later on
let unique_multicast_itf_idx_ip_ver_set = all_interfaces.iter().map(|itf| {
let ip_ver = match itf.addr {
IfAddr::V4(_) => 4u8,
IfAddr::V6(_) => 6u8,
};
(itf.index.unwrap_or(0), ip_ver)
}).collect::<HashSet<_>>();
let unique_multicast_itf_idx_ip_ver_set = all_interfaces
.iter()
.map(|itf| {
let ip_ver = match itf.addr {
IfAddr::V4(_) => 4u8,
IfAddr::V6(_) => 6u8,
};
(itf.index.unwrap_or(0), ip_ver)
})
.collect::<HashSet<_>>();

let ifaddrs_set: HashSet<_> = all_interfaces.iter().map(|intf| intf.ip()).collect();
let my_ifaddrs: Vec<_> = ifaddrs_set.into_iter().collect();
Expand Down Expand Up @@ -175,7 +178,10 @@ fn integration_success() {
assert_eq!(metrics["register"], 1);
assert_eq!(metrics["unregister"], 1);
assert_eq!(metrics["register-resend"], 1);
assert_eq!(metrics["unregister-resend"], unique_multicast_itf_idx_ip_ver_set.len() as i64);
assert_eq!(
metrics["unregister-resend"],
unique_multicast_itf_idx_ip_ver_set.len() as i64
);
assert!(metrics["browse"] >= 2); // browse has been retransmitted.

// respond has been sent for every browse, or they are suppressed by "known answer".
Expand Down

0 comments on commit a540e57

Please sign in to comment.