From 690abdf8a89da0694d96e56a527c0171a755ad43 Mon Sep 17 00:00:00 2001 From: Sylvain Pelissier Date: Fri, 15 Mar 2024 15:57:21 +0100 Subject: [PATCH] Use new_personalized function in tests --- sha3/tests/cshake.rs | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/sha3/tests/cshake.rs b/sha3/tests/cshake.rs index 0ba62e2c9..17444b98d 100644 --- a/sha3/tests/cshake.rs +++ b/sha3/tests/cshake.rs @@ -88,7 +88,7 @@ where } macro_rules! new_cshake_test { - ($name:ident, $test_name:expr, $hasher:ty, $hasher_core:ty, $test_func:ident $(,)?) => { + ($name:ident, $test_name:expr, $hasher:ty, $test_func:ident $(,)?) => { #[test] fn $name() { use digest::dev::blobby::Blob3Iterator; @@ -96,9 +96,9 @@ macro_rules! new_cshake_test { for (i, row) in Blob3Iterator::new(data).unwrap().enumerate() { let [customization, input, output] = row.unwrap(); - if let Some(desc) = $test_func(input, output, || { - <$hasher>::from_core(<$hasher_core>::new(customization)) - }) { + if let Some(desc) = + $test_func(input, output, || <$hasher>::new_personalized(customization)) + { panic!( "\n\ Failed test №{}: {}\n\ @@ -117,7 +117,6 @@ new_cshake_test!( cshake128_reset, "cshake128", sha3::CShake128, - sha3::CShake128Core, cshake_reset_test ); #[cfg(feature = "reset")] @@ -125,21 +124,8 @@ new_cshake_test!( cshake256_reset, "cshake256", sha3::CShake256, - sha3::CShake256Core, cshake_reset_test ); -new_cshake_test!( - cshake128, - "cshake128", - sha3::CShake128, - sha3::CShake128Core, - cshake_test -); -new_cshake_test!( - cshake256, - "cshake256", - sha3::CShake256, - sha3::CShake256Core, - cshake_test -); +new_cshake_test!(cshake128, "cshake128", sha3::CShake128, cshake_test); +new_cshake_test!(cshake256, "cshake256", sha3::CShake256, cshake_test);