on master help sign in
tests: remove unused imports, fix some lints
commit7763587d6c94c45d33a8b178462bbe2462db5201 authorLennart Kolmodin <kolmodin@gmail.com> dateSat 30 Mar 2013, 23:53 (14 years ago) parent50e2ce0
1 file changed+7−12
BitsQC.hs+7−12
BitsQC.hs+7−12
@@ -1,14 +1,11 @@
11{-# LANGUAGE CPP, FlexibleInstances, FlexibleContexts, TupleSections #-}
22
3−module Main where
3+module Main ( main ) where
44
5−import Data.Binary ( encode, Binary(..) )
5+import Data.Binary ( Binary(..) )
66import Data.Binary.Get ( runGet, runGetIncremental, pushChunks, Decoder(..) )
77import Data.Binary.Put ( runPut )
88
9−import qualified Data.Binary.Get as BG ( getWord8, getWord16be, getWord32be, getWord64be )
10−import qualified Data.Binary.Put as BP ( putWord8, putWord16be, putWord32be, putWord64be )
11−
129import Data.Binary.Bits
1310import Data.Binary.Bits.Get
1411import Data.Binary.Bits.Put
@@ -18,18 +15,16 @@ import qualified Data.ByteString.Lazy as L
1815
1916import Control.Applicative
2017import Data.Bits
21−import Data.Monoid
2218import Data.Word
2319import Foreign.Storable
2420import System.Random
2521
26−import Test.Framework.Options ( TestOptions'(..) )
2722import Test.Framework.Providers.QuickCheck2 ( testProperty )
2823import Test.Framework.Runners.Console ( defaultMain )
29−import Test.Framework.Runners.Options ( RunnerOptions'(..) )
3024import Test.Framework ( Test, testGroup )
3125import Test.QuickCheck
3226
27+main :: IO ()
3328main = defaultMain tests
3429
3530tests :: [Test]
@@ -130,7 +125,7 @@ prop_putget_with_bitreq (W w) = property $
130125prop_putget_list_simple :: (BinaryBit a, Eq a, Storable a) => W [a] -> Property
131126prop_putget_list_simple (W ws) = property $
132127 let s = sizeOf (head ws) * 8
133− p = mapM_ (\v -> putBits s v) ws
128+ p = mapM_ (putBits s) ws
134129 g = mapM (const (getBits s)) ws
135130 lbs = runPut (runBitPut p)
136131 ws' = runGet (runBitGet g) lbs
@@ -187,7 +182,7 @@ prop_bitget_with_put_from_binary (W ws) = property $
187182prop_bitget_bytestring_interspersed :: (BinaryBit a, Binary a, Num a, Ord a, Bits a) => W a -> [B.ByteString] -> Property
188183prop_bitget_bytestring_interspersed (W ws) bss = property $
189184 let p = mapM_ (\bs -> putBits (bitreq ws) ws >> putByteString bs) bss
190− g = mapM (\bs -> (,) <$> (getBits (bitreq ws)) <*> (getByteString (B.length bs))) bss
185+ g = mapM (\bs -> (,) <$> getBits (bitreq ws) <*> getByteString (B.length bs)) bss
191186 lbs = runPut (runBitPut p)
192187 r = runGet (runBitGet g) lbs
193188 in map (ws,) bss == r
@@ -221,7 +216,7 @@ bittable = [ (fromIntegral x, (1 `shiftL` x) - 1) | x <- [1..64] ]
221216prop_bitreq :: W Word64 -> Property
222217prop_bitreq (W w) = property $
223218 ( w == 0 && bitreq w == 1 )
224− || bitreq w == (bitreq (w `shiftR` 1)) + 1
219+ || bitreq w == bitreq (w `shiftR` 1) + 1
225220
226221prop_composite_case :: Bool -> W Word16 -> Property
227222prop_composite_case b (W w) = w < 0x8000 ==>
@@ -255,7 +250,7 @@ prop_compare_get_with_naive (W ws) = property $
255250 rn = runGet (runBitGet gn) lbs
256251 r = runGet (runBitGet g ) lbs
257252 -- we must help our compiler to resolve the types of 'gn' and 'g'
258− types = rn == ws && r == ws
253+ _types = rn == ws && r == ws
259254 in rn == r
260255
261256-- | Write one bit at a time until the full word has been written