From 58a9e8e2b6da177813eed59d933f740116d4f7cb Mon Sep 17 00:00:00 2001 From: Marc Planard Date: Wed, 23 Nov 2022 14:31:44 +0100 Subject: [PATCH] tunes and tests --- src/ip.rs | 4 ++-- src/main.rs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ip.rs b/src/ip.rs index 332b5b7..83cb3aa 100644 --- a/src/ip.rs +++ b/src/ip.rs @@ -107,6 +107,6 @@ fn test_u32_from_ip() { #[test] fn test_ip_from_u32() { - let ip = Ip::from(0x7f000001); - assert_eq!(ip, Ip::V4([127, 0, 0, 1])); + assert_eq!(Ip::from(0x7f000001), Ip::V4([127, 0, 0, 1])); + assert_eq!(Ip::from(0x1020304), Ip::V4([1, 2, 3, 4])); } diff --git a/src/main.rs b/src/main.rs index d75ab05..5f9e05e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,7 +17,7 @@ fn main() { println!("Canonical: {}", ip); println!("Debug....: {:?}", ip); - println!("Binary...: {:b}", nbr); + println!("Binary...: {:032b}", nbr); println!("Hexa.....: 0x{:x}", nbr); let comment = match ip { @@ -27,4 +27,5 @@ fn main() { _ => "Nothing special to say about this address" }; println!("{}", comment); + }