Skip to content

Instantly share code, notes, and snippets.

@swapnilraj
Last active January 19, 2022 17:57
Show Gist options
  • Save swapnilraj/2ad5644483745e064552272778b842ee to your computer and use it in GitHub Desktop.
Save swapnilraj/2ad5644483745e064552272778b842ee to your computer and use it in GitHub Desktop.
Solidity Semantic Tests
contract C {
function test() public returns (uint256) {
// Note that this only works because computation on literals is done using
// unbounded integers.
if ((2**255 + 2**255) % 7 != addmod(2**255, 2**255, 7)) return 1;
if ((2**255 + 2**255) % 7 != addmod(2**255, 2**255, 7)) return 2;
return 0;
}
}
// ====
// compileToEwasm: also
// compileViaYul: also
// ----
// test() -> 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment