From f10401593ed59581ce9bb739deca2f748c3a273f Mon Sep 17 00:00:00 2001 From: Josselin Feist Date: Wed, 27 Jul 2022 10:57:39 +0200 Subject: [PATCH] Add testcase --- .../ternary-with-max.sol-0.8.15-compact.zip | Bin 0 -> 2612 bytes .../ternary-with-max.sol-0.8.15-compact.json | 5 +++++ tests/ast-parsing/ternary-with-max.sol | 7 +++++++ tests/test_ast_parsing.py | 1 + 4 files changed, 13 insertions(+) create mode 100644 tests/ast-parsing/compile/ternary-with-max.sol-0.8.15-compact.zip create mode 100644 tests/ast-parsing/expected/ternary-with-max.sol-0.8.15-compact.json create mode 100644 tests/ast-parsing/ternary-with-max.sol 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 0000000000000000000000000000000000000000..dc4cb99da1f939843c014819229ad1c2bd154b3e GIT binary patch literal 2612 zcma);`9Bj51IK6Xgpey?!sI^Y%3KLKCSz&NA*Ernm}9weA0=PPeUxLBAy?-7y1tCX z+((og$yKQw%QZZGpWmO?>-l^>uh;vR&mZuHTQjp50e}D=K*7zUn@67VL$>(#)liB+=Uc>AK6ZcgeUeF3?<*=+lAD3z7{V6)>x;xS)Na3n_D1s|uCD{!5F_fp>K1}a}MyBj^RND(Z zM4Ho*rt5QW3uUN&US}t%r$yHs`kSjRJ5T*`LjaFvea8NRf#DNNM>D)RIZ{pPRfjE$ zl82vg8oA9N?))p8gsHSbpl}XAu#;$SrPO2P2x`JC`Yh$NzK7YJ-B*CGzWBZzx&VZ3 z$bDgX6ySb?ul5J}WN{)?Z8o((vR-I^eec-#pLMA-2-jfnr>q{rgD$-e0rgLOY9jQQ z9WuFGh1o@%jP5I@$mUz(ywnV)3)_XGeSn@S8AMZE+x!6ahO!zaNQ5=PG~hP z2c0fW?ZhiOC!)OO4a(vfW7oW>1r@?YvkX^$oy;~H5O9k`+iy5op#L)-lbNIBvC=)}HbMmx=_taHS&2$nw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Z(QXG*h)p(o|*2Yx@uB!hDGB8m1PN)Q=9r7t}9r0e~1o@TP?H(>UBSF*ox1O346c zX+GD8lM3HQ%b%~tMsBQdH~z%Z#|L$^t;sXtBe_-XS{*wwk2+r}3@P1Q z2+q>)GLT$H3;BHNCjyP)5=Ha}>_-fZ;7ac-4iE6O&&2+}>@kz+$m0OIF&B(@`sR}N ztk}LJ{_~6$Q*uOV?@EI1q5X?X9GR0iP`dXye*8RYQcQzYapa9lFS8{BJzT{1JBb-h zCla}H%DdbYPd_B^HL=2f48Hbn_4a(Se2+HLR*hi@&4-Yr9C%>0nxh1lVCaNq#@-O0 z6w=nHl@_y5>Yqd}ay?IubT~a>Ln*+mnSe&j|J&sL$lQMu&Gaw+U$28(v$FmBXZq7y Me@Ok~h5*2S05p5*od5s; literal 0 HcmV?d00001 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: