[project @ 1999-07-29 10:03:18 by simonmar]
[ghc-hetmet.git] / ghc / tests / numeric / should_run / arith011.hs
index b931228..e469c0c 100644 (file)
@@ -10,6 +10,7 @@ main = test
 
 test :: IO ()
 test = do
+   testIntlikeNoBits "Int"    (0::Int)     
    testIntlike "Int8"   (0::Int8)     
    testIntlike "Int16"  (0::Int16)    
    testIntlike "Int32"  (0::Int32)    
@@ -17,8 +18,8 @@ test = do
    testIntlike "Word16" (0::Word16)   
    testIntlike "Word32" (0::Word32)   
 
-testIntlike :: (Bounded a, Integral a, Ix a, Read a, Bits a) => String -> a -> IO ()
-testIntlike name zero = do
+testIntlikeNoBits :: (Bounded a, Integral a, Ix a, Read a) => String -> a -> IO ()
+testIntlikeNoBits name zero = do
   putStrLn $ "--------------------------------"
   putStrLn $ "--Testing " ++ name
   putStrLn $ "--------------------------------"
@@ -30,8 +31,13 @@ testIntlike name zero = do
   testNum      zero
   testReal     zero
   testIntegral zero
+
+
+testIntlike :: (Bounded a, Integral a, Ix a, Read a, Bits a) => String -> a -> IO ()
+testIntlike name zero = do
+  testIntlikeNoBits name zero
   testBits     zero
-  putStrLn $ "--------------------------------"
+
 
 -- In all these tests, zero is a dummy element used to get
 -- the overloading to work
@@ -125,14 +131,14 @@ testBits zero = do
   table2 ".|.  "            (.|.)         xs ys
   table2 "`xor`"            xor           xs ys
   table1 "complement"       complement    xs
-  table2 "`shiftL`"         shiftL        xs [0..3] 
-  table2 "`shiftR`"         shiftR        xs [0..3] 
+  table2 "`shiftL`"         shiftL        xs ([0..3] ++ [32])
+  table2 "`shiftR`"         shiftR        xs ([0..3] ++ [32]) 
   table2 "`rotate`"         rotate        xs ([-3..3])
   table1 "bit"              (\ x -> (bit x) `asTypeOf` zero)   [(0::Int)..3]
-  table2 "`setBit`"         setBit        xs [0..3]
-  table2 "`clearBit`"       clearBit      xs [0..3]
-  table2 "`complementBit`"  complementBit xs [0..3]
-  table2 "`testBit`"        testBit       xs [0..3]
+  table2 "`setBit`"         setBit        xs ([0..3] ++ [32])
+  table2 "`clearBit`"       clearBit      xs ([0..3] ++ [32])
+  table2 "`complementBit`"  complementBit xs ([0..3] ++ [32])
+  table2 "`testBit`"        testBit       xs ([0..3] ++ [32])
   table1 "bitSize"          bitSize       xs
   table1 "isSigned"         isSigned      xs
  where