Skip to content

Commit e15eed4

Browse files
committed
Add tests
1 parent cb74382 commit e15eed4

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

integration_tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ RUN(NAME array_size_01 LABELS cpython llvm c)
284284
RUN(NAME array_size_02 LABELS cpython llvm c)
285285
RUN(NAME array_01 LABELS cpython llvm wasm c)
286286
RUN(NAME array_02 LABELS cpython wasm c)
287+
RUN(NAME array_03 LABELS cpython llvm)
287288
RUN(NAME bindc_01 LABELS cpython llvm c)
288289
RUN(NAME bindc_02 LABELS cpython llvm c)
289290
RUN(NAME bindc_04 LABELS llvm c)

integration_tests/array_03.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from lpython import Allocatable, f64, i32
2+
from numpy import empty, float64, int32
3+
4+
def f():
5+
n: i32 = 5
6+
a: Allocatable[f64[:]] = empty((n,), dtype=float64)
7+
i: i32
8+
for i in range(n):
9+
a[i] = f64(i+1)
10+
b: Allocatable[i32[:]]
11+
n = 10
12+
b = empty((n,), dtype=int32)
13+
for i in range(n):
14+
b[i] = i+1
15+
print(a)
16+
for i in range(n):
17+
assert b[i] == i+1
18+
19+
f()

0 commit comments

Comments
 (0)