Skip to content

Commit

Permalink
add new tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tserg committed Feb 16, 2024
1 parent 161b7c7 commit 15caa3f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/functional/codegen/types/numbers/test_decimals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions tests/functional/codegen/types/numbers/test_signed_ints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
11 changes: 11 additions & 0 deletions tests/functional/codegen/types/numbers/test_unsigned_ints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 15caa3f

Please sign in to comment.