snapshot before regression test

This commit is contained in:
t
2026-07-18 19:25:40 +08:00
commit 796222a300
2295 changed files with 206453 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
import stdio
import t, c
# ============================================================
# AugAssign 测试:+= -= *= /= %= &= |= ^= <<= >>=
# ============================================================
g_count: int = 0
def test_local() -> int:
x: int = 10
x += 5
stdio.printf("local +=: %d\n", x)
x -= 3
stdio.printf("local -=: %d\n", x)
x *= 2
stdio.printf("local *=: %d\n", x)
x /= 4
stdio.printf("local /=: %d\n", x)
x %= 7
stdio.printf("local %%=: %d\n", x)
return 0
def test_global_aug() -> int:
global g_count
g_count += 1
stdio.printf("global +=: %d\n", g_count)
g_count += 10
stdio.printf("global +=: %d\n", g_count)
g_count -= 3
stdio.printf("global -=: %d\n", g_count)
return 0
def test_bitops() -> int:
b: int = 0xFF
b &= 0x0F
stdio.printf("bit &=: %d\n", b)
b |= 0x30
stdio.printf("bit |=: %d\n", b)
b ^= 0xFF
stdio.printf("bit ^=: %d\n", b)
b = 1
b <<= 4
stdio.printf("bit <<=: %d\n", b)
b >>= 2
stdio.printf("bit >>=: %d\n", b)
return 0
def augassign_test() -> int:
test_local()
test_global_aug()
test_bitops()
return 0