Skip to content

Commit 116f344

Browse files
committed
TEST: Add test for unsigned integer bitnot
Test taken from #2054
1 parent 3d77122 commit 116f344

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

integration_tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ RUN(NAME test_max_min LABELS cpython llvm c)
551551
RUN(NAME test_global LABELS cpython llvm c)
552552
RUN(NAME test_global_decl LABELS cpython llvm c)
553553
RUN(NAME test_integer_bitnot LABELS cpython llvm c wasm)
554+
RUN(NAME test_unsign_int_bitnot LABELS cpython llvm c)
554555
RUN(NAME test_ifexp LABELS cpython llvm c)
555556
RUN(NAME test_unary_minus LABELS cpython llvm c)
556557
RUN(NAME test_unary_plus LABELS cpython llvm c)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from lpython import u16
2+
3+
def foo(grp: u16) -> u16:
4+
i: u16 = ~(u16(grp))
5+
6+
return i
7+
8+
9+
def foo2() -> u16:
10+
i: u16 = ~(u16(0xffff))
11+
12+
return i
13+
14+
def foo3() -> u16:
15+
i: u16 = ~(u16(0xffff))
16+
17+
return ~i
18+
19+
assert foo(u16(0)) == u16(0xffff)
20+
assert foo(u16(0xffff)) == u16(0)
21+
assert foo2() == u16(0)
22+
assert foo3() == u16(0xffff)

0 commit comments

Comments
 (0)