summaryrefslogtreecommitdiff
path: root/testsuite/tests/numeric/should_run/arith013.hs
blob: 68e5d3ab8f259fa0b0c2bd60c8924f32ab6cc4ec (plain)
1
2
3
4
5
6
7
8
9
10
-- Test gcd

main :: IO ()
main = do
   test gcd ([                       -42, 0, 105             ] :: [Int])
   test gcd ([-12193263111263526900, -42, 0, 105, 1234567890 ] :: [Integer])


test :: (Show a, Integral a) => (a -> a -> a) -> [a] -> IO ()
test f xs = mapM_ print [ (a, b, f a b) | a <- xs, b <- reverse xs, a /= 0  || b /= 0 ]