use `hash.to_byte_array` to check equality with `test.output`

Tests in 'hashes' used various ways to do this that looked different but
did the same.
This commit is contained in:
Antoni Spaanderman 2024-08-26 13:49:22 +02:00
parent 969864e3b0
commit 55749d6f61
No known key found for this signature in database
GPG Key ID: AE0B68E552E5DF8C
8 changed files with 8 additions and 8 deletions

View File

@ -98,7 +98,7 @@ mod tests {
}
let manual_hash = Hash::from_engine(engine);
assert_eq!(hash, manual_hash);
assert_eq!(hash.to_byte_array()[..].as_ref(), test.output.as_slice());
assert_eq!(hash.to_byte_array(), test.output);
}
}

View File

@ -489,7 +489,7 @@ mod tests {
}
let manual_hash = ripemd160::Hash::from_engine(engine);
assert_eq!(hash, manual_hash);
assert_eq!(hash.as_byte_array(), test.output.as_slice());
assert_eq!(hash.to_byte_array(), test.output);
}
}

View File

@ -193,7 +193,7 @@ mod tests {
}
let manual_hash = sha1::Hash::from_engine(engine);
assert_eq!(hash, manual_hash);
assert_eq!(hash.as_byte_array(), test.output.as_slice());
assert_eq!(hash.to_byte_array(), test.output);
}
}

View File

@ -926,7 +926,7 @@ mod tests {
}
let manual_hash = sha256::Hash::from_engine(engine);
assert_eq!(hash, manual_hash);
assert_eq!(hash.to_byte_array()[..].as_ref(), test.output.as_slice());
assert_eq!(hash.to_byte_array(), test.output);
}
}

View File

@ -92,7 +92,7 @@ mod tests {
let sha2d_hash = sha2_hash.hash_again();
assert_eq!(hash, sha2d_hash);
assert_eq!(hash.to_byte_array()[..].as_ref(), test.output.as_slice());
assert_eq!(hash.to_byte_array(), test.output);
}
}

View File

@ -133,7 +133,7 @@ mod tests {
}
let manual_hash = sha384::Hash::from_engine(engine);
assert_eq!(hash, manual_hash);
assert_eq!(hash.to_byte_array()[..].as_ref(), test.output.as_slice());
assert_eq!(hash.to_byte_array(), test.output);
}
}
}

View File

@ -380,7 +380,7 @@ mod tests {
}
let manual_hash = sha512::Hash::from_engine(engine);
assert_eq!(hash, manual_hash);
assert_eq!(hash.to_byte_array()[..].as_ref(), test.output.as_slice());
assert_eq!(hash.to_byte_array(), test.output);
}
}

View File

@ -133,7 +133,7 @@ mod tests {
}
let manual_hash = sha512_256::Hash::from_engine(engine);
assert_eq!(hash, manual_hash);
assert_eq!(hash.to_byte_array()[..].as_ref(), test.output.as_slice());
assert_eq!(hash.to_byte_array(), test.output);
}
}
}