Skip to content

Commit

Permalink
Add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Smit-create committed Aug 26, 2023
1 parent 7a569b3 commit 847bc40
Show file tree
Hide file tree
Showing 2 changed files with 24 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 @@ -494,6 +494,7 @@ RUN(NAME expr_19 LABELS cpython llvm c)
RUN(NAME expr_20 LABELS cpython llvm c)
RUN(NAME expr_21 LABELS cpython llvm c)
RUN(NAME expr_22 LABELS cpython llvm c)
RUN(NAME expr_23 LABELS cpython llvm c)

RUN(NAME expr_01u LABELS cpython llvm c NOFAST)
RUN(NAME expr_02u LABELS cpython llvm c NOFAST)
Expand Down
23 changes: 23 additions & 0 deletions integration_tests/expr_23.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from lpython import f32, i32

def flip_sign_check():
x: f32
eps: f32 = f32(1e-5)

number: i32 = 123
x = f32(5.5)

if (number%2 == 1):
x = -x

assert abs(x - f32(-5.5)) < eps

number = 124
x = f32(5.5)

if (number%2 == 1):
x = -x

assert abs(x - f32(5.5)) < eps

flip_sign_check()

0 comments on commit 847bc40

Please sign in to comment.