3ab6aa3a6d
Tests which don't work with small ints are suffixed with _intbig.py. Some of these may still work with long long ints and need to be reclassified later.
32 lines
405 B
Python
32 lines
405 B
Python
# tests int constant folding in compiler
|
|
|
|
# positive
|
|
print(+1)
|
|
print(+100)
|
|
|
|
# negation
|
|
print(-1)
|
|
print(-(-1))
|
|
|
|
# 1's complement
|
|
print(~0)
|
|
print(~1)
|
|
print(~-1)
|
|
|
|
# addition
|
|
print(1 + 2)
|
|
|
|
# subtraction
|
|
print(1 - 2)
|
|
print(2 - 1)
|
|
|
|
# multiplication
|
|
print(1 * 2)
|
|
print(123 * 456)
|
|
|
|
# floor div and modulo
|
|
print(123 // 7, 123 % 7)
|
|
print(-123 // 7, -123 % 7)
|
|
print(123 // -7, 123 % -7)
|
|
print(-123 // -7, -123 % -7)
|