Skip to content

Commit

Permalink
Test UdpSender
Browse files Browse the repository at this point in the history
  • Loading branch information
seamlik committed Mar 16, 2024
1 parent 5e0c70e commit a071de3
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions main/src/network/udp_sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,31 @@ impl UdpSender for TokioUdpSender {
Self::send_unicast(unicast_address, data).boxed()
}
}

#[cfg(test)]
mod test {
use super::*;
use std::net::Ipv6Addr;

#[tokio::test]
async fn send_multicast() {
crate::test::init();

let address = SocketAddrV6::new(crate::get_discovery_ip(), 1, 0, 0);
TokioUdpSender
.send_multicast(address, Arc::new([1]))
.await
.unwrap();
}

#[tokio::test]
async fn send_unicast() {
crate::test::init();

let address = SocketAddrV6::new(Ipv6Addr::LOCALHOST, 1, 0, 0);
TokioUdpSender
.send_unicast(address, Arc::new([1]))
.await
.unwrap();
}
}

0 comments on commit a071de3

Please sign in to comment.