Merge pull request 'Add tests for hash inversion' (#185) from feat/murmur-tests into master
All checks were successful
build/msvc Build for the target platform: msvc
build/linux Build for the target platform: linux

Reviewed-on: https://git.sclu1034.dev///bitsquid_dt/dtmt/pulls/185
This commit is contained in:
Lucas Schwiderski 2024-08-14 12:07:31 +00:00
commit d7fa80f471
Signed by: Forgejo (git.sclu1034.dev)
GPG key ID: B1C9C29730D3D366

View file

@ -119,4 +119,9 @@ fn test_hash() {
}
#[test]
fn test_inverse() {}
fn test_inverse() {
let h = hash("lua".as_bytes(), crate::murmur::SEED as u64);
let inv = hash_inverse(h, crate::murmur::SEED as u64);
assert_eq!(h, hash(&inv.to_le_bytes(), crate::murmur::SEED as u64));
assert_ne!(h, hash(&inv.to_be_bytes(), crate::murmur::SEED as u64));
}