Skip to content

Commit 847bc40

Browse files
committed
Add a test
1 parent 7a569b3 commit 847bc40

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

integration_tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ RUN(NAME expr_19 LABELS cpython llvm c)
494494
RUN(NAME expr_20 LABELS cpython llvm c)
495495
RUN(NAME expr_21 LABELS cpython llvm c)
496496
RUN(NAME expr_22 LABELS cpython llvm c)
497+
RUN(NAME expr_23 LABELS cpython llvm c)
497498

498499
RUN(NAME expr_01u LABELS cpython llvm c NOFAST)
499500
RUN(NAME expr_02u LABELS cpython llvm c NOFAST)

integration_tests/expr_23.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from lpython import f32, i32
2+
3+
def flip_sign_check():
4+
x: f32
5+
eps: f32 = f32(1e-5)
6+
7+
number: i32 = 123
8+
x = f32(5.5)
9+
10+
if (number%2 == 1):
11+
x = -x
12+
13+
assert abs(x - f32(-5.5)) < eps
14+
15+
number = 124
16+
x = f32(5.5)
17+
18+
if (number%2 == 1):
19+
x = -x
20+
21+
assert abs(x - f32(5.5)) < eps
22+
23+
flip_sign_check()

0 commit comments

Comments
 (0)