[commit: base] master: Tidy up the ThreadDelay001 test code (f740f9a)

Ian Lynagh igloo at earth.li
Tue May 1 22:59:01 CEST 2012


Repository : ssh://darcs.haskell.org//srv/darcs/packages/base

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/f740f9a1fd88e8e0751ee8dffb4c4782117a7413

>---------------------------------------------------------------

commit f740f9a1fd88e8e0751ee8dffb4c4782117a7413
Author: Ian Lynagh <igloo at earth.li>
Date:   Tue May 1 17:38:41 2012 +0100

    Tidy up the ThreadDelay001 test code

>---------------------------------------------------------------

 tests/Concurrent/ThreadDelay001.hs |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/Concurrent/ThreadDelay001.hs b/tests/Concurrent/ThreadDelay001.hs
index c60f997..6273ba5 100644
--- a/tests/Concurrent/ThreadDelay001.hs
+++ b/tests/Concurrent/ThreadDelay001.hs
@@ -8,8 +8,10 @@ import Control.Concurrent
 import Control.Monad
 import System.Time
 
+main :: IO ()
 main = mapM_ delay (0 : take 11 (iterate (*5) 1))
 
+delay :: Int -> IO ()
 delay n = do
   tS <- getClockTime
   threadDelay n
@@ -17,10 +19,12 @@ delay n = do
 
   let req = fromIntegral n * 10 ^ (6 :: Int)
       obs = case normalizeTimeDiff (diffClockTimes tE tS) of
-                TimeDiff 0 0 0 0 0 s ps -> 10^12 * fromIntegral s + ps
+                TimeDiff 0 0 0 0 0 s ps -> 10 ^ (12 :: Int) * fromIntegral s + ps
+                td ->
+                    error ("Bad TimeDiff: " ++ show td)
       diff = obs - req
       diff' :: Double
-      diff' = fromIntegral diff /  10^(12 :: Int)
+      diff' = fromIntegral diff /  10 ^ (12 :: Int)
 
   when (obs < req) $ print (tS, tE, req, obs, diff, diff')
 





More information about the Cvs-libraries mailing list