diff options
author | Ian Lynagh <igloo@earth.li> | 2012-07-13 19:44:47 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2012-07-13 19:44:47 +0100 |
commit | ce68b757b3620e75e330f77cc1ed1d491292ff3e (patch) | |
tree | 89da162889084b07ebe3a35710a3184700c7f93e /testsuite | |
parent | 16e79b16926148f82a98cf6f36f520089629a898 (diff) | |
download | haskell-ce68b757b3620e75e330f77cc1ed1d491292ff3e.tar.gz |
Add a couple of tests for gcdInteger
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/lib/integer/Makefile | 6 | ||||
-rw-r--r-- | testsuite/tests/lib/integer/T7041.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/lib/integer/all.T | 5 | ||||
-rw-r--r-- | testsuite/tests/lib/integer/gcdInteger.hs | 17 | ||||
-rw-r--r-- | testsuite/tests/lib/integer/gcdInteger.stdout | 1 |
5 files changed, 35 insertions, 0 deletions
diff --git a/testsuite/tests/lib/integer/Makefile b/testsuite/tests/lib/integer/Makefile index 34d5a177ba..77b733de32 100644 --- a/testsuite/tests/lib/integer/Makefile +++ b/testsuite/tests/lib/integer/Makefile @@ -56,3 +56,9 @@ IntegerConversionRules: -grep -q integerToWord $@.simpl && echo "integerToWord present" -grep -q int2Word $@.simpl || echo "int2Word absent" +.PHONY: T7041 +T7041: + '$(TEST_HC)' -Wall -v0 -O -c $@.hs -fforce-recomp -ddump-simpl > $@.simpl + -grep -q gcdInteger $@.simpl && echo "gcdInteger present" + -grep -q "gcdInt\>" $@.simpl || echo "gcdInt absent" + diff --git a/testsuite/tests/lib/integer/T7041.hs b/testsuite/tests/lib/integer/T7041.hs new file mode 100644 index 0000000000..02ef996b42 --- /dev/null +++ b/testsuite/tests/lib/integer/T7041.hs @@ -0,0 +1,6 @@ + +module T7041 where + +gcdInt :: Int -> Int -> Int +gcdInt a b = fromInteger (gcd (toInteger a) (toInteger b)) + diff --git a/testsuite/tests/lib/integer/all.T b/testsuite/tests/lib/integer/all.T index 99056d6b14..cb5767580c 100644 --- a/testsuite/tests/lib/integer/all.T +++ b/testsuite/tests/lib/integer/all.T @@ -12,4 +12,9 @@ test('IntegerConversionRules', extra_clean(['IntegerConversionRules.simpl']), run_command, ['$MAKE -s --no-print-directory IntegerConversionRules']) +test('gcdInteger', normal, compile_and_run, ['']) +test('T7041', + extra_clean(['T7041.simpl']), + run_command, + ['$MAKE -s --no-print-directory T7041']) diff --git a/testsuite/tests/lib/integer/gcdInteger.hs b/testsuite/tests/lib/integer/gcdInteger.hs new file mode 100644 index 0000000000..2e945a876a --- /dev/null +++ b/testsuite/tests/lib/integer/gcdInteger.hs @@ -0,0 +1,17 @@ + +{-# LANGUAGE MagicHash #-} + +module Main (main) where + +import GHC.Base +import GHC.Integer + +main :: IO () +main = case i of + I# i# -> + print (gcd (smallInteger i#) (smallInteger i#)) + +{-# NOINLINE i #-} +i :: Int +i = minBound + diff --git a/testsuite/tests/lib/integer/gcdInteger.stdout b/testsuite/tests/lib/integer/gcdInteger.stdout new file mode 100644 index 0000000000..b0898f38f8 --- /dev/null +++ b/testsuite/tests/lib/integer/gcdInteger.stdout @@ -0,0 +1 @@ +9223372036854775808 |