solidity/test/libsolidity/semanticTests/viaYul/cleanup/comparison.sol
2020-05-05 13:38:31 +02:00

42 lines
859 B
Solidity

contract C {
function eq() public pure returns (bool) {
uint8 x = 1; uint8 y;
assembly { y := 0x0101 }
return (x == y);
}
function neq() public pure returns (bool) {
uint8 x = 1; uint8 y;
assembly { y := 0x0101 }
return (x != y);
}
function geq() public pure returns (bool) {
uint8 x = 1; uint8 y;
assembly { y := 0x0101 }
return (x >= y);
}
function leq() public pure returns (bool) {
uint8 x = 2; uint8 y;
assembly { y := 0x0101 }
return (x <= y);
}
function gt() public pure returns (bool) {
uint8 x = 2; uint8 y;
assembly { y := 0x0101 }
return (x > y);
}
function lt() public pure returns (bool) {
uint8 x = 1; uint8 y;
assembly { y := 0x0101 }
return (x < y);
}
}
// ====
// compileViaYul: also
// ----
// eq() -> true
// neq() -> false
// geq() -> true
// leq() -> false
// gt() -> true
// lt() -> false