diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-08 07:19:31 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-08 07:19:31 +0400 |
commit | 7edacaaedd432c71169bbd59c9c0948e9a83da26 (patch) | |
tree | 1ca88d119c3575c502e184bfcc15572ee6a406f9 /tests/Network/BitTorrent/Tracker | |
parent | f1f28f1a128caa3df5cdab2eb4c22ec07633af06 (diff) |
Add multitracker session
Diffstat (limited to 'tests/Network/BitTorrent/Tracker')
-rw-r--r-- | tests/Network/BitTorrent/Tracker/CacheSpec.hs | 7 | ||||
-rw-r--r-- | tests/Network/BitTorrent/Tracker/SessionSpec.hs | 25 |
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/Network/BitTorrent/Tracker/CacheSpec.hs b/tests/Network/BitTorrent/Tracker/CacheSpec.hs new file mode 100644 index 00000000..db015957 --- /dev/null +++ b/tests/Network/BitTorrent/Tracker/CacheSpec.hs | |||
@@ -0,0 +1,7 @@ | |||
1 | module Network.BitTorrent.Tracker.CacheSpec (spec) where | ||
2 | import Test.Hspec | ||
3 | |||
4 | spec :: Spec | ||
5 | spec = do | ||
6 | describe "Cached" $ do | ||
7 | return () | ||
diff --git a/tests/Network/BitTorrent/Tracker/SessionSpec.hs b/tests/Network/BitTorrent/Tracker/SessionSpec.hs new file mode 100644 index 00000000..0c75fcaa --- /dev/null +++ b/tests/Network/BitTorrent/Tracker/SessionSpec.hs | |||
@@ -0,0 +1,25 @@ | |||
1 | module Network.BitTorrent.Tracker.SessionSpec (spec) where | ||
2 | import Data.Default | ||
3 | import Data.List as L | ||
4 | import Network.URI | ||
5 | import Test.Hspec | ||
6 | |||
7 | import Data.Torrent | ||
8 | import Network.BitTorrent.Tracker.List | ||
9 | import Network.BitTorrent.Tracker.RPC.UDPSpec (trackerURIs) | ||
10 | import Network.BitTorrent.Tracker.RPC | ||
11 | import Network.BitTorrent.Tracker.Session | ||
12 | |||
13 | |||
14 | trackers :: TrackerList URI | ||
15 | trackers = trackerList def { tAnnounceList = Just [trackerURIs] } | ||
16 | |||
17 | spec :: Spec | ||
18 | spec = do | ||
19 | describe "Session" $ do | ||
20 | it "" $ do | ||
21 | withManager def def $ \ m -> do | ||
22 | s <- newSession def trackers | ||
23 | notify m s Started | ||
24 | peers <- askPeers m s | ||
25 | peers `shouldSatisfy` (not . L.null) \ No newline at end of file | ||