File: Internal.hs

package info (click to toggle)
haskell-zlib 0.6.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,300 kB
  • sloc: ansic: 7,058; haskell: 1,081; makefile: 6
file content (32 lines) | stat: -rw-r--r-- 1,201 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{-# OPTIONS_GHC -fno-warn-orphans #-}

-- | Test code and properties for "Codec.Compression.Zlib.Internal"
--
module Test.Codec.Compression.Zlib.Internal where

import Codec.Compression.Zlib.Internal
import Test.Codec.Compression.Zlib.Stream ()
import Test.QuickCheck

import Control.Monad (ap)


instance Arbitrary CompressParams where
  arbitrary = return CompressParams `ap` arbitrary `ap` arbitrary
                                    `ap` arbitrary `ap` arbitrary
                                    `ap` arbitrary `ap` arbitraryBufferSize
                                    `ap` return Nothing

arbitraryBufferSize :: Gen Int
arbitraryBufferSize = frequency $ [(10, return n) | n <- [1..1024]] ++
                                  [(20, return n) | n <- [1025..8192]] ++
                                  [(40, return n) | n <- [8193..131072]] ++
                                  [(1, return n) | n <- [131072..1048576]]


instance Arbitrary DecompressParams where
  arbitrary = return DecompressParams `ap` arbitrary
                                      `ap` arbitraryBufferSize
                                      `ap` return Nothing
                                      `ap` arbitrary