Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/14619423995f69a76061b5f84025188ca2fedd03

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

commit 14619423995f69a76061b5f84025188ca2fedd03
Author: Johan Tibell <johan.tib...@gmail.com>
Date:   Tue Aug 30 18:42:32 2011 +0200

    Fix incorrect test

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

 tests/codeGen/should_run/cgrun071.hs     |   22 ++++++++++++++--------
 tests/codeGen/should_run/cgrun071.stdout |   10 +++++-----
 2 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/tests/codeGen/should_run/cgrun071.hs 
b/tests/codeGen/should_run/cgrun071.hs
index 64631b8..291a141 100644
--- a/tests/codeGen/should_run/cgrun071.hs
+++ b/tests/codeGen/should_run/cgrun071.hs
@@ -20,14 +20,14 @@ main = putStr
 popcnt :: Word -> Word
 popcnt (W# w#) = W# (popCnt# w#)
 
-popcnt8 :: Word8 -> Word
-popcnt8 (W8# w#) = W# (popCnt8# w#)
+popcnt8 :: Word -> Word
+popcnt8 (W# w#) = W# (popCnt8# w#)
 
-popcnt16 :: Word16 -> Word
-popcnt16 (W16# w#) = W# (popCnt16# w#)
+popcnt16 :: Word -> Word
+popcnt16 (W# w#) = W# (popCnt16# w#)
 
-popcnt32 :: Word32 -> Word
-popcnt32 (W32# w#) = W# (popCnt32# w#)
+popcnt32 :: Word -> Word
+popcnt32 (W# w#) = W# (popCnt32# w#)
 
 popcnt64 :: Word64 -> Word
 popcnt64 (W64# w#) =
@@ -51,11 +51,17 @@ test_popCnt16 = test popcnt16 (slowPopcnt . fromIntegral . 
(mask 16 .&.))
 test_popCnt32 = test popcnt32 (slowPopcnt . fromIntegral . (mask 32 .&.))
 test_popCnt64 = test popcnt64 (slowPopcnt . fromIntegral . (mask 64 .&.))
 
-mask n = (2 `shiftL` n) - 1
+mask n = (2 ^ n) - 1
 
 test :: Num a => (a -> Word) -> (a -> Word) -> String
-test slow fast = show $ expected == actual
+test fast slow = case failing of
+    [] -> "OK"
+    ((_, e, a, i):xs) ->
+        "FAIL\n" ++ "   Input: " ++ show i ++ "\nExpected: " ++ show e ++
+        "\n  Actual: " ++ show a
   where
+    failing = dropWhile ( \(b,_,_,_) -> b)
+              . map (\ x -> (slow x == fast x, slow x, fast x, x)) $ cases
     expected = map slow cases
     actual = map fast cases
     -- 10 random numbers
diff --git a/tests/codeGen/should_run/cgrun071.stdout 
b/tests/codeGen/should_run/cgrun071.stdout
index e946ef1..e22e2cd 100644
--- a/tests/codeGen/should_run/cgrun071.stdout
+++ b/tests/codeGen/should_run/cgrun071.stdout
@@ -1,6 +1,6 @@
-True
-True
-True
-True
-True
+OK
+OK
+OK
+OK
+OK
 



_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to