1#include <gmock/gmock.h>
2#include <gtest/gtest.h>
13using ::testing::ElementsAre;
18class PureKeccakSimulationTest :
public ::testing::Test {
24TEST_F(PureKeccakSimulationTest, MatchesReferenceImplementation)
27 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
44 output[i] = val.as<uint64_t>();
48 EXPECT_THAT(input, testing::ElementsAreArray(output));
52TEST_F(PureKeccakSimulationTest, OfficialTestVectorEmptyInput)
66 output[i] = val.as<uint64_t>();
70 ElementsAre(0xF1258F7940E1DDE7,
97TEST_F(PureKeccakSimulationTest, OfficialTestVector)
100 0xF1258F7940E1DDE7, 0x84D5CCF933C0478A, 0xD598261EA65AA9EE, 0xBD1547306F80494D, 0x8B284E056253D057,
101 0xFF97A42D7F8E6FD4, 0x90FEE5A0A44647C4, 0x8C5BDA0CD6192E76, 0xAD30A6F71B19059C, 0x30935AB7D08FFC64,
102 0xEB5AA93F2317D635, 0xA9A6E6260D712103, 0x81A57C16DBCF555F, 0x43B831CD0347C826, 0x01F22F1A11A5569F,
103 0x05E5635A21D9AE61, 0x64BEFEF28CC970F2, 0x613670957BC46611, 0xB87C5A554FD00ECB, 0x8C3EE88A1CCF32C8,
104 0x940C7922AE3A2614, 0x1841F924A2C509E4, 0x16F53526E70465C2, 0x75F644E97F30A13B, 0xEAF1FF7B5CECA249,
117 output[i] = val.as<uint64_t>();
171 0x20D06CD26A8FBF5C));
174TEST_F(PureKeccakSimulationTest, TagError)
192 format(
"Read slice tag invalid - addr: ", src_addr_wrong_tag,
" tag: ",
static_cast<uint32_t
>(wrong_tag)));
195TEST_F(PureKeccakSimulationTest, SrcSliceOutOfBounds)
203TEST_F(PureKeccakSimulationTest, DstSliceOutOfBounds)
#define EXPECT_THROW_WITH_MESSAGE(code, expectedMessageRegex)
#define AVM_KECCAKF1600_STATE_SIZE
#define AVM_HIGHEST_MEM_ADDRESS
static TaggedValue from_tag_truncating(ValueTag tag, FF value)
void permutation(MemoryInterface &memory, MemoryAddress dst_addr, MemoryAddress src_addr) override
Permutation Keccak-f[1600] consisting in AVM_KECCAKF1600_NUM_ROUNDS (24) rounds and a state of 25 64-...
void set(MemoryAddress index, MemoryValue value) override
const MemoryValue & get(MemoryAddress index) const override
std::string format(Args... args)
void ethash_keccakf1600(uint64_t state[KECCAKF1600_LANES]) NOEXCEPT
TEST_F(IPATest, ChallengesAreZero)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept