diff --git a/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.js b/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.js index 5ea2adcb23..284f9423f3 100644 --- a/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.js +++ b/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.js @@ -274,7 +274,7 @@ test('Integration test gasCosts.js', function (t) { 'ERC20.sol': 2, 'stringBytesLength.sol': 1, 'etherTransferInLoop.sol': 3, - 'forLoopIteratesOverDynamicArray.sol': 1 + 'forLoopIteratesOverDynamicArray.sol': 2 } runModuleOnFiles(module, t, (file, report) => { @@ -898,7 +898,7 @@ test('Integration test forLoopIteratesOverDynamicArray.js', function (t) { 'ERC20.sol': 0, 'stringBytesLength.sol': 0, 'etherTransferInLoop.sol': 0, - 'forLoopIteratesOverDynamicArray.sol': 1 + 'forLoopIteratesOverDynamicArray.sol': 2 } runModuleOnFiles(module, t, (file, report) => { diff --git a/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.js b/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.js index 4edf0a2df7..b132dae606 100644 --- a/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.js +++ b/remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.js @@ -274,7 +274,7 @@ test('Integration test gasCosts.js', function (t) { 'ERC20.sol': 2, 'stringBytesLength.sol': 1, 'etherTransferInLoop.sol': 3, - 'forLoopIteratesOverDynamicArray.sol': 1 + 'forLoopIteratesOverDynamicArray.sol': 2 } runModuleOnFiles(module, t, (file, report) => { @@ -902,7 +902,7 @@ test('Integration test forLoopIteratesOverDynamicArray.js', function (t) { 'ERC20.sol': 0, 'stringBytesLength.sol': 0, 'etherTransferInLoop.sol': 0, - 'forLoopIteratesOverDynamicArray.sol': 1 + 'forLoopIteratesOverDynamicArray.sol': 2 } runModuleOnFiles(module, t, (file, report) => { diff --git a/remix-analyzer/test/analysis/test-contracts/solidity-v0.4.24/forLoopIteratesOverDynamicArray.sol b/remix-analyzer/test/analysis/test-contracts/solidity-v0.4.24/forLoopIteratesOverDynamicArray.sol index c8d57c5e2d..53ed913958 100644 --- a/remix-analyzer/test/analysis/test-contracts/solidity-v0.4.24/forLoopIteratesOverDynamicArray.sol +++ b/remix-analyzer/test/analysis/test-contracts/solidity-v0.4.24/forLoopIteratesOverDynamicArray.sol @@ -6,10 +6,16 @@ contract forLoopArr { } function shiftArrItem(uint index) returns(uint[]) { - // TODO: for (uint i = index; i < array.length-1; i++) should also generate warning for (uint i = index; i < array.length; i++) { array[i] = array[i+1]; } return array; } + + function shiftArrItem2(uint index) returns(uint[]) { + for (uint i = index; i < array.length - 1; i++) { + array[i] = array[i+1]; + } + return array; + } } diff --git a/remix-analyzer/test/analysis/test-contracts/solidity-v0.5/forLoopIteratesOverDynamicArray.sol b/remix-analyzer/test/analysis/test-contracts/solidity-v0.5/forLoopIteratesOverDynamicArray.sol index 48aeebd296..65b8130d2e 100644 --- a/remix-analyzer/test/analysis/test-contracts/solidity-v0.5/forLoopIteratesOverDynamicArray.sol +++ b/remix-analyzer/test/analysis/test-contracts/solidity-v0.5/forLoopIteratesOverDynamicArray.sol @@ -6,10 +6,16 @@ contract forLoopArr { } function shiftArrItem(uint index) public returns(uint[] memory) { - // TODO: for (uint i = index; i < array.length-1; i++) should also generate warning for (uint i = index; i < array.length; i++) { array[i] = array[i+1]; } return array; } + + function shiftArrItem2(uint index) public returns(uint[] memory) { + for (uint i = index; i < array.length - 1; i++) { + array[i] = array[i+1]; + } + return array; + } }