embark/test_apps/coverage_app/contracts/branches.sol

41 lines
792 B
Solidity
Raw Normal View History

2018-11-19 10:29:02 +00:00
pragma solidity ^0.5.0;
2018-08-21 19:25:18 +00:00
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
}