forked from lcompilers/lpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_list_09.py
More file actions
51 lines (41 loc) · 879 Bytes
/
test_list_09.py
File metadata and controls
51 lines (41 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from lpython import i32
def test_list_concat():
x: list[i32] = []
y: list[i32] = []
z: list[i32] = x + y
i: i32
assert len(z) == 0
x = [1, 2, 3]
z = x + y
for i in range(1, 4):
assert z[i - 1] == i
x.clear()
y = [6, 7, 8]
z = x + y
for i in range(1, 4):
assert z[i - 1] == i + 5
x = [1, 2, 3, 4, 5]
z = x + y
for i in range(1, 9):
assert z[i - 1] == i
x.clear()
y.clear()
for i in range(9, 51):
x.append(i)
for i in range(51, 101):
y.append(i)
z = z + x + y
x[0] = 0
x[1] = 0
y.clear()
for i in range(1, 100):
assert z[i - 1] == i
c: list[str]
d: list[str]
c = ["a", "b"]
d = ["c", "d", "e"]
c += d
assert len(c) == 5
for i in range(5):
assert ord(c[i]) - ord("a") == i
test_list_concat()