Allow to build zlib and lzma statically
This should fix issues on Darwin.
This commit is contained in:
28
3rdparty/zlib/test/Utils.hs
vendored
Normal file
28
3rdparty/zlib/test/Utils.hs
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
module Utils where
|
||||
|
||||
import qualified Data.ByteString.Lazy as BL
|
||||
import qualified Data.ByteString as BS
|
||||
|
||||
import Test.QuickCheck
|
||||
|
||||
-------------------
|
||||
-- QuickCheck Utils
|
||||
|
||||
maxStrSize :: Double
|
||||
maxStrSize = 500
|
||||
|
||||
-- convert a QC size parameter into one for generating long lists,
|
||||
-- growing inverse exponentially up to maxStrSize
|
||||
strSize :: Int -> Int
|
||||
strSize n = floor (maxStrSize * (1 - 2 ** (-fromIntegral n/100)))
|
||||
|
||||
instance Arbitrary BL.ByteString where
|
||||
arbitrary = sized $ \sz -> fmap BL.fromChunks $ listOf $ resize (sz `div` 2) arbitrary
|
||||
shrink = map BL.pack . shrink . BL.unpack
|
||||
|
||||
instance Arbitrary BS.ByteString where
|
||||
arbitrary = sized $ \sz -> resize (strSize sz) $ fmap BS.pack $ listOf $ arbitrary
|
||||
shrink = map BS.pack . shrink . BS.unpack
|
||||
|
||||
|
||||
Reference in New Issue
Block a user