summaryrefslogtreecommitdiff
path: root/tests/client.hs
diff options
context:
space:
mode:
authorSam T <sta.cs.vsu@gmail.com>2013-04-03 01:13:59 +0400
committerSam T <sta.cs.vsu@gmail.com>2013-04-03 01:13:59 +0400
commit0ccce42b773783341765ef751ea6d962f70d593c (patch)
tree6a1e6418edf964c123372e52f03896dda471e26f /tests/client.hs
parent8f5985915ece236a29fcb340e1e0ef731e3214e9 (diff)
+ tests
Diffstat (limited to 'tests/client.hs')
-rw-r--r--tests/client.hs27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/client.hs b/tests/client.hs
new file mode 100644
index 00000000..5697d18a
--- /dev/null
+++ b/tests/client.hs
@@ -0,0 +1,27 @@
1module Main (main) where
2
3import Data.Torrent
4import Network.Torrent.THP
5import System.Environment
6import Data.ByteString as B
7import Data.ByteString.Lazy as L
8import Data.BEncode
9
10main :: IO ()
11main = do
12 [path] <- getArgs
13 contents <- B.readFile path
14
15 let Right contents' = decode contents >>= return . L.toStrict . encode
16 print (contents' == contents)
17-- let (a, b) = showInfos contents
18-- print b
19-- print a
20-- print (encode b == encoded a)
21
22 let Right b = decode contents
23 let Right t = fromBEncode b
24
25 let req = defaultRequest (tAnnounce t) (tInfoHash t)
26 resp <- sendRequest req
27 print resp