More robust testing

including ArrayType vars and user-defined contract types
pull/1802/head
webthethird 2 years ago
parent 36e1ac1e01
commit 380301b08d
  1. 13
      tests/code_generation/CodeGeneration.sol
  2. 5
      tests/code_generation/TEST_generated_code.sol
  3. 5
      tests/code_generation/TEST_generated_code_not_unrolled.sol

@ -8,7 +8,9 @@ contract TestContract is I {
uint public stateA;
uint private stateB;
address public immutable owner = msg.sender;
mapping(address => mapping(uint => St)) public structs;
mapping(address => mapping(uint => St)) public structsMap;
St[] public structsArray;
I public otherI;
event NoParams();
event Anonymous() anonymous;
@ -44,13 +46,16 @@ contract TestContract is I {
function newSt(uint x) public returns (St memory) {
St memory st;
st.v = x;
structs[msg.sender][x] = st;
structsMap[msg.sender][x] = st;
return st;
}
function getSt(uint x) public view returns (St memory) {
return structs[msg.sender][x];
return structsMap[msg.sender][x];
}
function removeSt(St memory st) public {
delete structs[msg.sender][st.v];
delete structsMap[msg.sender][st.v];
}
function setOtherI(I _i) public {
otherI = _i;
}
}

@ -13,12 +13,15 @@ interface ITestContract {
}
function stateA() external returns (uint256);
function owner() external returns (address);
function structs(address,uint256) external returns (uint256);
function structsMap(address,uint256) external returns (uint256);
function structsArray(uint256) external returns (uint256);
function otherI() external returns (address);
function err0() external;
function err1() external;
function err2(uint256,uint256) external;
function newSt(uint256) external returns (uint256);
function getSt(uint256) external view returns (uint256);
function removeSt(uint256) external;
function setOtherI(address) external;
}

@ -13,12 +13,15 @@ interface ITestContract {
}
function stateA() external returns (uint256);
function owner() external returns (address);
function structs(address,uint256) external returns (uint256);
function structsMap(address,uint256) external returns (St memory);
function structsArray(uint256) external returns (St memory);
function otherI() external returns (address);
function err0() external;
function err1() external;
function err2(uint256,uint256) external;
function newSt(uint256) external returns (St memory);
function getSt(uint256) external view returns (St memory);
function removeSt(St memory) external;
function setOtherI(address) external;
}

Loading…
Cancel
Save