]> git.rkrishnan.org Git - functorrent.git/commitdiff
Switch to known torrent file
authorJaseem Abid <jaseemabid@gmail.com>
Sat, 11 Apr 2015 11:05:07 +0000 (16:35 +0530)
committerJaseem Abid <jaseemabid@gmail.com>
Sat, 11 Apr 2015 11:05:07 +0000 (16:35 +0530)
data/hello.txt [new file with mode: 0644]
data/hello.txt.cache [new file with mode: 0644]
data/hello.txt.torrent [new file with mode: 0644]
data/moby_dick.txt.torrent [deleted file]
test/Test.hs

diff --git a/data/hello.txt b/data/hello.txt
new file mode 100644 (file)
index 0000000..3b18e51
--- /dev/null
@@ -0,0 +1 @@
+hello world
diff --git a/data/hello.txt.cache b/data/hello.txt.cache
new file mode 100644 (file)
index 0000000..8b51ab7
--- /dev/null
@@ -0,0 +1 @@
+d8:completei0e10:incompletei0e8:intervali130e12:min intervali130e5:peers0:e
diff --git a/data/hello.txt.torrent b/data/hello.txt.torrent
new file mode 100644 (file)
index 0000000..f9c4bdd
--- /dev/null
@@ -0,0 +1 @@
+d8:announce32:http://9.rarbg.com:2710/announce7:comment11:hello world10:created by11:Jaseem Abid13:creation datei1428717851e8:encoding5:UTF-84:infod6:lengthi12e4:name9:hello.txt12:piece lengthi32768e6:pieces20:"Ycc³Þ@°o\98\1f¸]\821.\8c\ eÕ\117:privatei0eee
\ No newline at end of file
diff --git a/data/moby_dick.txt.torrent b/data/moby_dick.txt.torrent
deleted file mode 100644 (file)
index b4b78fe..0000000
+++ /dev/null
@@ -1 +0,0 @@
-d8:announce36:http://carrot.cs.swarthmore.edu:696910:created by26:Enhanced-CTorrent/dnh3.3.213:creation datei1352142460e4:infod6:lengthi31690e4:name13:moby_dick.txt12:piece lengthi262144e6:pieces20:\bWĨg²Æ=\9cÌÝMòÏ\11\9f\17~ñHee
\ No newline at end of file
index 0f93e8ace0c2a81625fdd17d80f06ccc14980523..8a4649edf86e49706ccca529a74f5e4eee1b197e 100644 (file)
@@ -16,35 +16,38 @@ import FuncTorrent.Tracker (TrackerResponse(..), peers, mkTrackerResponse)
 -- Parsed .torrent file
 file :: BVal
 file = Bdict (fromList [
-               ("announce", Bstr "http://carrot.cs.swarthmore.edu:6969"),
-               ("created by", Bstr "Enhanced-CTorrent/dnh3.3.2"),
-               ("creation date", Bint 1352142460),
-               ("info", Bdict (fromList [
-                                ("length", Bint 31690),
-                                ("name", Bstr "moby_dick.txt"),
-                                ("piece length", Bint 262144),
-                                ("pieces", Bstr "\bW\196\168g\178\198=\156\204\221M\242\207\DC1\159\ETB~\241H")]))])
+               ("announce",Bstr "http://9.rarbg.com:2710/announce"),
+               ("comment",Bstr "hello world"),
+               ("created by",Bstr "Jaseem Abid"),
+               ("creation date",Bint 1428717851),
+               ("encoding",Bstr "UTF-8"),
+               ("info",Bdict (fromList [
+                               ("length",Bint 12),
+                               ("name",Bstr "hello.txt"),
+                               ("piece length",Bint 32768),
+                               ("pieces",Bstr "\"Ycc\179\222@\176o\152\US\184]\130\&1.\140\SO\213\DC1"),
+                               ("private",Bint 0)]))])
 
-moby :: Metainfo
-moby = Metainfo {
-         info = Info {
-           pieceLength = 262144,
-           pieces = "\bW\196\168g\178\198=\156\204\221M\242\207\DC1\159\ETB~\241H",
-           private = Nothing,
-           name = "moby_dick.txt",
-           lengthInBytes = 31690,
-           md5sum = Nothing
-         },
-         announceList = ["http://carrot.cs.swarthmore.edu:6969"],
-         creationDate = Nothing,
-         comment = Nothing,
-         createdBy = Just "Enhanced-CTorrent/dnh3.3.2",
-         encoding = Nothing
-       }
+hello :: Metainfo
+hello = Metainfo {
+          info = Info {
+            pieceLength = 32768,
+            pieces = "\"Ycc\179\222@\176o\152\US\184]\130\&1.\140\SO\213\DC1",
+            private = Nothing,
+            name = "hello.txt",
+            lengthInBytes = 12,
+            md5sum = Nothing
+          },
+          announceList = ["http://9.rarbg.com:2710/announce"],
+          creationDate = Nothing,
+          comment = Just "hello world",
+          createdBy = Just "Jaseem Abid",
+          encoding = Just "UTF-8"
+        }
 
 testFile :: TestTree
 testFile = testCase "Should parse valid torrent files" $ do
-               str <- readFile "./data/moby_dick.txt.torrent"
+               str <- readFile "./data/hello.txt.torrent"
                case decode str of
                  Right expected -> expected @?= file
                  Left _ -> error "Failed parsing test file"
@@ -52,12 +55,11 @@ testFile = testCase "Should parse valid torrent files" $ do
 
 testMkMetaInfo :: TestTree
 testMkMetaInfo = testCase "Should mkInfo valid torrent files" $ do
-                   str <- readFile "./data/moby_dick.txt.torrent"
+                   str <- readFile "./data/hello.txt.torrent"
                    case decode str of
-                     Right expected -> mkMetaInfo expected @?= Just moby
+                     Right expected -> mkMetaInfo expected @?= Just hello
                      Left _ -> error "Failed parsing test file"
 
-
 testResponse1 :: TestTree
 testResponse1 = testCase "Should parse valid tracker response" $ do
                   str <- readFile "./data/debian-7.8.0-amd64-CD-1.iso.cache"