tunes and tests

This commit is contained in:
Marc Planard 2022-11-23 14:31:44 +01:00
parent 22d77a92e5
commit 58a9e8e2b6
2 changed files with 4 additions and 3 deletions

View File

@ -107,6 +107,6 @@ fn test_u32_from_ip() {
#[test] #[test]
fn test_ip_from_u32() { fn test_ip_from_u32() {
let ip = Ip::from(0x7f000001); assert_eq!(Ip::from(0x7f000001), Ip::V4([127, 0, 0, 1]));
assert_eq!(ip, Ip::V4([127, 0, 0, 1])); assert_eq!(Ip::from(0x1020304), Ip::V4([1, 2, 3, 4]));
} }

View File

@ -17,7 +17,7 @@ fn main() {
println!("Canonical: {}", ip); println!("Canonical: {}", ip);
println!("Debug....: {:?}", ip); println!("Debug....: {:?}", ip);
println!("Binary...: {:b}", nbr); println!("Binary...: {:032b}", nbr);
println!("Hexa.....: 0x{:x}", nbr); println!("Hexa.....: 0x{:x}", nbr);
let comment = match ip { let comment = match ip {
@ -27,4 +27,5 @@ fn main() {
_ => "Nothing special to say about this address" _ => "Nothing special to say about this address"
}; };
println!("{}", comment); println!("{}", comment);
} }