Skip to content

Commit 2e4057f

Browse files
committed
Add negative index test for descriptor array
1 parent 891d923 commit 2e4057f

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

integration_tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ RUN(NAME array_expr_06 LABELS cpython llvm c)
435435
RUN(NAME array_expr_07 LABELS cpython llvm c)
436436
RUN(NAME array_expr_08 LABELS cpython llvm c)
437437
RUN(NAME array_expr_09 LABELS cpython llvm c)
438+
RUN(NAME array_expr_10 LABELS cpython llvm c)
438439
RUN(NAME array_size_01 LABELS cpython llvm c)
439440
RUN(NAME array_size_02 LABELS cpython llvm c)
440441
RUN(NAME array_01 LABELS cpython llvm wasm c)

integration_tests/array_expr_10.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from lpython import i32
2+
from numpy import empty, int32, array
3+
4+
def foo(x: i32[:]):
5+
print(x[3], x[4], x[-1], x[-2])
6+
assert x[-1] == 5
7+
assert x[-2] == 4
8+
assert x[-3] == 3
9+
assert x[-4] == 2
10+
assert x[-5] == 1
11+
12+
def main():
13+
x: i32[5] = empty(5, dtype=int32)
14+
x = array([1, 2, 3, 4, 5])
15+
foo(x)
16+
17+
main()

0 commit comments

Comments
 (0)