Skip to content

Commit

Permalink
Add an issue test
Browse files Browse the repository at this point in the history
  • Loading branch information
Smit-create committed Jul 27, 2023
1 parent 4cd8b24 commit 1b036e9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ 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 structs_35 LABELS cpython llvm)

RUN(NAME symbolics_01 LABELS cpython_sym c_sym)
RUN(NAME symbolics_02 LABELS cpython_sym c_sym)
Expand Down
34 changes: 34 additions & 0 deletions integration_tests/structs_35.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from lpython import (i8, i32, i64, f32, f64,
dataclass
)
from numpy import (empty,
int8,
)

# test issue 2131

r : i8 = i8(240)

@dataclass
class Foo:
a : i8[4] = empty(4, dtype=int8)
dim : i32 = 4

def trinary_majority(x : Foo, y : Foo, z : Foo) -> Foo:
foo : Foo = Foo()

assert foo.dim == x.dim == y.dim == z.dim

return foo


t1 : Foo = Foo()
t1.a = empty(4, dtype=int8)

t2 : Foo = Foo()
t2.a = empty(4, dtype=int8)

t3 : Foo = Foo()
t3.a = empty(4, dtype=int8)

r1 : Foo = trinary_majority(t1, t2, t3)

0 comments on commit 1b036e9

Please sign in to comment.