File tree Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -504,7 +504,8 @@ RUN(NAME test_list_section2 LABELS cpython llvm c NOFAST)
504
504
RUN (NAME test_list_count LABELS cpython llvm )
505
505
RUN (NAME test_list_index LABELS cpython llvm )
506
506
RUN (NAME test_list_index2 LABELS cpython llvm )
507
- RUN (NAME test_list_repeat LABELS cpython llvm NOFAST )
507
+ RUN (NAME test_list_repeat LABELS cpython llvm c NOFAST )
508
+ RUN (NAME test_list_repeat2 LABELS cpython llvm c NOFAST )
508
509
RUN (NAME test_list_reverse LABELS cpython llvm )
509
510
RUN (NAME test_list_pop LABELS cpython llvm NOFAST ) # TODO: Remove NOFAST from here.
510
511
RUN (NAME test_list_pop2 LABELS cpython llvm NOFAST ) # TODO: Remove NOFAST from here.
Original file line number Diff line number Diff line change @@ -28,10 +28,14 @@ def test_list_repeat():
28
28
l_str_3 = l_str_1 * i
29
29
assert l_str_3 == l_str_2
30
30
l_str_2 += l_str_1
31
-
31
+
32
32
for i in range (5 ):
33
33
assert l_int_1 * i + l_int_1 * (i + 1 ) == l_int_1 * (2 * i + 1 )
34
34
assert l_tuple_1 * i + l_tuple_1 * (i + 1 ) == l_tuple_1 * (2 * i + 1 )
35
35
assert l_str_1 * i + l_str_1 * (i + 1 ) == l_str_1 * (2 * i + 1 )
36
36
37
- test_list_repeat ()
37
+ print (l_int_1 )
38
+ print (l_tuple_1 )
39
+ print (l_tuple_1 )
40
+
41
+ test_list_repeat ()
Original file line number Diff line number Diff line change
1
+ from lpython import i32 , f32
2
+
3
+ def add_list (x : list [f32 ]) -> f32 :
4
+ sum : f32 = f32 (0.0 )
5
+ i : i32
6
+
7
+ for i in range (len (x )):
8
+ sum = sum + f32 (x [i ])
9
+ return sum
10
+
11
+ def create_list (n : i32 ) -> list [f32 ]:
12
+ x : list [f32 ]
13
+ i : i32
14
+
15
+ x = [f32 (0.0 )] * n
16
+ for i in range (n ):
17
+ x [i ] = f32 (i )
18
+ return x
19
+
20
+ def main0 ():
21
+ x : list [f32 ] = create_list (i32 (10 ))
22
+ print (add_list (x ))
23
+
24
+ main0 ()
You can’t perform that action at this time.
0 commit comments