23 lines
677 B
Mojo
23 lines
677 B
Mojo
# probe: sized integers wrapping, and // and % with negative operands
|
|
# status: the expected output is Programming+'s interpreter's prediction; corpus.py verify confirms or refutes it on godbolt
|
|
# expect-stdout: 125
|
|
# expect-stdout: -126
|
|
# expect-stdout: -121
|
|
# expect-stdout: 254
|
|
# expect-stdout: 7 3 2 1 2
|
|
# expect-stdout: -7 3 -3 2 -2
|
|
# expect-stdout: 7 -3 -3 -2 -2
|
|
# expect-stdout: -7 -3 2 -1 2
|
|
def main():
|
|
var a: Int8 = 120
|
|
for _ in range(3):
|
|
a += 5
|
|
print(a)
|
|
var u: UInt8 = 3
|
|
u -= 5
|
|
print(u)
|
|
for pair in [(7, 3), (-7, 3), (7, -3), (-7, -3)]:
|
|
var x = pair[0]
|
|
var y = pair[1]
|
|
print(x, y, x // y, x % y, x / y)
|