embark-area-51/test_apps/coverage_app/contracts/branches.sol

41 lines
793 B
Solidity
Raw Permalink Normal View History

2018-08-21 19:25:18 +00:00
pragma solidity ^0.4.23;
contract Branches {
uint public lastComparison;
uint public storedData;
constructor(uint initialValue) public {
storedData = initialValue;
}
function bigger(uint x) public returns (uint biggest) {
lastComparison = x;
if(x > storedData) {
storedData = x;
return x;
} else {
return storedData;
}
}
function smaller(uint x) public returns (uint smallest) {
lastComparison = x;
if(x < storedData) {
return x;
} else {
return storedData;
}
}
function get() public view returns (uint retVal) {
return storedData;
}
function smallFunctionWithoutStatements() public view returns (uint retVal) {
if(false) return storedData * 10;
if(true) return storedData * 20;
}
2018-08-21 19:25:18 +00:00
}