From 7306635ed303cb18d37c4d284ea4927645460af3 Mon Sep 17 00:00:00 2001 From: panne Date: Mon, 2 Apr 2001 21:10:04 +0000 Subject: [PATCH] [project @ 2001-04-02 21:10:04 by panne] Made this test a little bit less fragile (my 1GHz Athlon was too fast for the expected output :-) --- ghc/tests/io/should_run/io012.hs | 17 ++++++++++++----- ghc/tests/io/should_run/io012.stdout | 4 +++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ghc/tests/io/should_run/io012.hs b/ghc/tests/io/should_run/io012.hs index 3ebf203..807bbb7 100644 --- a/ghc/tests/io/should_run/io012.hs +++ b/ghc/tests/io/should_run/io012.hs @@ -1,14 +1,21 @@ -- !!! Test getCPUTime import IO - import CPUTime +main :: IO () main = do - t <- getCPUTime - print (nfib 30) - t <- getCPUTime - print (length (show t)) -- printing the CPU time itself is un-cool if you want to diff the output.. + t28 <- timeFib 28 + t29 <- timeFib 29 + t30 <- timeFib 30 + print (t28 <= t29, t29 <= t30) + +timeFib :: Integer -> IO Integer +timeFib n = do + start <- getCPUTime + print (nfib n) + end <- getCPUTime + return (end - start) nfib :: Integer -> Integer nfib n diff --git a/ghc/tests/io/should_run/io012.stdout b/ghc/tests/io/should_run/io012.stdout index a72e4b0..032e759 100644 --- a/ghc/tests/io/should_run/io012.stdout +++ b/ghc/tests/io/should_run/io012.stdout @@ -1,2 +1,4 @@ +1028457 +1664079 2692537 -13 +(True,True) -- 1.7.10.4