From 9b074e32a04977e1a9c7286b4791dfe7d1c0d44c Mon Sep 17 00:00:00 2001 From: lucasxia01 Date: Fri, 12 Jan 2024 21:10:39 +0000 Subject: [PATCH] updated test to include failing case --- .../barretenberg/crypto/poseidon2/poseidon2.test.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.test.cpp b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.test.cpp index 9649f757728..895e07a11f3 100644 --- a/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.test.cpp +++ b/barretenberg/cpp/src/barretenberg/crypto/poseidon2/poseidon2.test.cpp @@ -53,13 +53,16 @@ TEST(Poseidon2, HashBufferConsistencyCheck) // element barretenberg::fr a(std::string("00000b615c4d3e2fa0b1c2d3e4f56789fedcba9876543210abcdef0123456789")); - auto input_vec = to_buffer(a); // takes field element and converts it to 32 bytes + // takes field element and converts it to 32 bytes + auto input_vec = to_buffer(a); + barretenberg::fr result1 = crypto::Poseidon2::hash_buffer(input_vec); input_vec.erase(input_vec.begin()); // erase first byte since we want 31 bytes + barretenberg::fr result2 = crypto::Poseidon2::hash_buffer(input_vec); + std::vector input{ a }; auto expected = crypto::Poseidon2::hash(input); - barretenberg::fr result = crypto::Poseidon2::hash_buffer(input_vec); - - EXPECT_EQ(result, expected); + EXPECT_NE(result1, expected); + EXPECT_EQ(result2, expected); } } // namespace poseidon2_tests \ No newline at end of file