]> git.rkrishnan.org Git - functorrent.git/commitdiff
metainfotest: add a piecelength test
authorRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Wed, 26 Jul 2017 13:37:21 +0000 (19:07 +0530)
committerRamakrishnan Muthukrishnan <ram@rkrishnan.org>
Wed, 26 Jul 2017 13:37:21 +0000 (19:07 +0530)
test/MetainfoTests.hs

index 727de500e705981e0bb3c6acbd9c972a88def022..f27486f7efa6ce5b86c6d779c56aa229be365d06 100644 (file)
@@ -19,5 +19,12 @@ tests = hspec $ do
       case torrentToMetainfo fc of
         Left _ -> pending
         Right metainfo -> do
-            announceList metainfo `shouldSatisfy` (not . null)
+          announceList metainfo `shouldSatisfy` (not . null)
+    it "valid piece length" $ do
+      fc <- readFile "data/debian-7.8.0-amd64-CD-1.iso.torrent"
+      case torrentToMetainfo fc of
+        Left _ -> pending
+        Right metainfo -> do
+          let (Just info') = info metainfo
+          pieceLength info' `shouldBe` (524288 :: Integer)