From 15caa3fd182a496b09ff45e1f31b9b815abb8a0e Mon Sep 17 00:00:00 2001 From: tserg <8017125+tserg@users.noreply.github.com> Date: Fri, 16 Feb 2024 21:38:01 +0800 Subject: [PATCH] add new tests --- .../functional/codegen/types/numbers/test_decimals.py | 2 +- .../codegen/types/numbers/test_signed_ints.py | 11 +++++++++++ .../codegen/types/numbers/test_unsigned_ints.py | 11 +++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/tests/functional/codegen/types/numbers/test_decimals.py b/tests/functional/codegen/types/numbers/test_decimals.py index 1418eab063..80e78e40dd 100644 --- a/tests/functional/codegen/types/numbers/test_decimals.py +++ b/tests/functional/codegen/types/numbers/test_decimals.py @@ -23,7 +23,7 @@ def test_decimal_override(): ) -@pytest.mark.parametrize("op", ["**", "&", "|", "^"]) +@pytest.mark.parametrize("op", ["//", "**", "&", "|", "^"]) def test_invalid_ops(get_contract, assert_compile_failed, op): code = f""" @external diff --git a/tests/functional/codegen/types/numbers/test_signed_ints.py b/tests/functional/codegen/types/numbers/test_signed_ints.py index 3f1fb937ff..63d11fd53f 100644 --- a/tests/functional/codegen/types/numbers/test_signed_ints.py +++ b/tests/functional/codegen/types/numbers/test_signed_ints.py @@ -391,6 +391,17 @@ def foo(a: {typ}) -> {typ}: assert_tx_failed(lambda: c.foo(lo)) +@pytest.mark.parametrize("typ", types) +@pytest.mark.parametrize("op", ["/"]) +def test_invalid_ops(get_contract, assert_compile_failed, typ, op): + code = f""" +@external +def foo(x: {typ}, y: {typ}) -> {typ}: + return x {op} y + """ + assert_compile_failed(lambda: get_contract(code), InvalidOperation) + + @pytest.mark.parametrize("typ", types) @pytest.mark.parametrize("op", ["not"]) def test_invalid_unary_ops(get_contract, assert_compile_failed, typ, op): diff --git a/tests/functional/codegen/types/numbers/test_unsigned_ints.py b/tests/functional/codegen/types/numbers/test_unsigned_ints.py index ec2b988ed8..945eb7a3f3 100644 --- a/tests/functional/codegen/types/numbers/test_unsigned_ints.py +++ b/tests/functional/codegen/types/numbers/test_unsigned_ints.py @@ -216,6 +216,17 @@ def test() -> {typ}: assert_compile_failed(lambda: get_contract(code_template.format(typ=typ, val=val))) +@pytest.mark.parametrize("typ", types) +@pytest.mark.parametrize("op", ["/"]) +def test_invalid_ops(get_contract, assert_compile_failed, typ, op): + code = f""" +@external +def foo(x: {typ}, y: {typ}) -> {typ}: + return x {op} y + """ + assert_compile_failed(lambda: get_contract(code), InvalidOperation) + + @pytest.mark.parametrize("typ", types) @pytest.mark.parametrize("op", ["not", "-"]) def test_invalid_unary_ops(get_contract, assert_compile_failed, typ, op):