blob: b0c3c70ff59a51305378e8acba3f8ea1202f22b5 [file] [log] [blame] [edit]
[case testNewSet]
from typing import Set
def f() -> Set[int]:
return {1, 2, 3}
[out]
def f():
r0, r1, r2 :: short_int
r3 :: set
r4 :: object
r5 :: bool
r6 :: object
r7 :: bool
r8 :: object
r9 :: bool
L0:
r0 = 1
r1 = 2
r2 = 3
r3 = set
r4 = box(short_int, r0)
r5 = r3.add(r4) :: set
r6 = box(short_int, r1)
r7 = r3.add(r6) :: set
r8 = box(short_int, r2)
r9 = r3.add(r8) :: set
return r3
[case testNewEmptySet]
from typing import Set
def f() -> Set[int]:
return set()
[out]
def f():
r0 :: set
L0:
r0 = set
return r0
[case testNewSetFromIterable]
from typing import Set, List
def f(l: List[T]) -> Set[T]:
return set(l)
[out]
def f(l):
l :: list
r0 :: set
L0:
r0 = set l :: object
return r0
[case testSetSize]
from typing import Set
def f() -> int:
return len({1, 2, 3})
[out]
def f():
r0, r1, r2 :: short_int
r3 :: set
r4 :: object
r5 :: bool
r6 :: object
r7 :: bool
r8 :: object
r9 :: bool
r10 :: int
L0:
r0 = 1
r1 = 2
r2 = 3
r3 = set
r4 = box(short_int, r0)
r5 = r3.add(r4) :: set
r6 = box(short_int, r1)
r7 = r3.add(r6) :: set
r8 = box(short_int, r2)
r9 = r3.add(r8) :: set
r10 = len r3 :: set
return r10
[case testSetContains]
from typing import Set
def f() -> bool:
x = {3, 4}
return (5 in x)
[out]
def f():
r0, r1 :: short_int
r2 :: set
r3 :: object
r4 :: bool
r5 :: object
r6 :: bool
x :: set
r7 :: short_int
r8 :: object
r9 :: bool
L0:
r0 = 3
r1 = 4
r2 = set
r3 = box(short_int, r0)
r4 = r2.add(r3) :: set
r5 = box(short_int, r1)
r6 = r2.add(r5) :: set
x = r2
r7 = 5
r8 = box(short_int, r7)
r9 = r8 in x :: set
return r9
[case testSetRemove]
from typing import Set
def f() -> Set[int]:
x = set() # type: Set[int]
x.remove(1)
return x
[out]
def f():
r0, x :: set
r1 :: short_int
r2 :: object
r3 :: bool
r4 :: None
L0:
r0 = set
x = r0
r1 = 1
r2 = box(short_int, r1)
r3 = x.remove(r2) :: set
r4 = None
return x
[case testSetDiscard]
from typing import Set
def f() -> Set[int]:
x = set() # type: Set[int]
x.discard(1)
return x
[out]
def f():
r0, x :: set
r1 :: short_int
r2 :: object
r3 :: bool
r4 :: None
L0:
r0 = set
x = r0
r1 = 1
r2 = box(short_int, r1)
r3 = x.discard(r2) :: set
r4 = None
return x
[case testSetAdd]
from typing import Set
def f() -> Set[int]:
x = set() # type: Set[int]
x.add(1)
return x
[out]
def f():
r0, x :: set
r1 :: short_int
r2 :: object
r3 :: bool
r4 :: None
L0:
r0 = set
x = r0
r1 = 1
r2 = box(short_int, r1)
r3 = x.add(r2) :: set
r4 = None
return x
[case testSetClear]
from typing import Set
def f() -> Set[int]:
x = set() # type: Set[int]
x.clear()
return x
[out]
def f():
r0, x :: set
r1 :: bool
r2 :: None
L0:
r0 = set
x = r0
r1 = x.clear() :: set
r2 = None
return x
[case testSetPop]
from typing import Set
def f(s : Set[int]) -> int:
return s.pop()
[out]
def f(s):
s :: set
r0 :: object
r1 :: int
L0:
r0 = s.pop() :: set
r1 = unbox(int, r0)
return r1
[case testSetUpdate]
from typing import Set, List
def update(s: Set[int], x: List[int]) -> None:
s.update(x)
[out]
def update(s, x):
s :: set
x :: list
r0 :: bool
r1, r2 :: None
L0:
r0 = s.update(x) :: set
r1 = None
r2 = None
return r2
[case testSetDisplay]
from typing import Set
def f(x: Set[int], y: Set[int]) -> Set[int]:
return {1, 2, *x, *y, 3}
[out]
def f(x, y):
x, y :: set
r0, r1, r2 :: short_int
r3 :: set
r4 :: object
r5 :: bool
r6 :: object
r7, r8, r9 :: bool
r10 :: object
r11 :: bool
L0:
r0 = 1
r1 = 2
r2 = 3
r3 = set
r4 = box(short_int, r0)
r5 = r3.add(r4) :: set
r6 = box(short_int, r1)
r7 = r3.add(r6) :: set
r8 = r3.update(x) :: set
r9 = r3.update(y) :: set
r10 = box(short_int, r2)
r11 = r3.add(r10) :: set
return r3