File: Test.hs

package info (click to toggle)
haskell-bzlib 0.5.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 144 kB
  • sloc: haskell: 492; ansic: 13; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 773 bytes parent folder | download
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
{-# LANGUAGE CPP #-}

module Main where

import Codec.Compression.BZip.Internal

import Test.Codec.Compression.BZip.Internal ()
import Test.Codec.Compression.BZip.Stream ()

import Test.QuickCheck
import Test.Tasty
import Test.Tasty.QuickCheck
import Utils ()

import Control.Monad


main :: IO ()
main = defaultMain $
  testGroup "bzip tests" [
    testGroup "property tests" [
      testProperty "decompress . compress = id (standard)" prop_decompress_after_compress
    ]
  ]


prop_decompress_after_compress :: CompressParams
                               -> DecompressParams
                               -> Property
prop_decompress_after_compress cp dp =
  decompressBufferSize dp > 0 && compressBufferSize cp > 0 ==>
  liftM2 (==) (decompress dp . compress cp) id