mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 11:40:18 +01:00
tests/int_big_*: Add more tests for result normalization.
Tested by comparability to small int/casting to bool.
This commit is contained in:
@@ -6,3 +6,4 @@ a = 0xfffffffffffffffffffffffffffff
|
||||
print(a ^ (1 << 100))
|
||||
print(a ^ (1 << 200))
|
||||
print(a ^ a == 0)
|
||||
print(bool(a ^ a))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# to test arbitrariy precision integers
|
||||
|
||||
x = 1000000000000000000000000000000
|
||||
xn = -1000000000000000000000000000000
|
||||
y = 2000000000000000000000000000000
|
||||
|
||||
# printing
|
||||
@@ -10,11 +11,15 @@ print(y)
|
||||
# addition
|
||||
print(x + 1)
|
||||
print(x + y)
|
||||
print(x + xn == 0)
|
||||
print(bool(x + xn))
|
||||
|
||||
# subtraction
|
||||
print(x - 1)
|
||||
print(x - y)
|
||||
print(y - x)
|
||||
print(x - x == 0)
|
||||
print(bool(x - x))
|
||||
|
||||
# multiplication
|
||||
print(x * 2)
|
||||
|
||||
Reference in New Issue
Block a user