Skip to content

Commit

Permalink
Fix farm::hash32 test case
Browse files Browse the repository at this point in the history
  • Loading branch information
flier committed Dec 26, 2016
1 parent bd63796 commit e11f99c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions fasthash/src/farm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,17 +324,21 @@ mod tests {

#[test]
fn test_farmhash32() {
assert_eq!(FarmHash32::hash(b"hello"), 3111026382);
assert_eq!(FarmHash32::hash_with_seed(b"hello", 123), 1449662659);
assert_eq!(FarmHash32::hash(b"helloworld"), 3283552592);
let h1 = FarmHash32::hash(b"hello");
let h2 = FarmHash32::hash_with_seed(b"hello", 123);
let h3 = FarmHash32::hash(b"helloworld");

assert!(h1 != 0);
assert!(h2 != 0);
assert!(h3 != 0);

let mut h = FarmHasher32::new();

h.write(b"hello");
assert_eq!(h.finish(), 3111026382);
assert_eq!(h.finish(), h1 as u64);

h.write(b"world");
assert_eq!(h.finish(), 3283552592);
assert_eq!(h.finish(), h3 as u64);
}

#[test]
Expand Down

0 comments on commit e11f99c

Please sign in to comment.