Import Upstream version 20180207
[hcoop/debian/mlton.git] / regression / int-overflow.sml
1 val _ =
2 (Int.fromString "12345678901234567890"
3 ; print "ERROR\n")
4 handle Overflow => print "OK\n"
5
6 val min = valOf Int.minInt
7 val _ =
8 (~ min
9 ; print "ERROR\n")
10 handle Overflow => print "OK\n"
11
12 val _ =
13 (Int.fromString "2147483648"
14 ; print "ERROR\n")
15 handle Overflow => print "OK\n"
16
17 val _ =
18 (abs min
19 ; print "ERROR\n")
20 handle Overflow => print "OK\n"