mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-12 18:47:30 +00:00
Tests for nested dynamic array.
This commit is contained in:
@@ -5,6 +5,8 @@ pragma solidity ^0.7.6;
|
||||
pragma abicoder v2;
|
||||
|
||||
contract TestNestedArrays {
|
||||
address[4][3] nestedAddressArray;
|
||||
|
||||
struct TestStruct {
|
||||
uint256 uint1;
|
||||
address address1;
|
||||
@@ -12,8 +14,34 @@ contract TestNestedArrays {
|
||||
|
||||
TestStruct[3][5] nestedStructArray;
|
||||
|
||||
int128[3][] nestedFixedDynamicArray;
|
||||
|
||||
uint32[][4] nestedDynamicFixedArray;
|
||||
|
||||
int64[][] nestedDynamicArray;
|
||||
|
||||
// Set variable nestedStructArray.
|
||||
function setNestedStructArray(uint index, uint nestedIndex, TestStruct calldata value) external {
|
||||
nestedStructArray[index][nestedIndex] = value;
|
||||
}
|
||||
|
||||
// Set variable nestedAddressArray.
|
||||
function setNestedAddressArray(address[4][3] calldata value) external {
|
||||
nestedAddressArray = value;
|
||||
}
|
||||
|
||||
// Set variable nestedFixedDynamicArray.
|
||||
function setNestedFixedDynamicArray(int128[3][] calldata value) external {
|
||||
nestedFixedDynamicArray = value;
|
||||
}
|
||||
|
||||
// Set variable nestedDynamicFixedArray.
|
||||
function setNestedDynamicFixedArray(uint32[][4] memory value) external {
|
||||
nestedDynamicFixedArray = value;
|
||||
}
|
||||
|
||||
// Set variable nestedDynamicArray.
|
||||
function setNestedDynamicArray(int64[][] memory value) external {
|
||||
nestedDynamicArray = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,13 @@ contract TestReferenceStructs {
|
||||
|
||||
StringStruct stringStruct;
|
||||
|
||||
struct DynamicArrayStruct {
|
||||
address address1;
|
||||
uint160[] uintArray;
|
||||
}
|
||||
|
||||
DynamicArrayStruct dynamicArrayStruct;
|
||||
|
||||
struct ValueMappingStruct {
|
||||
mapping(uint => address) uintAddressMap;
|
||||
uint32 uint1;
|
||||
@@ -88,4 +95,9 @@ contract TestReferenceStructs {
|
||||
function setNestedStruct(NestedStruct calldata value) external {
|
||||
nestedStruct = value;
|
||||
}
|
||||
|
||||
// Set variable dynamicArrayStruct.
|
||||
function setDynamicArrayStruct(DynamicArrayStruct calldata value) external {
|
||||
dynamicArrayStruct = value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user