diff options
author | Sam T <sta.cs.vsu@gmail.com> | 2013-04-08 09:00:44 +0400 |
---|---|---|
committer | Sam T <sta.cs.vsu@gmail.com> | 2013-04-08 09:00:44 +0400 |
commit | d3ec73cde2ccf1ea3347463cf90eb89e460f1376 (patch) | |
tree | 5a649546a4ba2d49b6e202443ba7015c0bcdefc0 | |
parent | 1b38c3e4a9741da210b984eac6ffc073121a4940 (diff) |
- remove client test
-rw-r--r-- | network-bittorrent.cabal | 18 | ||||
-rw-r--r-- | tests/client.hs | 39 |
2 files changed, 0 insertions, 57 deletions
diff --git a/network-bittorrent.cabal b/network-bittorrent.cabal index facbf2f7..fa836e0a 100644 --- a/network-bittorrent.cabal +++ b/network-bittorrent.cabal | |||
@@ -57,24 +57,6 @@ library | |||
57 | -- ghc-options: -Wall | 57 | -- ghc-options: -Wall |
58 | 58 | ||
59 | 59 | ||
60 | executable client | ||
61 | main-is: client.hs | ||
62 | build-depends: base == 4.5.* | ||
63 | , bytestring >= 0.10.2.0 | ||
64 | , network >= 2.4.1.2 | ||
65 | , text | ||
66 | , cereal | ||
67 | , mtl | ||
68 | |||
69 | , bencoding >= 0.1.0.0 | ||
70 | , network-bittorrent >= 0.1.0.0 | ||
71 | |||
72 | |||
73 | hs-source-dirs: tests | ||
74 | ghc-options: -Wall -O2 | ||
75 | |||
76 | |||
77 | |||
78 | test-suite info-hash | 60 | test-suite info-hash |
79 | type: exitcode-stdio-1.0 | 61 | type: exitcode-stdio-1.0 |
80 | main-is: info-hash.hs | 62 | main-is: info-hash.hs |
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 @@ | |||
1 | module Main (main) where | ||
2 | |||
3 | import System.Environment | ||
4 | import Data.ByteString as B | ||
5 | import Data.ByteString.Lazy as L | ||
6 | import Data.BEncode | ||
7 | |||
8 | import Data.Torrent | ||
9 | import Network.Torrent.THP | ||
10 | import Network.Torrent.PeerID | ||
11 | |||
12 | showWarn :: TResponse -> IO () | ||
13 | showWarn resp | ||
14 | | Just msg <- respWarning resp = print msg | ||
15 | | otherwise = return () | ||
16 | |||
17 | main :: IO () | ||
18 | main = 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 | ||