test: 添加整数溢出测试用例
This commit is contained in:
parent
30fa84604b
commit
3dfc8b63c8
19
playground/BugFarm/Bug3/Main.snow
Normal file
19
playground/BugFarm/Bug3/Main.snow
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
module: Main
|
||||||
|
import: os
|
||||||
|
function: main
|
||||||
|
return_type: void
|
||||||
|
body:
|
||||||
|
// 合法
|
||||||
|
declare b1: byte = 127b
|
||||||
|
declare s1: short = 32767s
|
||||||
|
declare i1: int = 2147483647
|
||||||
|
declare l1: long = 9223372036854775807L
|
||||||
|
|
||||||
|
// 溢出(都应该收集到错误)
|
||||||
|
declare b2: byte = 128b
|
||||||
|
declare s2: short = 40000s
|
||||||
|
declare i2: int = 3000000000
|
||||||
|
declare l2: long = 9223372036854775808L
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
11
playground/BugFarm/Bug3/OS.snow
Normal file
11
playground/BugFarm/Bug3/OS.snow
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module: os
|
||||||
|
import: os
|
||||||
|
function: print
|
||||||
|
parameter:
|
||||||
|
declare i1: int
|
||||||
|
return_type: void
|
||||||
|
body:
|
||||||
|
syscall("PRINT",i1)
|
||||||
|
end body
|
||||||
|
end function
|
||||||
|
end module
|
||||||
Loading…
x
Reference in New Issue
Block a user