micropython/tests/basics/int_big_xor.py
Damien George ab69ed7dac tests: Split large tests into smaller files, to run with a small heap.
All tests in basics/ directory can now run and pass using 64-bit unix
port with only a 16k heap (./run-tests --heapsize 16k).  Tests in this
directory should remain small so they can be used for ports with a
small heap.
2016-03-15 13:07:41 +00:00

41 lines
665 B
Python

# test + +
print(0 ^ (1 << 80))
print((1 << 80) ^ (1 << 80))
print((1 << 80) ^ 0)
a = 0xfffffffffffffffffffffffffffff
print(a ^ (1 << 100))
print(a ^ (1 << 200))
print(a ^ a == 0)
print(bool(a ^ a))
# test - +
print((-1 << 80) ^ (1 << 80))
print((-1 << 80) ^ 0)
print((-a) ^ (1 << 100))
print((-a) ^ (1 << 200))
print((-a) ^ a == 0)
print(bool((-a) ^ a))
# test + -
print(0 ^ (-1 << 80))
print((1 << 80) ^ (-1 << 80))
print(a ^ (-1 << 100))
print(a ^ (-1 << 200))
print(a ^ (-a) == 0)
print(bool(a ^ (-a)))
# test - -
print((-1 << 80) ^ (-1 << 80))
print((-a) ^ (-1 << 100))
print((-a) ^ (-1 << 200))
print((-a) ^ (-a) == 0)
print(bool((-a) ^ (-a)))