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 5ea2adcb2..284f9423f 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 4edf0a2df..b132dae60 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 c8d57c5e2..53ed91395 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 48aeebd29..65b8130d2 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; + } }