Unverified Commit 0297f165 authored by Aniket's avatar Aniket Committed by GitHub

Merge pull request #1317 from ethereum/tests_for_1314

tests for #1314
parents 0c428d81 2a90acd7
...@@ -274,7 +274,7 @@ test('Integration test gasCosts.js', function (t) { ...@@ -274,7 +274,7 @@ test('Integration test gasCosts.js', function (t) {
'ERC20.sol': 2, 'ERC20.sol': 2,
'stringBytesLength.sol': 1, 'stringBytesLength.sol': 1,
'etherTransferInLoop.sol': 3, 'etherTransferInLoop.sol': 3,
'forLoopIteratesOverDynamicArray.sol': 1 'forLoopIteratesOverDynamicArray.sol': 2
} }
runModuleOnFiles(module, t, (file, report) => { runModuleOnFiles(module, t, (file, report) => {
...@@ -898,7 +898,7 @@ test('Integration test forLoopIteratesOverDynamicArray.js', function (t) { ...@@ -898,7 +898,7 @@ test('Integration test forLoopIteratesOverDynamicArray.js', function (t) {
'ERC20.sol': 0, 'ERC20.sol': 0,
'stringBytesLength.sol': 0, 'stringBytesLength.sol': 0,
'etherTransferInLoop.sol': 0, 'etherTransferInLoop.sol': 0,
'forLoopIteratesOverDynamicArray.sol': 1 'forLoopIteratesOverDynamicArray.sol': 2
} }
runModuleOnFiles(module, t, (file, report) => { runModuleOnFiles(module, t, (file, report) => {
......
...@@ -274,7 +274,7 @@ test('Integration test gasCosts.js', function (t) { ...@@ -274,7 +274,7 @@ test('Integration test gasCosts.js', function (t) {
'ERC20.sol': 2, 'ERC20.sol': 2,
'stringBytesLength.sol': 1, 'stringBytesLength.sol': 1,
'etherTransferInLoop.sol': 3, 'etherTransferInLoop.sol': 3,
'forLoopIteratesOverDynamicArray.sol': 1 'forLoopIteratesOverDynamicArray.sol': 2
} }
runModuleOnFiles(module, t, (file, report) => { runModuleOnFiles(module, t, (file, report) => {
...@@ -902,7 +902,7 @@ test('Integration test forLoopIteratesOverDynamicArray.js', function (t) { ...@@ -902,7 +902,7 @@ test('Integration test forLoopIteratesOverDynamicArray.js', function (t) {
'ERC20.sol': 0, 'ERC20.sol': 0,
'stringBytesLength.sol': 0, 'stringBytesLength.sol': 0,
'etherTransferInLoop.sol': 0, 'etherTransferInLoop.sol': 0,
'forLoopIteratesOverDynamicArray.sol': 1 'forLoopIteratesOverDynamicArray.sol': 2
} }
runModuleOnFiles(module, t, (file, report) => { runModuleOnFiles(module, t, (file, report) => {
......
...@@ -6,10 +6,16 @@ contract forLoopArr { ...@@ -6,10 +6,16 @@ contract forLoopArr {
} }
function shiftArrItem(uint index) returns(uint[]) { 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++) { for (uint i = index; i < array.length; i++) {
array[i] = array[i+1]; array[i] = array[i+1];
} }
return array; return array;
} }
function shiftArrItem2(uint index) returns(uint[]) {
for (uint i = index; i < array.length - 1; i++) {
array[i] = array[i+1];
}
return array;
}
} }
...@@ -6,10 +6,16 @@ contract forLoopArr { ...@@ -6,10 +6,16 @@ contract forLoopArr {
} }
function shiftArrItem(uint index) public returns(uint[] memory) { 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++) { for (uint i = index; i < array.length; i++) {
array[i] = array[i+1]; array[i] = array[i+1];
} }
return array; 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;
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment