From 54c316329d2eac3f31577b28d18433decfd84a7f Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Wed, 26 Jul 2017 19:07:21 +0530
Subject: [PATCH] metainfotest: add a piecelength test

---
 test/MetainfoTests.hs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/test/MetainfoTests.hs b/test/MetainfoTests.hs
index 727de50..f27486f 100644
--- a/test/MetainfoTests.hs
+++ b/test/MetainfoTests.hs
@@ -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)
 
-- 
2.45.2