Skip to content

Commit a5eda0c

Browse files
Add CPython test and register in CMakeLists
1 parent 3c5909d commit a5eda0c

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ inst/bin/*
8989
*_ldd.txt
9090
*_lines.dat.txt
9191
*__tmp__generated__.c
92+
a.c
93+
a.h
94+
a.py
9295

9396
### https://raw.github.com/github/gitignore/218a941be92679ce67d0484547e3e142b2f5f6f0/Global/macOS.gitignore
9497

integration_tests/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,3 +534,6 @@ RUN(NAME callback_01 LABELS cpython llvm)
534534
RUN(NAME intrinsics_01 LABELS cpython llvm) # any
535535

536536
COMPILE(NAME import_order_01 LABELS cpython llvm c) # any
537+
538+
# Jit
539+
RUN(NAME test_jit_01 LABELS cpython)

integration_tests/test_jit_01.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from numpy import array
2+
from lpython import i32, f64, jit
3+
4+
@jit
5+
def fast_sum(n: i32, x: f64[:]) -> f64:
6+
s: f64 = 0.0
7+
i: i32
8+
for i in range(n):
9+
s += x[i]
10+
return s
11+
12+
def test():
13+
x: f64[3] = array([1.0, 2.0, 3.0])
14+
assert fast_sum(3, x) == 6.0
15+
16+
test()

0 commit comments

Comments
 (0)