Repository : ssh://darcs.haskell.org//srv/darcs/testsuite On branch : ghc-7.4
http://hackage.haskell.org/trac/ghc/changeset/11e6f8e1e69c9c9fd72d3205822d245087ffefc3 >--------------------------------------------------------------- commit 11e6f8e1e69c9c9fd72d3205822d245087ffefc3 Author: Ian Lynagh <[email protected]> Date: Fri Jan 13 18:54:32 2012 +0000 Add {double,float}FromInteger to the integerConstantFolding test >--------------------------------------------------------------- tests/lib/integer/Makefile | 2 ++ tests/lib/integer/integerConstantFolding.hs | 12 ++++++++++++ tests/lib/integer/integerConstantFolding.stdout | 2 ++ 3 files changed, 16 insertions(+), 0 deletions(-) diff --git a/tests/lib/integer/Makefile b/tests/lib/integer/Makefile index 612f3f0..297f9f0 100644 --- a/tests/lib/integer/Makefile +++ b/tests/lib/integer/Makefile @@ -30,5 +30,7 @@ integerConstantFolding: $(call CHECK,\<6253\>,shiftRInteger) $(call CHECK,\<641\>,quotInteger) $(call CHECK,\<68\>,remInteger) + $(call CHECK,\<200131.0\>,doubleFromInteger) + $(call CHECK,\<200135.0\>,floatFromInteger) ./integerConstantFolding diff --git a/tests/lib/integer/integerConstantFolding.hs b/tests/lib/integer/integerConstantFolding.hs index bea5149..1fdd099 100644 --- a/tests/lib/integer/integerConstantFolding.hs +++ b/tests/lib/integer/integerConstantFolding.hs @@ -46,6 +46,8 @@ main = do p "plusInteger" plusInteger p "shiftRInteger" shiftRInteger p "quotInteger" quotInteger p "remInteger" remInteger + p "doubleFromInteger" doubleFromInteger + p "floatFromInteger" floatFromInteger where p :: Show a => String -> a -> IO () p str x = putStrLn (str ++ ": " ++ show x) @@ -159,3 +161,13 @@ quotInteger = 100063 `quot` 156 remInteger :: Integer remInteger = 100064 `rem` 156 +-- For the conversion functions, we can't just check that e.g. 100065 +-- is in the resulting core, because it will be regardless of whether +-- the rules fire or not. So we add 100066, and thus rely on the +-- Double addition rule also firing. +doubleFromInteger :: Double +doubleFromInteger = fromInteger 100065 + 100066 + +floatFromInteger :: Float +floatFromInteger = fromInteger 100067 + 100068 + diff --git a/tests/lib/integer/integerConstantFolding.stdout b/tests/lib/integer/integerConstantFolding.stdout index 471eb75..7c32328 100644 --- a/tests/lib/integer/integerConstantFolding.stdout +++ b/tests/lib/integer/integerConstantFolding.stdout @@ -40,3 +40,5 @@ shiftLInteger: 1600976 shiftRInteger: 6253 quotInteger: 641 remInteger: 68 +doubleFromInteger: 200131.0 +floatFromInteger: 200135.0 _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
