Skip to content

Commit 26017ad

Browse files
committed
TEST: Add integration_test for In, Out, InOut
1 parent 6b27a70 commit 26017ad

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

integration_tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ RUN(NAME test_str_comparison LABELS cpython llvm c)
506506
RUN(NAME test_bit_length LABELS cpython llvm c)
507507
RUN(NAME str_to_list_cast LABELS cpython llvm c)
508508
RUN(NAME test_sys_01 LABELS cpython llvm c)
509+
RUN(NAME intent_01 LABELS cpython llvm)
509510

510511

511512
RUN(NAME test_package_01 LABELS cpython llvm)

integration_tests/intent_01.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from lpython import i32, u32, f64, dataclass, In, Out, InOut
2+
3+
@dataclass
4+
class Foo:
5+
p: i32
6+
7+
def f(x: i32, y: In[f64], z: InOut[list[u32]], w: Out[Foo]):
8+
assert (x == -12)
9+
assert abs(y - (4.44)) <= 1e-12
10+
z.append(u32(5))
11+
w.p = 24
12+
13+
14+
def main0():
15+
a: i32 = (-12)
16+
b: f64 = 4.44
17+
c: list[u32] = [u32(1), u32(2), u32(3), u32(4)]
18+
d: Foo = Foo(25)
19+
20+
print(a, b, c, d.p)
21+
22+
f(a, b, c, d)
23+
assert c[-1] == u32(5)
24+
assert d.p == 24
25+
26+
main0()

0 commit comments

Comments
 (0)