Skip to content

Commit 7cf2135

Browse files
committed
TESTS: For list concat and list section
1 parent b980969 commit 7cf2135

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

integration_tests/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ RUN(NAME test_list_09 LABELS cpython llvm c NOFAST)
500500
RUN(NAME test_list_10 LABELS cpython llvm c NOFAST)
501501
RUN(NAME test_list_11 LABELS cpython llvm c)
502502
RUN(NAME test_list_section LABELS cpython llvm c NOFAST)
503+
RUN(NAME test_list_section2 LABELS cpython llvm c NOFAST)
503504
RUN(NAME test_list_count LABELS cpython llvm)
504505
RUN(NAME test_list_index LABELS cpython llvm)
505506
RUN(NAME test_list_index2 LABELS cpython llvm)
@@ -509,6 +510,7 @@ RUN(NAME test_list_pop LABELS cpython llvm NOFAST) # TODO: Remove NOFAST f
509510
RUN(NAME test_list_pop2 LABELS cpython llvm NOFAST) # TODO: Remove NOFAST from here.
510511
RUN(NAME test_list_pop3 LABELS cpython llvm)
511512
RUN(NAME test_list_compare LABELS cpython llvm)
513+
RUN(NAME test_list_concat LABELS cpython llvm c NOFAST)
512514
RUN(NAME test_tuple_01 LABELS cpython llvm c)
513515
RUN(NAME test_tuple_02 LABELS cpython llvm c NOFAST)
514516
RUN(NAME test_tuple_03 LABELS cpython llvm c)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from lpython import i32, f64
2+
3+
def test_list_concat():
4+
t1: list[i32]
5+
t1 = [2] + [3]
6+
print(t1)
7+
assert len(t1) == 2
8+
assert t1[0] == 2
9+
assert t1[1] == 3
10+
11+
t2: list[f64]
12+
t2 = [3.14, -4.5] + [1.233, -0.012, 5555.50]
13+
print(t2)
14+
assert len(t2) == 5
15+
assert abs(t2[0] - 3.14) <= 1e-5
16+
assert abs(t2[-1] - 5555.50) <= 1e-5
17+
18+
test_list_concat()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from lpython import i32
2+
3+
4+
def test_list_section():
5+
x: list[i32]
6+
x = [5, -6, 7, -1, 2, 10, -8, 15]
7+
8+
n: i32 = len(x[1:4])
9+
print(n)
10+
assert n == 3
11+
12+
test_list_section()

0 commit comments

Comments
 (0)