fn string_hash_key() {
        let hello1 = Object::String(String::from("Hello World"));
        let hello2 = Object::String(String::from("Hello World"));
        let diff1 = Object::String(String::from("my name is johnny"));
        let diff2 = Object::String(String::from("my name is johnny"));

        let mut hasher1 = DefaultHasher::new();
        hello1.hash(&mut hasher1);
        let mut hasher2 = DefaultHasher::new();
        hello2.hash(&mut hasher2);
        assert_eq!(hasher1.finish(), hasher2.finish());

        let mut hasher1 = DefaultHasher::new();
        diff1.hash(&mut hasher1);
        let mut hasher2 = DefaultHasher::new();
        diff2.hash(&mut hasher2);
        assert_eq!(hasher1.finish(), hasher2.finish());

        let mut hasher1 = DefaultHasher::new();
        hello1.hash(&mut hasher1);
        let mut hasher2 = DefaultHasher::new();
        diff1.hash(&mut hasher2);
        assert_ne!(hasher1.finish(), hasher2.finish());
    }
// this test is unnecessary, but here for completeness with the Monkey book.
this test is unnecessary, but here for completeness with the Monkey book.
this test is unnecessary but here for completeness with the Monkey book .
fn string_hash_key() {
        let hello1 = Object::String(String::from("Hello World"));
        let hello2 = Object::String(String::from("Hello World"));
        let diff1 = Object::String(String::from("my name is johnny"));
        let diff2 = Object::String(String::from("my name is johnny"));
        let mut hasher1 = DefaultHasher::new();
        hello1.hash(&mut hasher1);
        let mut hasher2 = DefaultHasher::new();
        hello2.hash(&mut hasher2);
        assert_eq!(hasher1.finish(), hasher2.finish());
        let mut hasher1 = DefaultHasher::new();
        diff1.hash(&mut hasher1);
        let mut hasher2 = DefaultHasher::new();
        diff2.hash(&mut hasher2);
        assert_eq!(hasher1.finish(), hasher2.finish());
        let mut hasher1 = DefaultHasher::new();
        hello1.hash(&mut hasher1);
        let mut hasher2 = DefaultHasher::new();
        diff1.hash(&mut hasher2);
        assert_ne!(hasher1.finish(), hasher2.finish());
    }
fn string_hash_key ( ) { let hello1 = Object :: String ( String :: from ( " " ) ) ; let hello2 = Object :: String ( String :: from ( " " ) ) ; let diff1 = Object :: String ( String :: from ( " " ) ) ; let diff2 = Object :: String ( String :: from ( " " ) ) ; let mut hasher1 = DefaultHasher :: new ( ) ; hello1 . hash ( & mut hasher1 ) ; let mut hasher2 = DefaultHasher :: new ( ) ; hello2 . hash ( & mut hasher2 ) ; assert_eq ! ( hasher1 finish ( ) hasher2 finish ( ) ) ; let mut hasher1 = DefaultHasher :: new ( ) ; diff1 . hash ( & mut hasher1 ) ; let mut hasher2 = DefaultHasher :: new ( ) ; diff2 . hash ( & mut hasher2 ) ; assert_eq ! ( hasher1 finish ( ) hasher2 finish ( ) ) ; let mut hasher1 = DefaultHasher :: new ( ) ; hello1 . hash ( & mut hasher1 ) ; let mut hasher2 = DefaultHasher :: new ( ) ; diff1 . hash ( & mut hasher2 ) ; assert_ne ! ( hasher1 finish ( ) hasher2 finish ( ) ) ; }
this test is unnecessary, but here for completeness with the Monkey book.
this test is unnecessary but here for completeness with the Monkey book .