Add underflow/overflow tests.

This commit is contained in:
EXetoC
2014-03-31 14:50:44 +02:00
parent b919ab790b
commit 52c6956d1a
6 changed files with 56 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
discard """
errormsg: "over- or underflow"
"""
static:
proc p =
var
x = int64.high
discard x + 1
assert false
p()

View File

@@ -0,0 +1,12 @@
discard """
errormsg: "over- or underflow"
"""
static:
proc p =
var
x = int64.high
y = 1
discard x + y
assert false
p()

BIN
tests/vm/toverflowopcmulint Executable file

Binary file not shown.

View File

@@ -0,0 +1,11 @@
discard """
errormsg: "over- or underflow"
"""
static:
proc p =
var
x = 1 shl 62
discard x * 2
assert false
p()

View File

@@ -0,0 +1,10 @@
discard """
errormsg: "over- or underflow"
"""
static:
proc p =
var x = int64.low
discard x - 1
assert false
p()

View File

@@ -0,0 +1,12 @@
discard """
errormsg: "over- or underflow"
"""
static:
proc p =
var
x = int64.low
y = 1
discard x - y
assert false
p()