From 336fa63355ec67be04794445779d9587f3df33d9 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Tue, 18 Jul 2023 15:30:44 +0530 Subject: [PATCH] TEST: Add test for inner struct pass to func --- integration_tests/CMakeLists.txt | 1 + integration_tests/structs_34.py | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 integration_tests/structs_34.py diff --git a/integration_tests/CMakeLists.txt b/integration_tests/CMakeLists.txt index b854115b4bc..3812fb82e7f 100644 --- a/integration_tests/CMakeLists.txt +++ b/integration_tests/CMakeLists.txt @@ -615,6 +615,7 @@ RUN(NAME structs_30 LABELS cpython llvm c) RUN(NAME structs_31 LABELS cpython llvm c) RUN(NAME structs_32 LABELS cpython llvm c) RUN(NAME structs_33 LABELS cpython llvm c) +RUN(NAME structs_34 LABELS cpython llvm c) RUN(NAME symbolics_01 LABELS cpython_sym c_sym) RUN(NAME symbolics_02 LABELS cpython_sym c_sym) diff --git a/integration_tests/structs_34.py b/integration_tests/structs_34.py new file mode 100644 index 00000000000..f69d6d5f6a0 --- /dev/null +++ b/integration_tests/structs_34.py @@ -0,0 +1,24 @@ +from lpython import packed, dataclass, ccallable, i32, ccallback + +@ccallable +@packed +@dataclass +class struct_0: + val_0 : i32 = 613 + +@ccallable +@packed +@dataclass +class struct_1: + val_1 : struct_0 = struct_0() + +def print_val_0_in_struct_0(struct_0_instance : struct_0) -> i32: + print(struct_0_instance.val_0) + return 0 + +@ccallback +def entry_point() -> i32: + struct_1_instance : struct_1 = struct_1() + return print_val_0_in_struct_0(struct_1_instance.val_1) + +assert entry_point() == 0