mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
New tests.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
contract C {
|
||||
function div(uint256 a, uint256 b) public returns (uint256) {
|
||||
// Does not disable div by zero check
|
||||
unchecked {
|
||||
return a / b;
|
||||
}
|
||||
}
|
||||
|
||||
function mod(uint256 a, uint256 b) public returns (uint256) {
|
||||
// Does not disable div by zero check
|
||||
unchecked {
|
||||
return a % b;
|
||||
}
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// div(uint256,uint256): 7, 2 -> 3
|
||||
// div(uint256,uint256): 7, 0 -> FAILURE # throws #
|
||||
// mod(uint256,uint256): 7, 2 -> 1
|
||||
// mod(uint256,uint256): 7, 0 -> FAILURE # throws #
|
||||
Reference in New Issue
Block a user