Add testcase

pull/1306/head
Josselin Feist 2 years ago
parent 9567b69418
commit f10401593e
  1. BIN
      tests/ast-parsing/compile/ternary-with-max.sol-0.8.15-compact.zip
  2. 5
      tests/ast-parsing/expected/ternary-with-max.sol-0.8.15-compact.json
  3. 7
      tests/ast-parsing/ternary-with-max.sol
  4. 1
      tests/test_ast_parsing.py

@ -0,0 +1,5 @@
{
"TernaryWithMax": {
"f(bool)": "digraph{\n0[label=\"Node Type: ENTRY_POINT 0\n\"];\n0->2;\n2[label=\"Node Type: IF 2\n\"];\n2->3[label=\"True\"];\n2->4[label=\"False\"];\n3[label=\"Node Type: EXPRESSION 3\n\"];\n3->5;\n4[label=\"Node Type: EXPRESSION 4\n\"];\n4->5;\n5[label=\"Node Type: END_IF 5\n\"];\n}\n"
}
}

@ -0,0 +1,7 @@
contract TernaryWithMax {
function f(
bool condition
) external returns(uint256 res) {
res = type(uint256).max / (condition ? 10 : 1) ;
}
}

@ -411,6 +411,7 @@ ALL_TESTS = [
Test("free_functions/libraries_from_free.sol", ["0.8.12"]),
Test("free_functions/new_operator.sol", ["0.8.12"]),
Test("free_functions/library_constant_function_collision.sol", ["0.8.12"]),
Test("ternary-with-max.sol", ["0.8.15"]),
]
# create the output folder if needed
try:

Loading…
Cancel
Save