From d16d88f715dbbf080c21b46f784256f53dea742f Mon Sep 17 00:00:00 2001 From: palinatolmach Date: Wed, 28 Aug 2024 17:30:20 +0300 Subject: [PATCH] Add `NestedStructs` test --- .../integration/test-data/foundry-prove-all | 1 + .../test-data/foundry-prove-skip-legacy | 1 + .../foundry/test/NestedStructs.t.sol | 34 +++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 src/tests/integration/test-data/foundry/test/NestedStructs.t.sol diff --git a/src/tests/integration/test-data/foundry-prove-all b/src/tests/integration/test-data/foundry-prove-all index acaeae372..a7807eba4 100644 --- a/src/tests/integration/test-data/foundry-prove-all +++ b/src/tests/integration/test-data/foundry-prove-all @@ -186,6 +186,7 @@ MockCallRevertTest.testMockCallEmptyAccount() MockFunctionTest.test_mock_function() MockFunctionTest.test_mock_function_all_args() MockFunctionTest.test_mock_function_concrete_args() +NestedStructsTest.prove_fourfold_nested_struct(((((uint8,uint256),bytes32)[],bytes32))) OwnerUpOnlyTest.testFailIncrementAsNotOwner() OwnerUpOnlyTest.testIncrementAsNotOwner() OwnerUpOnlyTest.testIncrementAsOwner() diff --git a/src/tests/integration/test-data/foundry-prove-skip-legacy b/src/tests/integration/test-data/foundry-prove-skip-legacy index 4096951c6..f161401aa 100644 --- a/src/tests/integration/test-data/foundry-prove-skip-legacy +++ b/src/tests/integration/test-data/foundry-prove-skip-legacy @@ -183,6 +183,7 @@ MockCallRevertTest.testMockCallEmptyAccount() MockFunctionTest.test_mock_function() MockFunctionTest.test_mock_function_all_args() MockFunctionTest.test_mock_function_concrete_args() +NestedStructsTest.prove_fourfold_nested_struct(((((uint8,uint256),bytes32)[],bytes32))) OwnerUpOnlyTest.testFailIncrementAsNotOwner() OwnerUpOnlyTest.testIncrementAsNotOwner() OwnerUpOnlyTest.testIncrementAsOwner() diff --git a/src/tests/integration/test-data/foundry/test/NestedStructs.t.sol b/src/tests/integration/test-data/foundry/test/NestedStructs.t.sol new file mode 100644 index 000000000..4835492d6 --- /dev/null +++ b/src/tests/integration/test-data/foundry/test/NestedStructs.t.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: UNLICENSED +pragma solidity =0.8.13; + +import "forge-std/Test.sol"; + +contract NestedStructsTest is Test { + struct Processor { + Window windows; + } + + struct Window { + Frame[] frames; + bytes32 hash; + } + + struct Frame { + Pointer position; + bytes32 root; + } + + struct Pointer { + PointerType pointerType; + uint256 value; + } + + enum PointerType { + INT32, + INT64 + } + + function prove_fourfold_nested_struct(Processor calldata initialProcessor) external pure { + assert(initialProcessor.windows.frames.length == 2); + } +}