update tests

pull/2099/head
alpharush 1 year ago
parent 9c4bc505d3
commit 9df54e9c3a
  1. 38
      tests/e2e/vyper_parsing/snapshots/ast_parsing__vyper_cfgir_builtins_c__0.txt
  2. 9
      tests/e2e/vyper_parsing/snapshots/ast_parsing__vyper_cfgir_builtins_test_builtins__0.txt
  3. 28
      tests/e2e/vyper_parsing/snapshots/ast_parsing__vyper_cfgir_default_args_a__0.txt
  4. 24
      tests/e2e/vyper_parsing/snapshots/ast_parsing__vyper_cfgir_default_args_b__0.txt
  5. 9
      tests/e2e/vyper_parsing/snapshots/ast_parsing__vyper_cfgir_interface_constant_slitherConstructorConstantVariables__0.txt
  6. 57
      tests/e2e/vyper_parsing/snapshots/ast_parsing__vyper_cfgir_interface_conversion_bar__0.txt
  7. 12
      tests/e2e/vyper_parsing/snapshots/ast_parsing__vyper_cfgir_interface_conversion_foo__0.txt
  8. 28
      tests/e2e/vyper_parsing/snapshots/ast_parsing__vyper_cfgir_tuple_struct___default__0.txt
  9. 9
      tests/e2e/vyper_parsing/snapshots/ast_parsing__vyper_cfgir_types_slitherConstructorConstantVariables__0.txt
  10. 13
      tests/e2e/vyper_parsing/test_data/ERC20.vy
  11. 21
      tests/e2e/vyper_parsing/test_data/builtins.vy
  12. 4
      tests/e2e/vyper_parsing/test_data/chain.vy
  13. 12
      tests/e2e/vyper_parsing/test_data/default_args.vy
  14. 3
      tests/e2e/vyper_parsing/test_data/for.vy
  15. 17
      tests/e2e/vyper_parsing/test_data/for_break_continue.vy
  16. 4
      tests/e2e/vyper_parsing/test_data/initarry.vy
  17. 0
      tests/e2e/vyper_parsing/test_data/interface_constant.vy
  18. 2
      tests/e2e/vyper_parsing/test_data/interface_conversion.vy
  19. 10
      tests/e2e/vyper_parsing/test_data/tuple_struct.vy
  20. 4
      tests/e2e/vyper_parsing/test_data/types.vy

