summaryrefslogtreecommitdiff
path: root/tests/System
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2014-01-05 20:19:01 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2014-01-05 20:19:01 +0400
commitf1d79ea2180e46545f442985a85e5bb1cce90436 (patch)
tree1fc753798ee3fc228c60b94c286a337b4972eed9 /tests/System
parent3eaa3003d9ece714595dffbf07202ee90336d05f (diff)
Check size of last piece properly (in writePiece)
Diffstat (limited to 'tests/System')
-rw-r--r--tests/System/Torrent/StorageSpec.hs8
1 files changed, 6 insertions, 2 deletions
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
52 it "should fail on out of upper bound index" $ do 52 it "should fail on out of upper bound index" $ do
53 withStorage ReadWrite 100 layout $ \ s -> do 53 withStorage ReadWrite 100 layout $ \ s -> do
54 let bs = BL.replicate 100 0 54 let bs = BL.replicate 100 0
55 writePiece (Piece 1 bs) s 55 writePiece (Piece 0 bs) s
56 writePiece (Piece 2 bs) s `shouldThrow` (== InvalidIndex 2) 56
57 let bs' = BL.replicate 75 0
58 writePiece (Piece 1 bs') s
59
60 writePiece (Piece 2 bs') s `shouldThrow` (== InvalidIndex 2)
57 61
58 describe "readPiece" $ do 62 describe "readPiece" $ do
59 it "should fail on negative index" $ 63 it "should fail on negative index" $