cleaned up test: compare as U256, not string

This commit is contained in:
Nicholas Ward 2022-09-19 10:51:13 -07:00
parent 42320d815e
commit cfbc029e7b

View File

@ -22,7 +22,7 @@ fn test_sha2() -> Result<()> {
// Hash the message using a standard Sha256 implementation.
let mut hasher = Sha256::new();
hasher.update(message.clone());
let expected = format!("{:X}", hasher.finalize());
let expected = U256::from(&hasher.finalize()[..]);
// Load the message onto the stack.
let mut initial_stack = vec![U256::from(num_bytes)];
@ -33,8 +33,7 @@ fn test_sha2() -> Result<()> {
// Run the sha2 kernel code.
let result = run(&kernel.code, sha2, initial_stack, &kernel.prover_inputs)?;
let result_hash = result.stack()[0];
let actual = format!("{:X}", result_hash);
let actual = result.stack()[0];
// Check that the result is correct.
assert_eq!(expected, actual);