From c66f07ec291acaf601af030f5d222ae7f7e99ef2 Mon Sep 17 00:00:00 2001 From: LouisTsai Date: Wed, 10 Jan 2024 18:15:12 +0800 Subject: [PATCH] test: add storage slot invariant test --- lendmixer/test/library/slot.t.sol | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lendmixer/test/library/slot.t.sol b/lendmixer/test/library/slot.t.sol index c31bc64..38c300c 100644 --- a/lendmixer/test/library/slot.t.sol +++ b/lendmixer/test/library/slot.t.sol @@ -33,6 +33,16 @@ contract SlotTest is Test { assertEq(value2, address(0x02)); assertEq(value3, address(0x03)); } + + function testFuzzGetAddressSlot(address key, address value) public { + storageLayout.addValue(key, value); + + bytes32 slot = keccak256(abi.encode(key, 0)); + + address slotValue = storageLayout.getValue(slot); + + assertEq(slotValue, value); + } } contract StorageLayout {