Commit ce68b757 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Add a couple of tests for gcdInteger

parent 16e79b16
......@@ -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"
module T7041 where
gcdInt :: Int -> Int -> Int
gcdInt a b = fromInteger (gcd (toInteger a) (toInteger b))
......@@ -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'])
{-# 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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment