From f1d79ea2180e46545f442985a85e5bb1cce90436 Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Sun, 5 Jan 2014 20:19:01 +0400 Subject: Check size of last piece properly (in writePiece) --- tests/System/Torrent/StorageSpec.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tests/System') diff --git a/tests/System/Torrent/StorageSpec.hs b/tests/System/Torrent/StorageSpec.hs index d2185961..2e94ccf1 100644 --- a/tests/System/Torrent/StorageSpec.hs +++ b/tests/System/Torrent/StorageSpec.hs @@ -52,8 +52,12 @@ spec = before createLayout $ do it "should fail on out of upper bound index" $ do withStorage ReadWrite 100 layout $ \ s -> do let bs = BL.replicate 100 0 - writePiece (Piece 1 bs) s - writePiece (Piece 2 bs) s `shouldThrow` (== InvalidIndex 2) + writePiece (Piece 0 bs) s + + let bs' = BL.replicate 75 0 + writePiece (Piece 1 bs') s + + writePiece (Piece 2 bs') s `shouldThrow` (== InvalidIndex 2) describe "readPiece" $ do it "should fail on negative index" $ -- cgit v1.2.3