Skip to content

Commit f62503d

Browse files
committed
tests/micropython: Add test for consts that are bignums.
1 parent 74f4d2c commit f62503d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

tests/micropython/const_intbig.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# test constant optimisation, with consts that are bignums
2+
3+
from micropython import const
4+
5+
# check we can make consts from bignums
6+
Z1 = const(0xffffffff)
7+
Z2 = const(0xffffffffffffffff)
8+
print(hex(Z1), hex(Z2))
9+
10+
# check arithmetic with bignum
11+
Z3 = const(Z1 + Z2)
12+
Z4 = const((1 << 100) + Z1)
13+
print(hex(Z3), hex(Z4))
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
0xffffffff 0xffffffffffffffff
2+
0x100000000fffffffe 0x100000000000000000ffffffff

0 commit comments

Comments
 (0)