@ -0,0 +1,38 @@
digraph{
0[label="Node Type: ENTRY_POINT 0
"];
0->1;
1[label="Node Type: NEW VARIABLE 1
EXPRESSION:
user_shares = ()
IRs:
user_shares(uint256[10]) = []"];
1->2;
2[label="Node Type: EXPRESSION 2
EXPRESSION:
user_shares.append(1)
IRs:
REF_1 -> LENGTH user_shares
TMP_3(uint256) := REF_1(uint256)
TMP_4(uint256) = TMP_3 (c)+ 1
REF_1(uint256) (->user_shares) := TMP_4(uint256)
REF_2(uint256) -> user_shares[TMP_3]
REF_2(uint256) (->user_shares) := 1(uint256)"];
2->3;
3[label="Node Type: EXPRESSION 3
EXPRESSION:
user_shares.pop()
IRs:
REF_4 -> LENGTH user_shares
TMP_6(uint256) = REF_4 (c)- 1
REF_5(uint256) -> user_shares[TMP_6]
REF_5 = delete REF_5
REF_6 -> LENGTH user_shares
REF_6(uint256) (->user_shares) := TMP_6(uint256)"];
}

@ -53,10 +53,11 @@ f(uint256) := block.timestamp(uint256)"];
7[label="Node Type: NEW VARIABLE 7
EXPRESSION:
h = chain.id
h = bytes32(chain.id)
IRs:
h(uint256) := chain.id(uint256)"];
TMP_0 = CONVERT chain.id to bytes32
h(bytes32) := TMP_0(bytes32)"];
7->8;
8[label="Node Type: NEW VARIABLE 8
@ -64,8 +65,8 @@ EXPRESSION:
i = slice()(msg.data,0,32)
IRs:
TMP_0(None) = SOLIDITY_CALL slice()(msg.data,0,32)
i(bytes[32]) = ['TMP_0(None)']"];
TMP_1(None) = SOLIDITY_CALL slice()(msg.data,0,32)
i(bytes[32]) = ['TMP_1(None)']"];
8->9;
9[label="Node Type: NEW VARIABLE 9

@ -0,0 +1,28 @@
digraph{
0[label="Node Type: ENTRY_POINT 0
"];
0->1;
1[label="Node Type: EXPRESSION 1
EXPRESSION:
self.b(x,True)
IRs:
INTERNAL_CALL, default_args.b()(x,True)"];
1->2;
2[label="Node Type: EXPRESSION 2
EXPRESSION:
self.b(1,self.config)
IRs:
INTERNAL_CALL, default_args.b()(1,config)"];
2->3;
3[label="Node Type: EXPRESSION 3
EXPRESSION:
self.b(1,z)
IRs:
INTERNAL_CALL, default_args.b()(1,z)"];
}

@ -0,0 +1,24 @@
digraph{
0[label="Node Type: ENTRY_POINT 0
"];
0->1;
1[label="Node Type: IF 1
EXPRESSION:
config
IRs:
CONDITION config"];
1->3[label="True"];
1->2[label="False"];
2[label="Node Type: END_IF 2
"];
3[label="Node Type: EXPRESSION 3
EXPRESSION:
self.counter = y
IRs:
counter(uint256) := y(uint256)"];
3->2;
}

@ -0,0 +1,9 @@
digraph{
0[label="Node Type: OTHER_ENTRYPOINT 0
EXPRESSION:
MAX_TICKS_UINT = 50
IRs:
MAX_TICKS_UINT(uint256) := 50(uint256)"];
}

@ -0,0 +1,57 @@
digraph{
0[label="Node Type: ENTRY_POINT 0
"];
0->1;
1[label="Node Type: NEW VARIABLE 1
EXPRESSION:
a = 0
IRs:
a(int128) := 0(uint256)"];
1->2;
2[label="Node Type: NEW VARIABLE 2
EXPRESSION:
b = 0
IRs:
b(int128) := 0(uint256)"];
2->3;
3[label="Node Type: EXPRESSION 3
EXPRESSION:
(a,b) = self.foo()
IRs:
TUPLE_0(int128,int128) = INTERNAL_CALL, interface_conversion.foo()()
a(int128)= UNPACK TUPLE_0 index: 0
b(int128)= UNPACK TUPLE_0 index: 1 "];
3->4;
4[label="Node Type: NEW VARIABLE 4
EXPRESSION:
x = 0x0000000000000000000000000000000000000000
IRs:
x(address) := 0(address)"];
4->5;
5[label="Node Type: NEW VARIABLE 5
EXPRESSION:
c = 0
IRs:
c(uint256) := 0(uint256)"];
5->6;
6[label="Node Type: EXPRESSION 6
EXPRESSION:
(a,c) = Test(x).foo()
IRs:
TMP_0 = CONVERT x to Test
TUPLE_1(int128,uint256) = HIGH_LEVEL_CALL, dest:TMP_0(Test), function:foo, arguments:[]
a(int128)= UNPACK TUPLE_1 index: 0
c(uint256)= UNPACK TUPLE_1 index: 1 "];
}

@ -0,0 +1,12 @@
digraph{
0[label="Node Type: ENTRY_POINT 0
"];
0->1;
1[label="Node Type: RETURN 1
EXPRESSION:
(2,3)
IRs:
RETURN 2,3"];
}

@ -0,0 +1,28 @@
digraph{
0[label="Node Type: ENTRY_POINT 0
"];
0->1;
1[label="Node Type: NEW VARIABLE 1
EXPRESSION:
chainlink_lrd = Test(msg.sender).get()
IRs:
TMP_0 = CONVERT msg.sender to Test
TUPLE_0(uint80,int256,uint256,uint256,uint80) = HIGH_LEVEL_CALL, dest:TMP_0(Test), function:get, arguments:[]
TMP_1(uint80)= UNPACK TUPLE_0 index: 0
TMP_2(int256)= UNPACK TUPLE_0 index: 1
TMP_3(uint256)= UNPACK TUPLE_0 index: 2
TMP_4(uint256)= UNPACK TUPLE_0 index: 3
TMP_5(uint80)= UNPACK TUPLE_0 index: 4
chainlink_lrd(FAKE_TUPLE_0_1_2_3_4) = new FAKE_TUPLE_0_1_2_3_4(TMP_1,TMP_2,TMP_3,TMP_4,TMP_5)"];
1->2;
2[label="Node Type: RETURN 2
EXPRESSION:
chainlink_lrd[0]
IRs:
REF_1(uint80) -> chainlink_lrd._0
RETURN REF_1"];
}

@ -0,0 +1,9 @@
digraph{
0[label="Node Type: OTHER_ENTRYPOINT 0
EXPRESSION:
MAX_BANDS = 10
IRs:
MAX_BANDS(uint256) := 10(uint256)"];
}

@ -1,22 +1,9 @@
interface ERC20:
def totalSupply() -> uint256: view
def balanceOf(_owner: address) -> uint256: view
def allowance(_owner: address, _spender: address) -> uint256: view
def transfer(_to: address, _value: uint256) -> bool: nonpayable
def transferFrom(_from: address, _to: address, _value: uint256) -> bool: nonpayable
def approve(_spender: address, _value: uint256) -> bool: nonpayable

@ -3,29 +3,22 @@
@external
def test_builtins():
a: address = block.coinbase
b: uint256 = block.difficulty
c: uint256 = block.prevrandao
d: uint256 = block.number
e: bytes32 = block.prevhash
f: uint256 = block.timestamp
h: uint256 = chain.id
h: bytes32 = convert(chain.id, bytes32)
i: Bytes[32] = slice(msg.data, 0, 32)
j: uint256 = msg.gas
k: address = msg.sender
l: uint256 = msg.value
m: address = tx.origin
n: uint256 = tx.gasprice
x: uint256 = self.balance
@external
def c(x: uint256):
user_shares: DynArray[uint256, 10] = []
user_shares.append(1)
user_shares.pop()

@ -1,4 +0,0 @@
@external
def test():
x: bytes32 = convert(chain.id, bytes32)

@ -0,0 +1,12 @@
counter: uint256
config: bool
@internal
def b(y: uint256, config: bool = True):
if config:
self.counter = y
@external
def a(x: uint256, z: bool):
self.b(x)
self.b(1, self.config)
self.b(1, z)

@ -16,9 +16,6 @@ interface IStrategy:
def convertToShares(assets: uint256) -> uint256: view
def previewWithdraw(assets: uint256) -> uint256: view
struct X:
y: int8

@ -0,0 +1,17 @@
@external
def f():
for i in range(100):
if (i > 100):
break
if (i < 3):
continue
x: uint256 = 10
for j in range(10):
if (j > 10):
continue
if (j < 3):
break
x -= 1

@ -3,8 +3,8 @@ interface ERC20:
def transferFrom(_from: address, _to: address, _value: uint256) -> bool: nonpayable
def approve(_spender: address, _value: uint256) -> bool: nonpayable
BORROWED_TOKEN: immutable(ERC20) # x
COLLATERAL_TOKEN: immutable(ERC20) # x
BORROWED_TOKEN: immutable(ERC20)
COLLATERAL_TOKEN: immutable(ERC20)
@external
def __init__(x: address, y: address):

@ -0,0 +1,10 @@
interface Test:
def get() -> (uint80, int256, uint256, uint256, uint80): view
@external
def __default__() -> uint80:
chainlink_lrd: (uint80, int256, uint256, uint256, uint80) = Test(msg.sender).get()
return chainlink_lrd[0]

@ -3,13 +3,9 @@ symbol: public(String[32])
decimals: public(uint256)
totalSupply: public(uint256)
balances: HashMap[address, uint256]
allowances: HashMap[address, HashMap[address, uint256]]
MAX_BANDS: constant(uint256) = 10
x: public(uint256[3][4])
Loading…
Cancel
Save