Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
02d815f
std::net: site-local ipv6 prefixes are global
little-dude Nov 19, 2018
5aea184
std::net: improve Ipv6Addr::is_unicast_site_local() doc
little-dude Nov 19, 2018
1f0aa40
std::net: add Ipv6Addr::is_unicast_link_local_strict()
little-dude Nov 19, 2018
aea687c
std::net: fix doc markdown in Ipv6Addr::is_unique_local()
little-dude Nov 19, 2018
8f67997
std::net: add Ipv4Addr::is_reserved()
little-dude Nov 19, 2018
de3cf0d
std::net: add Ipv4Addr::is_benchmarking()
little-dude Nov 19, 2018
f87b967
std::net: add Ipv4Addr::is_ietf_protocol_assignment()
little-dude Nov 19, 2018
67291cc
std::net: add Ipv4Addr::is_shared()
little-dude Nov 19, 2018
9f6a747
std::net: fix Ipv4Addr::is_global()
little-dude Nov 19, 2018
8106320
std::net: fix documentation markdown
little-dude Nov 20, 2018
c34bcc6
std::net: use macros to test ip properties
little-dude Nov 20, 2018
c302d2c
std::net: fix Ipv4addr::is_global() tests
little-dude Apr 20, 2019
99d9bb6
std::net: fix tests for site-local ipv6 addresses
little-dude Apr 21, 2019
40d0127
std::net: tests for Ipv6addr::is_unicast_link_local{_strict}()
little-dude Apr 22, 2019
9dcfd9f
std::net: tests for Ipv4addr::is_benchmarking()
little-dude Apr 22, 2019
a2bead8
std::net: tests for Ipv4addr::is_ietf_protocol_assignment()
little-dude Apr 22, 2019
6662777
std::net: tests for Ipv4addr::is_reserved()
little-dude Apr 22, 2019
634dcd0
std::net: add warning in Ipv6Addr::is_unicast_site_local() doc
little-dude Apr 23, 2019
fe718ef
std::net: add warning in Ipv4addr::is_reserved() documentation
little-dude Apr 23, 2019
cddb838
std::net: tests for Ipv4addr::is_shared()
little-dude Apr 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
std::net: tests for Ipv6addr::is_unicast_link_local{_strict}()
  • Loading branch information
little-dude committed Apr 22, 2019
commit 40d0127a091dbf3eb55ef57de5facc4983ee472d
69 changes: 49 additions & 20 deletions src/libstd/net/ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2164,16 +2164,17 @@ mod tests {
let unique_local: u16 = 1 << 2;
let global: u16 = 1 << 3;
let unicast_link_local: u16 = 1 << 4;
let unicast_site_local: u16 = 1 << 5;
let unicast_global: u16 = 1 << 6;
let documentation: u16 = 1 << 7;
let multicast_interface_local: u16 = 1 << 8;
let multicast_link_local: u16 = 1 << 9;
let multicast_realm_local: u16 = 1 << 10;
let multicast_admin_local: u16 = 1 << 11;
let multicast_site_local: u16 = 1 << 12;
let multicast_organization_local: u16 = 1 << 13;
let multicast_global: u16 = 1 << 14;
let unicast_link_local_strict: u16 = 1 << 5;
let unicast_site_local: u16 = 1 << 6;
let unicast_global: u16 = 1 << 7;
let documentation: u16 = 1 << 8;
let multicast_interface_local: u16 = 1 << 9;
let multicast_link_local: u16 = 1 << 10;
let multicast_realm_local: u16 = 1 << 11;
let multicast_admin_local: u16 = 1 << 12;
let multicast_site_local: u16 = 1 << 13;
let multicast_organization_local: u16 = 1 << 14;
let multicast_global: u16 = 1 << 15;
let multicast: u16 = multicast_interface_local
| multicast_admin_local
| multicast_global
Expand Down Expand Up @@ -2207,6 +2208,11 @@ mod tests {
} else {
assert!(!ip!($s).is_unicast_link_local());
}
if ($mask & unicast_link_local_strict) == unicast_link_local_strict {
assert!(ip!($s).is_unicast_link_local_strict());
} else {
assert!(!ip!($s).is_unicast_link_local_strict());
}
if ($mask & unicast_site_local) == unicast_site_local {
assert!(ip!($s).is_unicast_site_local());
} else {
Expand Down Expand Up @@ -2265,16 +2271,17 @@ mod tests {
let unique_local: u16 = 1 << 2;
let global: u16 = 1 << 3;
let unicast_link_local: u16 = 1 << 4;
let unicast_site_local: u16 = 1 << 5;
let unicast_global: u16 = 1 << 6;
let documentation: u16 = 1 << 7;
let multicast_interface_local: u16 = 1 << 8;
let multicast_link_local: u16 = 1 << 9;
let multicast_realm_local: u16 = 1 << 10;
let multicast_admin_local: u16 = 1 << 11;
let multicast_site_local: u16 = 1 << 12;
let multicast_organization_local: u16 = 1 << 13;
let multicast_global: u16 = 1 << 14;
let unicast_link_local_strict: u16 = 1 << 5;
let unicast_site_local: u16 = 1 << 6;
let unicast_global: u16 = 1 << 7;
let documentation: u16 = 1 << 8;
let multicast_interface_local: u16 = 1 << 9;
let multicast_link_local: u16 = 1 << 10;
let multicast_realm_local: u16 = 1 << 11;
let multicast_admin_local: u16 = 1 << 12;
let multicast_site_local: u16 = 1 << 13;
let multicast_organization_local: u16 = 1 << 14;
let multicast_global: u16 = 1 << 15;

check!("::",
&[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
Expand Down Expand Up @@ -2304,10 +2311,32 @@ mod tests {
&[0xfe, 0x80, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
unicast_link_local);

check!("fe80::",
&[0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
unicast_link_local|unicast_link_local_strict);

check!("febf:ffff::",
&[0xfe, 0xbf, 0xff, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
unicast_link_local);

check!("febf::",
&[0xfe, 0xbf, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
unicast_link_local);

check!("febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
&[0xfe, 0xbf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff],
unicast_link_local);

check!("fe80::ffff:ffff:ffff:ffff",
&[0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff],
unicast_link_local|unicast_link_local_strict);

check!("fe80:0:0:1::",
&[0xfe, 0x80, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
unicast_link_local);

check!("fec0::",
&[0xfe, 0xc0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
unicast_site_local|unicast_global|global);
Expand Down