summaryrefslogtreecommitdiff
path: root/tests/client.hs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/client.hs')
-rw-r--r--tests/client.hs39
1 files changed, 0 insertions, 39 deletions
diff --git a/tests/client.hs b/tests/client.hs
deleted file mode 100644
index bab11b11..00000000
--- a/tests/client.hs
+++ /dev/null
@@ -1,39 +0,0 @@
1module Main (main) where
2
3import System.Environment
4import Data.ByteString as B
5import Data.ByteString.Lazy as L
6import Data.BEncode
7
8import Data.Torrent
9import Network.Torrent.THP
10import Network.Torrent.PeerID
11
12showWarn :: TResponse -> IO ()
13showWarn resp
14 | Just msg <- respWarning resp = print msg
15 | otherwise = return ()
16
17main :: IO ()
18main = do
19 [path] <- getArgs
20 contents <- B.readFile path
21
22 let Right contents' = decode contents >>= return . L.toStrict . encode
23 print (contents' == contents)
24
25-- let (a, b) = showInfos contents
26-- print b
27-- print a
28-- print (encode b == encoded a)
29
30 let Right b = decode contents
31 let Right t = fromBEncode b
32
33 peerID <- newPeerID
34
35 let req = defaultRequest (tAnnounce t) (tInfoHash t) (peerID)
36 Right resp <- sendRequest req
37
38 print resp
39 showWarn resp