From d04e5408e02034248cc55dbc1f364a3df2f1bf2b Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 13 Dec 1999 17:28:53 +0000 Subject: [PATCH] [project @ 1999-12-13 17:28:53 by simonmar] Add a few minBound::Int tests. --- ghc/tests/numeric/should_run/num009.hs | 17 +++++++++++++++++ ghc/tests/numeric/should_run/num009.stdout | 12 ++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 ghc/tests/numeric/should_run/num009.hs create mode 100644 ghc/tests/numeric/should_run/num009.stdout diff --git a/ghc/tests/numeric/should_run/num009.hs b/ghc/tests/numeric/should_run/num009.hs new file mode 100644 index 0000000..37d0513 --- /dev/null +++ b/ghc/tests/numeric/should_run/num009.hs @@ -0,0 +1,17 @@ +-- !!! tests that minBound::Int is correctly handled (for Int & Integer + +-- (not necessarily Haskell 98: relies on Int being a 32-bit type.) + +main = do + print (-2147483648 :: Int) -- -2147483648 + print ((-2147483647)-1 :: Int) -- -2147483648 + print (-2147483648 :: Integer) -- -2147483648 + print ((-2147483648 :: Int) >= 0) -- False + print ((-2147483648 :: Integer) >= 0) -- False + print (-(-2147483648) :: Int) -- + print (abs (-2147483648) :: Int) -- + print (abs ((-2147483647)-1) :: Int) -- + print (abs (-2147483648) :: Integer) -- 2147483648 + print (abs ((-2147483647)-1) :: Integer) -- 2147483648 (wrong in 4.04) + print (fromInteger (-2147483648 :: Integer) :: Int) -- -2147483648 + print (fromInteger ((-2147483647)-1 :: Integer) :: Int) -- -2147483648 diff --git a/ghc/tests/numeric/should_run/num009.stdout b/ghc/tests/numeric/should_run/num009.stdout new file mode 100644 index 0000000..902e369 --- /dev/null +++ b/ghc/tests/numeric/should_run/num009.stdout @@ -0,0 +1,12 @@ +-2147483648 +-2147483648 +-2147483648 +False +False +-2147483648 +-2147483648 +-2147483648 +2147483648 +2147483648 +-2147483648 +-2147483648 -- 1.7.10.4