Initial import
This commit is contained in:
commit
405b86068e
324 changed files with 163599 additions and 0 deletions
18
tests/toverflw.nim
Executable file
18
tests/toverflw.nim
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
# Tests emc's ability to detect overflows
|
||||
|
||||
import
|
||||
io
|
||||
|
||||
{.push overflowChecks: on.}
|
||||
|
||||
var
|
||||
a, b: int
|
||||
a = high(int)
|
||||
b = -2
|
||||
try:
|
||||
writeln(stdout, b - a)
|
||||
except EOverflow:
|
||||
writeln(stdout, "the computation overflowed")
|
||||
|
||||
{.pop.} # overflow check
|
||||
#OUT the computation overflowed
|
||||
Loading…
Add table
Add a link
Reference in a new issue