diff --git a/tests/ast-parsing/compile/ternary-with-max.sol-0.8.15-compact.zip b/tests/ast-parsing/compile/ternary-with-max.sol-0.8.15-compact.zip new file mode 100644 index 000000000..dc4cb99da Binary files /dev/null and b/tests/ast-parsing/compile/ternary-with-max.sol-0.8.15-compact.zip differ diff --git a/tests/ast-parsing/expected/ternary-with-max.sol-0.8.15-compact.json b/tests/ast-parsing/expected/ternary-with-max.sol-0.8.15-compact.json new file mode 100644 index 000000000..755f83c9e --- /dev/null +++ b/tests/ast-parsing/expected/ternary-with-max.sol-0.8.15-compact.json @@ -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" + } +} \ No newline at end of file diff --git a/tests/ast-parsing/ternary-with-max.sol b/tests/ast-parsing/ternary-with-max.sol new file mode 100644 index 000000000..6eadf3cfd --- /dev/null +++ b/tests/ast-parsing/ternary-with-max.sol @@ -0,0 +1,7 @@ +contract TernaryWithMax { + function f( + bool condition + ) external returns(uint256 res) { + res = type(uint256).max / (condition ? 10 : 1) ; + } +} diff --git a/tests/test_ast_parsing.py b/tests/test_ast_parsing.py index ed83e2b20..15be1dd76 100644 --- a/tests/test_ast_parsing.py +++ b/tests/test_ast_parsing.py @@ -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: