Skip to content

Commit 42f8c65

Browse files
committed
Removed socket2::SockAddr from the tests in packet.rs
1 parent 5cb8cca commit 42f8c65

1 file changed

Lines changed: 15 additions & 22 deletions

File tree

src/packet.rs

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,6 @@ impl_universe_discovery_packet_universe_discovery_layer!(<'a>);
14971497
mod test {
14981498
use super::*;
14991499
use core::net::{Ipv4Addr, Ipv6Addr, SocketAddrV4, SocketAddrV6};
1500-
use socket2::SockAddr;
15011500

15021501
/// The universe_to tests below check that the conversion from a universe to an IPv6 or IPv4 multicast address is done as
15031502
/// per ANSI E1.31-2018 Section 9.3.1 Table 9-10 (IPv4) and ANSI E1.31-2018 Section 9.3.2 Table 9-11 + Table 9-12.
@@ -1552,14 +1551,12 @@ mod test {
15521551

15531552
#[test]
15541553
fn test_universe_to_ip_ipv4_limit_low() {
1555-
let res: SockAddr = universe_to_ipv4_multicast_addr(E131_MIN_MULTICAST_UNIVERSE)
1556-
.unwrap()
1557-
.into();
1554+
let res = universe_to_ipv4_multicast_addr(E131_MIN_MULTICAST_UNIVERSE).unwrap();
15581555

1559-
assert!(res.as_socket_ipv4().unwrap().ip().is_multicast());
1556+
assert!(res.ip().is_multicast());
15601557

15611558
assert_eq!(
1562-
res.as_socket_ipv4().unwrap(),
1559+
res,
15631560
SocketAddrV4::new(
15641561
Ipv4Addr::new(
15651562
239,
@@ -1603,14 +1600,14 @@ mod test {
16031600
#[test]
16041601
fn test_universe_to_ipv6_lowest_byte_normal() {
16051602
let val: u16 = 119;
1606-
let res: SockAddr = universe_to_ipv6_multicast_addr(val).unwrap().into();
1603+
let res = universe_to_ipv6_multicast_addr(val).unwrap();
16071604

1608-
assert!(res.as_socket_ipv6().unwrap().ip().is_multicast());
1605+
assert!(res.ip().is_multicast());
16091606

16101607
let low_16: u16 = (((val / 256) as u16) << 8) | ((val % 256) as u16);
16111608

16121609
assert_eq!(
1613-
res.as_socket_ipv6().unwrap(),
1610+
res,
16141611
SocketAddrV6::new(
16151612
Ipv6Addr::new(0xFF18, 0, 0, 0, 0, 0, 0x8300, low_16),
16161613
ACN_SDT_MULTICAST_PORT,
@@ -1623,14 +1620,14 @@ mod test {
16231620
#[test]
16241621
fn test_universe_to_ip_ipv6_both_bytes_normal() {
16251622
let val: u16 = 300;
1626-
let res: SockAddr = universe_to_ipv6_multicast_addr(val).unwrap().into();
1623+
let res = universe_to_ipv6_multicast_addr(val).unwrap();
16271624

1628-
assert!(res.as_socket_ipv6().unwrap().ip().is_multicast());
1625+
assert!(res.ip().is_multicast());
16291626

16301627
let low_16: u16 = (((val / 256) as u16) << 8) | ((val % 256) as u16);
16311628

16321629
assert_eq!(
1633-
res.as_socket_ipv6().unwrap(),
1630+
res,
16341631
SocketAddrV6::new(
16351632
Ipv6Addr::new(0xFF18, 0, 0, 0, 0, 0, 0x8300, low_16),
16361633
ACN_SDT_MULTICAST_PORT,
@@ -1642,17 +1639,15 @@ mod test {
16421639

16431640
#[test]
16441641
fn test_universe_to_ip_ipv6_limit_high() {
1645-
let res: SockAddr = universe_to_ipv6_multicast_addr(E131_MAX_MULTICAST_UNIVERSE)
1646-
.unwrap()
1647-
.into();
1642+
let res = universe_to_ipv6_multicast_addr(E131_MAX_MULTICAST_UNIVERSE).unwrap();
16481643

1649-
assert!(res.as_socket_ipv6().unwrap().ip().is_multicast());
1644+
assert!(res.ip().is_multicast());
16501645

16511646
let low_16: u16 = (((E131_MAX_MULTICAST_UNIVERSE / 256) as u16) << 8)
16521647
| ((E131_MAX_MULTICAST_UNIVERSE % 256) as u16);
16531648

16541649
assert_eq!(
1655-
res.as_socket_ipv6().unwrap(),
1650+
res,
16561651
SocketAddrV6::new(
16571652
Ipv6Addr::new(0xFF18, 0, 0, 0, 0, 0, 0x8300, low_16),
16581653
ACN_SDT_MULTICAST_PORT,
@@ -1664,17 +1659,15 @@ mod test {
16641659

16651660
#[test]
16661661
fn test_universe_to_ip_ipv6_limit_low() {
1667-
let res: SockAddr = universe_to_ipv6_multicast_addr(E131_MIN_MULTICAST_UNIVERSE)
1668-
.unwrap()
1669-
.into();
1662+
let res = universe_to_ipv6_multicast_addr(E131_MIN_MULTICAST_UNIVERSE).unwrap();
16701663

1671-
assert!(res.as_socket_ipv6().unwrap().ip().is_multicast());
1664+
assert!(res.ip().is_multicast());
16721665

16731666
let low_16: u16 = (((E131_MIN_MULTICAST_UNIVERSE / 256) as u16) << 8)
16741667
| ((E131_MIN_MULTICAST_UNIVERSE % 256) as u16);
16751668

16761669
assert_eq!(
1677-
res.as_socket_ipv6().unwrap(),
1670+
res,
16781671
SocketAddrV6::new(
16791672
Ipv6Addr::new(0xFF18, 0, 0, 0, 0, 0, 0x8300, low_16),
16801673
ACN_SDT_MULTICAST_PORT,

0 commit comments

Comments
 (0)