diff options
Diffstat (limited to 'bittorrent/tests/Network/BitTorrent/Exchange/BlockSpec.hs')
-rw-r--r-- | bittorrent/tests/Network/BitTorrent/Exchange/BlockSpec.hs | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/bittorrent/tests/Network/BitTorrent/Exchange/BlockSpec.hs b/bittorrent/tests/Network/BitTorrent/Exchange/BlockSpec.hs deleted file mode 100644 index 2dc8e0b8..00000000 --- a/bittorrent/tests/Network/BitTorrent/Exchange/BlockSpec.hs +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | module Network.BitTorrent.Exchange.BlockSpec (spec) where | ||
2 | import Control.Applicative | ||
3 | import Control.Exception | ||
4 | import Data.Maybe | ||
5 | import Test.Hspec | ||
6 | import Test.QuickCheck | ||
7 | import Test.QuickCheck.Instances () | ||
8 | |||
9 | import Network.BitTorrent.Exchange.Block as Block | ||
10 | |||
11 | |||
12 | instance Arbitrary a => Arbitrary (Block a) where | ||
13 | arbitrary = Block <$> arbitrary <*> arbitrary <*> arbitrary | ||
14 | |||
15 | instance Arbitrary BlockIx where | ||
16 | arbitrary = BlockIx <$> arbitrary <*> arbitrary <*> arbitrary | ||
17 | |||
18 | instance Arbitrary Bucket where | ||
19 | arbitrary = do | ||
20 | s <- arbitrary `suchThat` (> 0) | ||
21 | chunks <- arbitrary | ||
22 | return $ Block.fromList s chunks | ||
23 | |||
24 | isSomeException :: SomeException -> Bool | ||
25 | isSomeException = const True | ||
26 | |||
27 | spec :: Spec | ||
28 | spec = do | ||
29 | describe "empty" $ do | ||
30 | it "should fail on bad size" $ do | ||
31 | evaluate (Block.empty (-1)) `shouldThrow` isSomeException | ||
32 | |||
33 | describe "toPiece" $ do | ||
34 | it "render to piece when it is full" $ property $ \ bkt -> | ||
35 | full bkt == isJust (toPiece bkt) \ No newline at end of file | ||