Yet another fix...
authoriavor.diatchki <iavor.diatchki@gmail.com>
Sun, 9 Mar 2008 23:06:00 +0000 (16:06 -0700)
committeriavor.diatchki <iavor.diatchki@gmail.com>
Sun, 9 Mar 2008 23:06:00 +0000 (16:06 -0700)
darcs-hash:20080309230600-5035a-9e6d21f2ceb7a96bee0c6a2dab26467472148de2.gz

tests/BenchBytestring.hs

index 0fcea06..6e372f2 100644 (file)
@@ -22,17 +22,18 @@ main3 = do putStrLn "Speed: [Word8]"
            print (UTF8.length $ UTF8.fromRep bytes)
 
 main4 = do putStrLn "Correctness: Data.ByteString"
-           print (encodeDecodeTest enc)
+           print encodeDecodeTest
 
-encodeDecodeTest :: (Char -> String) -> String
-encodeDecodeTest =
-     filter (\x -> x `seq` [x] /= f x) legal_codepoints
-  ++ filter (\x -> [UTF8.replacement_char] /= f x) illegal_codepoints
+encodeDecodeTest :: String
+encodeDecodeTest =
+     filter (\x -> expect x x) legal_codepoints
+  ++ filter (expect (UTF8.replacement_char)) illegal_codepoints
   where
     legal_codepoints    = ['\0'..'\xd7ff'] ++ ['\xe000'..'\xfffd']
                        ++ ['\x10000'..'\x10ffff']
     illegal_codepoints  = '\xffff' : '\xfffe' : ['\xd800'..'\xdfff']
 
-enc x = UTF8.toString (UTF8.fromString [x] :: UTF8.UTF8 S.ByteString)
+    expect y x = UTF8.toString (UTF8.fromString [x] :: UTF8.UTF8 S.ByteString)
+                  /= [y]