diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-26 15:33:05 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2014-02-26 15:33:05 +0400 |
commit | eb54b4d99fa8683084ced2e8b16ae18b819a35df (patch) | |
tree | 750c77d78fdf06320f93e68c506dc4e436daaaf2 /tests/Network/BitTorrent/Tracker/TestData.hs | |
parent | a92c7e63331614afba13e0d8e43791e0f440f2fc (diff) |
Use TestData in tracker spec
Diffstat (limited to 'tests/Network/BitTorrent/Tracker/TestData.hs')
-rw-r--r-- | tests/Network/BitTorrent/Tracker/TestData.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/Network/BitTorrent/Tracker/TestData.hs b/tests/Network/BitTorrent/Tracker/TestData.hs index 5d9718e5..85544b91 100644 --- a/tests/Network/BitTorrent/Tracker/TestData.hs +++ b/tests/Network/BitTorrent/Tracker/TestData.hs | |||
@@ -1,6 +1,9 @@ | |||
1 | {-# LANGUAGE RecordWildCards #-} | ||
1 | {-# OPTIONS_GHC -fno-warn-orphans #-} | 2 | {-# OPTIONS_GHC -fno-warn-orphans #-} |
2 | module Network.BitTorrent.Tracker.TestData | 3 | module Network.BitTorrent.Tracker.TestData |
3 | ( TrackerEntry (..) | 4 | ( TrackerEntry (..) |
5 | , isUdpTracker | ||
6 | , isHttpTracker | ||
4 | , trackers | 7 | , trackers |
5 | ) where | 8 | ) where |
6 | 9 | ||
@@ -29,6 +32,13 @@ data TrackerEntry = TrackerEntry | |||
29 | , hashList :: Maybe [InfoHash] | 32 | , hashList :: Maybe [InfoHash] |
30 | } | 33 | } |
31 | 34 | ||
35 | isUdpTracker :: TrackerEntry -> Bool | ||
36 | isUdpTracker TrackerEntry {..} = uriScheme trackerURI == "udp:" | ||
37 | |||
38 | isHttpTracker :: TrackerEntry -> Bool | ||
39 | isHttpTracker TrackerEntry {..} = uriScheme trackerURI == "http:" | ||
40 | || uriScheme trackerURI == "https:" | ||
41 | |||
32 | instance IsString URI where | 42 | instance IsString URI where |
33 | fromString str = fromMaybe err $ parseURI str | 43 | fromString str = fromMaybe err $ parseURI str |
34 | where | 44 | where |