diff options
Diffstat (limited to 'testsuite/tests/numeric/should_run')
-rw-r--r-- | testsuite/tests/numeric/should_run/arith001.hs | 20 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/arith002.hs | 46 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/arith003.hs | 18 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/arith004.hs | 132 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/arith005.hs | 18 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/arith007.hs | 16 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/arith010.hs | 18 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/arith011.hs | 20 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/arith012.hs | 8 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/arith016.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/arith017.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/numrun009.hs | 22 |
12 files changed, 164 insertions, 164 deletions
diff --git a/testsuite/tests/numeric/should_run/arith001.hs b/testsuite/tests/numeric/should_run/arith001.hs index ed9cd5febc..b22461af3f 100644 --- a/testsuite/tests/numeric/should_run/arith001.hs +++ b/testsuite/tests/numeric/should_run/arith001.hs @@ -3,15 +3,15 @@ import Data.Ratio main = putStr (show r42 ++ "\n" ++ - show nu42 ++ ", " ++ - show de42 ++ "\n" ++ - show nu42d ++ ", " ++ - show de42d ++ "\n" ++ - show s2 ++ ", " ++ - show e2 ++ "\n" ++ - show s ++ ", " ++ - show e ++ "\n" ) - where + show nu42 ++ ", " ++ + show de42 ++ "\n" ++ + show nu42d ++ ", " ++ + show de42d ++ "\n" ++ + show s2 ++ ", " ++ + show e2 ++ "\n" ++ + show s ++ ", " ++ + show e ++ "\n" ) + where d42 :: Double r42 :: Rational nu42, de42 :: Integer @@ -24,5 +24,5 @@ main = putStr (show r42 ++ "\n" ++ nu42d= fromInteger nu42 de42d= fromInteger de42 - (s,e)= decodeFloat (nu42d / de42d ) + (s,e)= decodeFloat (nu42d / de42d ) (s2,e2) = decodeFloat d42 diff --git a/testsuite/tests/numeric/should_run/arith002.hs b/testsuite/tests/numeric/should_run/arith002.hs index b7f5acf136..7d3a06438e 100644 --- a/testsuite/tests/numeric/should_run/arith002.hs +++ b/testsuite/tests/numeric/should_run/arith002.hs @@ -5,35 +5,35 @@ import Data.Ratio main = putStr (-- Ratio Ints - show [i0a, i0b, i0c, i2a, i2b, im2a, im2b, i_pi, i_misc] + show [i0a, i0b, i0c, i2a, i2b, im2a, im2b, i_pi, i_misc] ++ "\n" - -- the Ints + -- the Ints ++ show ((map numerator [i0a, i0b, i0c, i2a, i2b, im2a, im2b, i_pi, i_misc]) - ++(map denominator [i0a, i0b, i0c, i2a, i2b, im2a, im2b, i_pi, i_misc])) + ++(map denominator [i0a, i0b, i0c, i2a, i2b, im2a, im2b, i_pi, i_misc])) ++ "\n" - -- Booleans --- ++ show [] + -- Booleans +-- ++ show [] -- ++ "\n" - -- Rationals (Ratio Integers) - ++ show [r0a, r0b, r0c, r2a, r2b, rm2a, rm2b, r_pi, r_misc] + -- Rationals (Ratio Integers) + ++ show [r0a, r0b, r0c, r2a, r2b, rm2a, rm2b, r_pi, r_misc] ++ "\n" - -- the Integers + -- the Integers ++ show ((map numerator [r0a, r0b, r0c, r2a, r2b, rm2a, rm2b, r_pi, r_misc]) - ++(map denominator [r0a, r0b, r0c, r2a, r2b, rm2a, rm2b, r_pi, r_misc])) + ++(map denominator [r0a, r0b, r0c, r2a, r2b, rm2a, rm2b, r_pi, r_misc])) ++ "\n" - -- Booleans --- ++ show [] + -- Booleans +-- ++ show [] -- ++ "\n" - ) - where + ) + where i0a, i0b, i0c, i2a, i2b, im2a, im2b, i_pi, i_misc :: Ratio Int - i0a = 0 % 1 - i0b = (-0) % 1 - i0c = 0 % (-1) - i2a = 4 % 2 - i2b = (-4) % (-2) + i0a = 0 % 1 + i0b = (-0) % 1 + i0c = 0 % (-1) + i2a = 4 % 2 + i2b = (-4) % (-2) im2a = (-4) % 2 im2b = 4 % (-2) i_pi = 22 % 7 @@ -41,11 +41,11 @@ main r0a, r0b, r0c, r2a, r2b, rm2a, rm2b, r_pi, r_misc :: Rational - r0a = 0 % 1 - r0b = (-0) % 1 - r0c = 0 % (-1) - r2a = 4 % 2 - r2b = (-4) % (-2) + r0a = 0 % 1 + r0b = (-0) % 1 + r0c = 0 % (-1) + r2a = 4 % 2 + r2b = (-4) % (-2) rm2a = (-4) % 2 rm2b = 4 % (-2) r_pi = 22 % 7 diff --git a/testsuite/tests/numeric/should_run/arith003.hs b/testsuite/tests/numeric/should_run/arith003.hs index 6bacbf1dee..e08890c68f 100644 --- a/testsuite/tests/numeric/should_run/arith003.hs +++ b/testsuite/tests/numeric/should_run/arith003.hs @@ -6,9 +6,9 @@ main = putStr ( - showit (do_ops int_ops) ++ - showit (do_ops integer_ops) - ) + showit (do_ops int_ops) ++ + showit (do_ops integer_ops) + ) showit :: (Show a, Integral a) => [(String, a, a, a)] -> String showit stuff = concat @@ -17,7 +17,7 @@ showit stuff = concat ] do_ops :: Integral a => [((a -> a -> a), String, [(a,a)])] - -> [(String, a, a, a)] + -> [(String, a, a, a)] do_ops ops = [ (str, l, r, l `op` r) | (op,str,args) <- ops, (l,r) <- args ] small_operands, non_min_operands, operands, non_max_operands @@ -28,17 +28,17 @@ non_min_operands = small_operands ++ [ fromIntegral maxInt ] non_max_operands = small_operands ++ [ fromIntegral minInt ] large_operands :: [ Integer ] -large_operands = operands ++ +large_operands = operands ++ [ fromIntegral minInt - 1, fromIntegral maxInt + 1, fromIntegral minInt * 2, fromIntegral maxInt * 2, - fromIntegral minInt ^ 2, + fromIntegral minInt ^ 2, fromIntegral maxInt ^ 2 ] integer_ops :: [((Integer -> Integer -> Integer), String, [(Integer,Integer)])] -integer_ops = [ +integer_ops = [ ((+), "(+)", both_large), ((-), "(-)", both_large), (div, "div", large_non_zero_r), @@ -50,7 +50,7 @@ integer_ops = [ ] int_ops :: [((Int -> Int -> Int), String, [(Int,Int)])] -int_ops = [ +int_ops = [ ((+), "(+)", both_small), ((-), "(-)", both_small), ((^), "(^)", small_non_neg_r), @@ -71,7 +71,7 @@ both_small, non_zero_r, non_min_either_non_zero, non_min_l_or_zero_r, :: Integral a => [(a,a)] both_small = [ (l,r) | l <- operands, r <- operands ] -both_large = [ (l,r) | l <- large_operands, r <- large_operands ] +both_large = [ (l,r) | l <- large_operands, r <- large_operands ] large_non_zero_r = [ (l,r) | l <- operands, r <- large_operands, r /= 0 ] non_zero_r = [ (l,r) | l <- operands, r <- operands, r /= 0 ] non_min_either_non_zero = [ (l,r) | l <- non_min_operands, r <- non_min_operands, l /= 0 || r /= 0 ] diff --git a/testsuite/tests/numeric/should_run/arith004.hs b/testsuite/tests/numeric/should_run/arith004.hs index 68e601128e..8001b05d59 100644 --- a/testsuite/tests/numeric/should_run/arith004.hs +++ b/testsuite/tests/numeric/should_run/arith004.hs @@ -3,81 +3,81 @@ main = putStr (-- w/ Ints and Integers - show (unzipWith div ints_list) - ++ "\n" - ++ show (unzipWith div integers_list) - ++ "\n" - ++ show (unzipWith rem ints_list) - ++ "\n" - ++ show (unzipWith rem integers_list) - ++ "\n" - ++ show (unzipWith quot ints_list) - ++ "\n" - ++ show (unzipWith quot integers_list) - ++ "\n" - ++ show (unzipWith mod ints_list) - ++ "\n" - ++ show (unzipWith mod integers_list) - ++ "\n" - ++ show (unzipWith law1 ints_list) - ++ "\n" - ++ show (unzipWith law1 integers_list) - ++ "\n" - ++ show (unzipWith law2 ints_list) - ++ "\n" - ++ show (unzipWith law2 integers_list) - ++ "\n" - ) + show (unzipWith div ints_list) + ++ "\n" + ++ show (unzipWith div integers_list) + ++ "\n" + ++ show (unzipWith rem ints_list) + ++ "\n" + ++ show (unzipWith rem integers_list) + ++ "\n" + ++ show (unzipWith quot ints_list) + ++ "\n" + ++ show (unzipWith quot integers_list) + ++ "\n" + ++ show (unzipWith mod ints_list) + ++ "\n" + ++ show (unzipWith mod integers_list) + ++ "\n" + ++ show (unzipWith law1 ints_list) + ++ "\n" + ++ show (unzipWith law1 integers_list) + ++ "\n" + ++ show (unzipWith law2 ints_list) + ++ "\n" + ++ show (unzipWith law2 integers_list) + ++ "\n" + ) where ints_list :: [(Int, Int)] integers_list :: [(Integer, Integer)] ints_list = [ - (0, 4), - (0, -8), - (7, 3), - (13, 4), - (13, -4), - (-13, 4), - (-13, -4), - (12345678, 10000), - (12345678, -10000), - (-12345678, 10000), - (-12345678, -10000), - (123456,10000), - (1234567,20000), - (12345678,-10000), - (123456789,10000), - (1234567890,-10000), - (-12345,10000), - (-123456789,-10000) - ] + (0, 4), + (0, -8), + (7, 3), + (13, 4), + (13, -4), + (-13, 4), + (-13, -4), + (12345678, 10000), + (12345678, -10000), + (-12345678, 10000), + (-12345678, -10000), + (123456,10000), + (1234567,20000), + (12345678,-10000), + (123456789,10000), + (1234567890,-10000), + (-12345,10000), + (-123456789,-10000) + ] integers_list = [ - (0, 4), - (0, -8), - (7, 3), - (13, 4), - (13, -4), - (-13, 4), - (-13, -4), - (12345678, 10000), - (12345678, -10000), - (-12345678, 10000), - (-12345678, -10000), - (123456,10000), - (1234567,20000), - (12345678,-10000), - (123456789,10000), - (1234567890,-10000), - (-12345,10000), - (-123456789,-10000), - (12345678900,500000000), - (1234000000000000000000005678900,5001111111111111000000) - ] + (0, 4), + (0, -8), + (7, 3), + (13, 4), + (13, -4), + (-13, 4), + (-13, -4), + (12345678, 10000), + (12345678, -10000), + (-12345678, 10000), + (-12345678, -10000), + (123456,10000), + (1234567,20000), + (12345678,-10000), + (123456789,10000), + (1234567890,-10000), + (-12345,10000), + (-123456789,-10000), + (12345678900,500000000), + (1234000000000000000000005678900,5001111111111111000000) + ] unzipWith :: (a -> b -> c) -> [(a,b)] -> [c] -unzipWith f [] = [] +unzipWith f [] = [] unzipWith f ((x,y):zs) = f x y : unzipWith f zs law1, law2 :: Integral a => a -> a -> Bool diff --git a/testsuite/tests/numeric/should_run/arith005.hs b/testsuite/tests/numeric/should_run/arith005.hs index 179d7b33dc..e1edfd874a 100644 --- a/testsuite/tests/numeric/should_run/arith005.hs +++ b/testsuite/tests/numeric/should_run/arith005.hs @@ -1,6 +1,6 @@ -- !!! test RealFrac ops (ceiling/floor/etc.) on Floats/Doubles -- -main = +main = putStr $ unlines [ -- just for fun, we show the floats to @@ -36,25 +36,25 @@ main = -- See bug #1254 small_float_list :: [Float] small_float_list = [ - 0.0, -0.0, 1.1, 2.8, 3.5, 4.5, -1.0000000001, -2.9999995, - -3.50000000001, -4.49999999999, 1000012.0, 123.456, 100.25, - 102.5, 0.0012, -0.00000012, 1.7e4, -1.7e-4, 0.15e-6, pi + 0.0, -0.0, 1.1, 2.8, 3.5, 4.5, -1.0000000001, -2.9999995, + -3.50000000001, -4.49999999999, 1000012.0, 123.456, 100.25, + 102.5, 0.0012, -0.00000012, 1.7e4, -1.7e-4, 0.15e-6, pi ] float_list :: [Float] float_list = small_float_list ++ [ - 1.18088e+11, 1.2111e+14 + 1.18088e+11, 1.2111e+14 ] -- these fit into an Int small_double_list :: [Double] small_double_list = [ - 0.0, -0.0, 1.1, 2.8, 3.5, 4.5, -1.0000000001, -2.9999995, - -3.50000000001, -4.49999999999, 1000012.0, 123.456, 100.25, - 102.5, 0.0012, -0.00000012, 1.7e4, -1.7e-4, 0.15e-6, pi + 0.0, -0.0, 1.1, 2.8, 3.5, 4.5, -1.0000000001, -2.9999995, + -3.50000000001, -4.49999999999, 1000012.0, 123.456, 100.25, + 102.5, 0.0012, -0.00000012, 1.7e4, -1.7e-4, 0.15e-6, pi ] double_list :: [Double] double_list = small_double_list ++ [ - 1.18088e+11, 1.2111e+14 + 1.18088e+11, 1.2111e+14 ] diff --git a/testsuite/tests/numeric/should_run/arith007.hs b/testsuite/tests/numeric/should_run/arith007.hs index 3d42d1fb10..e3d36a8651 100644 --- a/testsuite/tests/numeric/should_run/arith007.hs +++ b/testsuite/tests/numeric/should_run/arith007.hs @@ -12,12 +12,12 @@ main = do int_list = (map fromInteger integer_list) integer_list = (map (* 2) - [1,3,5,7,9, - 11111111111111111111111111111, - 2222222222222222222222222222222222222, - 3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333, - -11111111111111111111111111111, - -2222222222222222222222222222222222222, - -3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 - ]) + [1,3,5,7,9, + 11111111111111111111111111111, + 2222222222222222222222222222222222222, + 3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333, + -11111111111111111111111111111, + -2222222222222222222222222222222222222, + -3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333 + ]) diff --git a/testsuite/tests/numeric/should_run/arith010.hs b/testsuite/tests/numeric/should_run/arith010.hs index 846f76e4d1..0b2f83f7ea 100644 --- a/testsuite/tests/numeric/should_run/arith010.hs +++ b/testsuite/tests/numeric/should_run/arith010.hs @@ -1,11 +1,11 @@ --- Tests enumerations +-- Tests enumerations main = do - print [1..10] - print [10..1] -- [] - print [1,3..10] - print [10,8..1] - print ['a'..'f'] - print ['f'..'a'] -- [] - print ['a','c'..'m'] - print ['m','l'..'a'] + print [1..10] + print [10..1] -- [] + print [1,3..10] + print [10,8..1] + print ['a'..'f'] + print ['f'..'a'] -- [] + print ['a','c'..'m'] + print ['m','l'..'a'] diff --git a/testsuite/tests/numeric/should_run/arith011.hs b/testsuite/tests/numeric/should_run/arith011.hs index d1b7c08939..4e23a8d99d 100644 --- a/testsuite/tests/numeric/should_run/arith011.hs +++ b/testsuite/tests/numeric/should_run/arith011.hs @@ -83,7 +83,7 @@ testConversions zero = do samples :: (Num a) => a -> [a] samples zero = map fromInteger ([-3 .. -1]++[0 .. 3]) - + table1 :: (Show a, Show b) => String -> (a -> b) -> [a] -> IO () table1 nm f xs = do sequence [ f' x | x <- xs ] @@ -94,7 +94,7 @@ table1 nm f xs = do table2 :: (Show a, Show b, Show c) => String -> (a -> b -> c) -> [a] -> [b] -> IO () table2 nm op xs ys = do sequence [ sequence [ op' x y | y <- ys ] >> putStrLn " " - | x <- xs + | x <- xs ] putStrLn "#" where @@ -120,19 +120,19 @@ testEq zero = do testOrd zero = do putStrLn "testOrd" - table2 "<=" (<=) xs xs - table2 "< " (<) xs xs - table2 "> " (>) xs xs - table2 ">=" (>=) xs xs + table2 "<=" (<=) xs xs + table2 "< " (<) xs xs + table2 "> " (>) xs xs + table2 ">=" (>=) xs xs table2 "`compare`" compare xs xs where xs = samples zero testNum zero = do putStrLn "testNum" - table2 "+" (+) xs xs - table2 "-" (-) xs xs - table2 "*" (*) xs xs + table2 "+" (+) xs xs + table2 "-" (-) xs xs + table2 "*" (*) xs xs table1 "negate" negate xs where xs = samples zero @@ -161,7 +161,7 @@ testBits zero do_bitsize = do table2 "`xor`" xor xs xs table1 "complement" complement xs table2 "`shiftL`" shiftL xs ([0..3] ++ [32,64]) - table2 "`shiftR`" shiftR xs ([0..3] ++ [32,64]) + table2 "`shiftR`" shiftR xs ([0..3] ++ [32,64]) table2 "`rotate`" rotate xs ([-3..3] ++ [-64,-32,32,64]) table1 "bit" (\ x -> (bit x) `asTypeOf` zero) [(0::Int)..3] table2 "`setBit`" setBit xs ([0..3] ++ [32,64]) diff --git a/testsuite/tests/numeric/should_run/arith012.hs b/testsuite/tests/numeric/should_run/arith012.hs index f9f9ec778e..e23b2f72ed 100644 --- a/testsuite/tests/numeric/should_run/arith012.hs +++ b/testsuite/tests/numeric/should_run/arith012.hs @@ -18,15 +18,15 @@ tst = do ---- -- Test data: doubles :: [Double] -doubles = [ -1.2 , 0, 0.1, 0.5, 1.0, 1234.45454, +doubles = [ -1.2 , 0, 0.1, 0.5, 1.0, 1234.45454, 1.6053e4, 1.64022e12, 6.894e-4, 6.34543455634582173, - 5342413403.40540423255] + 5342413403.40540423255] ints :: [Int] ints = [ 0, 1, 255, 65513, 6029, 1024, 256, 201357245] integers :: [Integer] integers = [ 0, 1, 255, 65513, 6029, 1024, 256, - 2343243543500233, 656194962055457832] + 2343243543500233, 656194962055457832] --- test_doubleToFloat :: IO () @@ -69,7 +69,7 @@ showBin i = showIntAtBase 2 intToDigit i showList' :: [ShowS] -> String showList' [] = "[]" showList' (x:xs) = showChar '[' . x $ showl xs "" - where + where showl [] = showChar ']' showl (x:xs) = showChar ',' . x . showl xs diff --git a/testsuite/tests/numeric/should_run/arith016.hs b/testsuite/tests/numeric/should_run/arith016.hs index a219b5575e..82d76a6896 100644 --- a/testsuite/tests/numeric/should_run/arith016.hs +++ b/testsuite/tests/numeric/should_run/arith016.hs @@ -3,10 +3,10 @@ module Main where import GHC.Exts ( Float(F#), - eqFloat#, neFloat#, ltFloat#, - leFloat#, gtFloat#, geFloat#, + eqFloat#, neFloat#, ltFloat#, + leFloat#, gtFloat#, geFloat#, isTrue# - ) + ) fcmp_eq, fcmp_ne, fcmp_lt, fcmp_le, fcmp_gt, fcmp_ge :: (String, Float -> Float -> Bool) fcmp_eq = ("==", \ (F# a) (F# b) -> isTrue# (a `eqFloat#` b)) diff --git a/testsuite/tests/numeric/should_run/arith017.hs b/testsuite/tests/numeric/should_run/arith017.hs index 86048dcbe3..68b39fc979 100644 --- a/testsuite/tests/numeric/should_run/arith017.hs +++ b/testsuite/tests/numeric/should_run/arith017.hs @@ -5,6 +5,6 @@ import Data.Word main = do print (fromIntegral ((2^30 -1 + 2^30) - (2^30 + 2^30 :: Integer)) - :: Data.Int.Int64) + :: Data.Int.Int64) print (fromIntegral ((2^30 -1 + 2^30) - (2^30 + 2^30 :: Integer)) - :: Data.Word.Word64) + :: Data.Word.Word64) diff --git a/testsuite/tests/numeric/should_run/numrun009.hs b/testsuite/tests/numeric/should_run/numrun009.hs index 37d0513a39..622458143f 100644 --- a/testsuite/tests/numeric/should_run/numrun009.hs +++ b/testsuite/tests/numeric/should_run/numrun009.hs @@ -3,15 +3,15 @@ -- (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) -- <undefined> - print (abs (-2147483648) :: Int) -- <undefined> - print (abs ((-2147483647)-1) :: Int) -- <undefined> - print (abs (-2147483648) :: Integer) -- 2147483648 - print (abs ((-2147483647)-1) :: Integer) -- 2147483648 (wrong in 4.04) - print (fromInteger (-2147483648 :: Integer) :: Int) -- -2147483648 + 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) -- <undefined> + print (abs (-2147483648) :: Int) -- <undefined> + print (abs ((-2147483647)-1) :: Int) -- <undefined> + 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 |