import Data.ByteString (ByteString, readFile)
import Data.Map.Strict (fromList)
-import Test.Tasty
-import Test.Tasty.HUnit
+import Test.Tasty (TestTree, testGroup, defaultMain)
+import Test.Tasty.HUnit (testCase, (@?=))
-import FuncTorrent.Bencode (decode, BVal(..))
+import FuncTorrent.Bencode (encode, decode, BVal(..))
import FuncTorrent.Metainfo (Info(..), Metainfo(..), mkMetaInfo)
import FuncTorrent.Peer (Peer(..))
import FuncTorrent.Tracker
+import qualified BencodeTests
+
-- Parsed .torrent file
file :: BVal
file = Bdict (fromList [
lengthInBytes = 12,
md5sum = Nothing
},
- infoHash = "\249\SYN\145=\129\182\205\\\181v0\144\154\EM\150f\152\221]}",
announceList = ["http://9.rarbg.com:2710/announce"],
creationDate = Just 1428717851,
comment = Just "hello world",
createdBy = Just "Jaseem Abid",
- encoding = Just "UTF-8"
+ encoding = Just "UTF-8",
+ infoHash = "\205CX(;\163<?TWS\175\CAND\222\253\250\214\136\EOT"
}
testFile :: TestTree
testResponse2]
tests :: TestTree
-tests = testGroup "Tests" [unitTests]
+tests = testGroup "Tests" [unitTests, BencodeTests.tests]
main :: IO ()
main = defaultMain tests