Skip to content

Commit

Permalink
Add NestedStructs test
Browse files Browse the repository at this point in the history
  • Loading branch information
palinatolmach committed Aug 28, 2024
1 parent 46184c9 commit d16d88f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/tests/integration/test-data/foundry-prove-all
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions src/tests/integration/test-data/foundry-prove-skip-legacy
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
34 changes: 34 additions & 0 deletions src/tests/integration/test-data/foundry/test/NestedStructs.t.sol
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit d16d88f

Please sign in to comment.