Skip to content

Commit bc0b647

Browse files
committed
Add tests for list compare
1 parent e54a2fc commit bc0b647

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

integration_tests/test_pass_compare.py

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from ltypes import i32
22

3+
34
def f():
45
a11: tuple[i32, i32]
56
b11: tuple[i32, i32]
@@ -18,4 +19,43 @@ def f():
1819
assert a != b
1920

2021

21-
f()
22+
def g():
23+
a11: list[i32]
24+
b11: list[i32]
25+
a11 = [1, 2, 3, 4]
26+
b11 = [1, 2, 3, 4]
27+
assert a11 == b11
28+
a11.append(5)
29+
assert a11 != b11
30+
c11: list[i32] = []
31+
assert a11 != c11
32+
33+
d11: list[str] = ['a', 'b', '^', '*']
34+
e11: list[str] = ['a', 'b', '^']
35+
assert d11 != e11
36+
e11.append('*')
37+
assert d11 == e11
38+
39+
f11: list[tuple[i32, i32]]
40+
x: tuple[i32, i32]
41+
i: i32
42+
for i in range(10):
43+
x = (i, i+2)
44+
f11.append(x)
45+
46+
g11: list[tuple[i32, i32]]
47+
for i in range(9):
48+
x = (i, i+2)
49+
g11.append(x)
50+
assert g11 != f11
51+
x = (9, 11)
52+
g11.append(x)
53+
assert g11 == f11
54+
55+
56+
def check():
57+
f()
58+
g()
59+
60+
61+
check()

0 commit comments

Comments
 (0)