solidity/test/libsolidity/smtCheckerTests/loops/while_loop_array_assignment_memory_storage.sol

24 lines
467 B
Solidity
Raw Normal View History

pragma experimental SMTChecker;
contract LoopFor2 {
uint[] a;
function testUnboundedForLoop(uint n, uint[] memory b, uint[] memory c) public {
b[0] = 900;
a = b;
require(n > 0 && n < 100);
uint i;
while (i < n) {
b[i] = i + 1;
c[i] = b[i];
++i;
}
assert(b[0] == c[0]);
assert(a[0] == 900);
assert(b[0] == 900);
}
}
// ----
// Warning: (274-294): Assertion violation happens here
// Warning: (321-340): Assertion violation happens here