From 81d1bfb07cc3a68028275cbbb3bb1ca5ced5f66f Mon Sep 17 00:00:00 2001 From: tserg <8017125+tserg@users.noreply.github.com> Date: Wed, 27 Dec 2023 12:31:23 +0800 Subject: [PATCH] improve tests --- tests/functional/syntax/test_abs.py | 4 ++++ tests/functional/syntax/test_as_wei_value.py | 4 ++++ tests/functional/syntax/test_ceil.py | 1 + tests/functional/syntax/test_floor.py | 1 + tests/functional/syntax/test_len.py | 1 + tests/functional/syntax/test_minmax.py | 8 ++++++++ tests/functional/syntax/test_minmax_value.py | 4 ++++ tests/functional/syntax/test_powmod.py | 4 ++++ tests/functional/syntax/test_uint2str.py | 4 ++++ 9 files changed, 31 insertions(+) diff --git a/tests/functional/syntax/test_abs.py b/tests/functional/syntax/test_abs.py index cb231a33b1..28ac8bc769 100644 --- a/tests/functional/syntax/test_abs.py +++ b/tests/functional/syntax/test_abs.py @@ -26,6 +26,10 @@ def test_abs_fail(assert_compile_failed, get_contract_with_gas_estimation, bad_c """ FOO: constant(int256) = -3 BAR: constant(int256) = abs(FOO) + +@external +def foo(): + a: int256 = BAR """ ] diff --git a/tests/functional/syntax/test_as_wei_value.py b/tests/functional/syntax/test_as_wei_value.py index dc72c55242..6ec01a3214 100644 --- a/tests/functional/syntax/test_as_wei_value.py +++ b/tests/functional/syntax/test_as_wei_value.py @@ -114,6 +114,10 @@ def foo() -> uint256: """ y: constant(String[5]) = "szabo" x: constant(uint256) = as_wei_value(5, y) + +@external +def foo(): + a: uint256 = x """, ] diff --git a/tests/functional/syntax/test_ceil.py b/tests/functional/syntax/test_ceil.py index 53608ebea4..f9a4f3bbe2 100644 --- a/tests/functional/syntax/test_ceil.py +++ b/tests/functional/syntax/test_ceil.py @@ -6,6 +6,7 @@ """ BAR: constant(decimal) = 2.5 FOO: constant(int256) = ceil(BAR) + @external def foo(): a: int256 = FOO diff --git a/tests/functional/syntax/test_floor.py b/tests/functional/syntax/test_floor.py index 7b7f960a86..6f3abf1dd0 100644 --- a/tests/functional/syntax/test_floor.py +++ b/tests/functional/syntax/test_floor.py @@ -6,6 +6,7 @@ """ BAR: constant(decimal) = 2.5 FOO: constant(int256) = floor(BAR) + @external def foo(): a: int256 = FOO diff --git a/tests/functional/syntax/test_len.py b/tests/functional/syntax/test_len.py index 6867ceda63..449e89fe56 100644 --- a/tests/functional/syntax/test_len.py +++ b/tests/functional/syntax/test_len.py @@ -42,6 +42,7 @@ def foo(inp: String[10]) -> uint256: """ BAR: constant(String[5]) = "vyper" FOO: constant(uint256) = len(BAR) + @external def foo() -> uint256: a: uint256 = FOO diff --git a/tests/functional/syntax/test_minmax.py b/tests/functional/syntax/test_minmax.py index 6565974f19..c1129f7251 100644 --- a/tests/functional/syntax/test_minmax.py +++ b/tests/functional/syntax/test_minmax.py @@ -41,11 +41,19 @@ def test_block_fail(assert_compile_failed, get_contract_with_gas_estimation, bad FOO: constant(uint256) = 123 BAR: constant(uint256) = 456 BAZ: constant(uint256) = min(FOO, BAR) + +@external +def foo(): + a: uint256 = BAZ """, """ FOO: constant(uint256) = 123 BAR: constant(uint256) = 456 BAZ: constant(uint256) = max(FOO, BAR) + +@external +def foo(): + a: uint256 = BAZ """, ] diff --git a/tests/functional/syntax/test_minmax_value.py b/tests/functional/syntax/test_minmax_value.py index 14b61e2f0a..4249d8419b 100644 --- a/tests/functional/syntax/test_minmax_value.py +++ b/tests/functional/syntax/test_minmax_value.py @@ -15,6 +15,10 @@ def foo(): """, """ FOO: constant(address) = min_value(address) + +@external +def foo(): + a: address = FOO """, ] diff --git a/tests/functional/syntax/test_powmod.py b/tests/functional/syntax/test_powmod.py index fce692a74a..a86039ca4a 100644 --- a/tests/functional/syntax/test_powmod.py +++ b/tests/functional/syntax/test_powmod.py @@ -25,6 +25,10 @@ def test_powmod_fail(assert_compile_failed, get_contract_with_gas_estimation, ba FOO: constant(uint256) = 3 BAR: constant(uint256) = 5 BAZ: constant(uint256) = pow_mod256(FOO, BAR) + +@external +def foo(): + a: uint256 = BAZ """ ] diff --git a/tests/functional/syntax/test_uint2str.py b/tests/functional/syntax/test_uint2str.py index 392b7b952b..90e929421c 100644 --- a/tests/functional/syntax/test_uint2str.py +++ b/tests/functional/syntax/test_uint2str.py @@ -6,6 +6,10 @@ """ FOO: constant(uint256) = 3 BAR: constant(String[78]) = uint2str(FOO) + +@external +def foo(): + a: String[78] = BAR """ ]