summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ghc/tests/numeric/should_run/arith013.hs13
-rw-r--r--ghc/tests/numeric/should_run/arith013.stdout32
2 files changed, 45 insertions, 0 deletions
diff --git a/ghc/tests/numeric/should_run/arith013.hs b/ghc/tests/numeric/should_run/arith013.hs
new file mode 100644
index 0000000000..63784ded70
--- /dev/null
+++ b/ghc/tests/numeric/should_run/arith013.hs
@@ -0,0 +1,13 @@
+-- Test gcdInt/gcdInteger
+
+import PrelBase ( gcdInt )
+import PrelNum ( gcdInteger )
+
+main :: IO ()
+main = do
+ test gcdInt [ -42, 0, 105 ]
+ test gcdInteger [-12193263111263526900, -42, 0, 105, 1234567890 ]
+
+
+test :: 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 ]
diff --git a/ghc/tests/numeric/should_run/arith013.stdout b/ghc/tests/numeric/should_run/arith013.stdout
new file mode 100644
index 0000000000..ff440977df
--- /dev/null
+++ b/ghc/tests/numeric/should_run/arith013.stdout
@@ -0,0 +1,32 @@
+(-42,105,21)
+(-42,0,42)
+(-42,-42,42)
+(0,105,105)
+(0,-42,42)
+(105,105,105)
+(105,0,105)
+(105,-42,21)
+(-12193263111263526900,1234567890,1234567890)
+(-12193263111263526900,105,15)
+(-12193263111263526900,0,12193263111263526900)
+(-12193263111263526900,-42,6)
+(-12193263111263526900,-12193263111263526900,12193263111263526900)
+(-42,1234567890,6)
+(-42,105,21)
+(-42,0,42)
+(-42,-42,42)
+(-42,-12193263111263526900,6)
+(0,1234567890,1234567890)
+(0,105,105)
+(0,-42,42)
+(0,-12193263111263526900,12193263111263526900)
+(105,1234567890,15)
+(105,105,105)
+(105,0,105)
+(105,-42,21)
+(105,-12193263111263526900,15)
+(1234567890,1234567890,1234567890)
+(1234567890,105,15)
+(1234567890,0,1234567890)
+(1234567890,-42,6)
+(1234567890,-12193263111263526900,1234567890)