From: simonmar Date: Wed, 4 Aug 1999 10:07:50 +0000 (+0000) Subject: [project @ 1999-08-04 10:07:50 by simonmar] X-Git-Tag: Approximately_9120_patches~5912 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=2cd1a07b90c519d93f6d778519fc3d2791aadd8f;p=ghc-hetmet.git [project @ 1999-08-04 10:07:50 by simonmar] Add a test for a rather misguided use of the Memo library, but which showed up a bug nevertheless :) --- diff --git a/ghc/tests/lib/should_run/Makefile b/ghc/tests/lib/should_run/Makefile index b65b4d9..4785fc1 100644 --- a/ghc/tests/lib/should_run/Makefile +++ b/ghc/tests/lib/should_run/Makefile @@ -1,5 +1,5 @@ #----------------------------------------------------------------------------- -# $Id: Makefile,v 1.12 1999/06/09 09:35:58 simonpj Exp $ +# $Id: Makefile,v 1.13 1999/08/04 10:07:50 simonmar Exp $ TOP = ../.. include $(TOP)/mk/boilerplate.mk @@ -29,6 +29,9 @@ memo001_HC_OPTS = -syslib misc # finalized properly, and stable names are GC'd etc. memo001_RUNTEST_OPTS = +RTS -A10k -G1 +memo002_HC_OPTS = -syslib misc +memo002_RUNTEST_OPTS = 20 + SRC_MKDEPENDHS_OPTS += -syslib misc -syslib exts include $(TOP)/mk/target.mk diff --git a/ghc/tests/lib/should_run/memo002.hs b/ghc/tests/lib/should_run/memo002.hs new file mode 100644 index 0000000..d441c0a --- /dev/null +++ b/ghc/tests/lib/should_run/memo002.hs @@ -0,0 +1,25 @@ +module Main +where + +import Memo +import System(getArgs) + +main = do (arg:_) <- getArgs + mapM_ printTriple [ (i,fib i,mfib i) | i <- [10..read arg] ] + where printTriple (i,fi,mfi) = do print i + print fi + print mfi + putStrLn "" + +mfib :: Integer -> Integer +mfib = memo ufib + +ufib :: Integer -> Integer +ufib 0 = 1 +ufib 1 = 1 +ufib n = mfib (n-1) + mfib (n-2) + +fib :: Integer -> Integer +fib 0 = 1 +fib 1 = 1 +fib n = fib (n-1) + fib (n-2) diff --git a/ghc/tests/lib/should_run/memo002.stdout b/ghc/tests/lib/should_run/memo002.stdout new file mode 100644 index 0000000..e69de29