blob: f43014521b6942d8e23a9969a060de303acd24d4 (
plain)
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
|
module Network.BitTorrent.Exchange.BlockSpec (spec) where
import Control.Applicative
import Data.Maybe
import Test.Hspec
import Test.QuickCheck
import Network.BitTorrent.Exchange.Block
instance Arbitrary a => Arbitrary (Block a) where
arbitrary = Block <$> arbitrary <*> arbitrary <*> arbitrary
instance Arbitrary BlockIx where
arbitrary = BlockIx <$> arbitrary <*> arbitrary <*> arbitrary
instance Arbitrary Bucket where
arbitrary = error "arbitrary: block bucket"
instance Show Bucket where
show = error "show: bucket"
spec :: Spec
spec = do
describe "bucket" $ do
it "render to piece when it is full" $ property $ \ bkt ->
full bkt == isJust (toPiece bkt)
|