diff options
author | Sam Truzjan <pxqr.sta@gmail.com> | 2013-12-05 04:58:26 +0400 |
---|---|---|
committer | Sam Truzjan <pxqr.sta@gmail.com> | 2013-12-05 04:58:26 +0400 |
commit | fda80933f98f6998ac872ab617026ecf06e4768c (patch) | |
tree | 60da38644cd3ce07884db666af1d8f105986a927 /tests | |
parent | 3399beaf2f38d19ed615655f865f3bc8b0cb9309 (diff) |
Rename ClientInfo datatype to Fingerprint
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Data/Torrent/ClientSpec.hs | 33 | ||||
-rw-r--r-- | tests/Network/BitTorrent/Core/FingerprintSpec.hs | 33 |
2 files changed, 33 insertions, 33 deletions
diff --git a/tests/Data/Torrent/ClientSpec.hs b/tests/Data/Torrent/ClientSpec.hs deleted file mode 100644 index 4bc881c3..00000000 --- a/tests/Data/Torrent/ClientSpec.hs +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | -- | see <http://bittorrent.org/beps/bep_0020.html> | ||
2 | module Data.Torrent.ClientSpec (spec) where | ||
3 | import Test.Hspec | ||
4 | import Network.BitTorrent.Core.PeerId | ||
5 | |||
6 | spec :: Spec | ||
7 | spec = do | ||
8 | describe "client info" $ do | ||
9 | it "decode mainline encoded peer id" $ do | ||
10 | clientInfo "M4-3-6--xxxxxxxxxxxx" `shouldBe` "Mainline-4.3.6" | ||
11 | clientInfo "M4-20-8-xxxxxxxxxxxx" `shouldBe` "Mainline-4.20.8" | ||
12 | |||
13 | it "decode azureus encoded peer id" $ do | ||
14 | clientInfo "-AZ2060-xxxxxxxxxxxx" `shouldBe` "Azureus-2060" | ||
15 | clientInfo "-BS0000-xxxxxxxxxxxx" `shouldBe` "BTSlave-0" | ||
16 | |||
17 | it "decode Shad0w style peer id" $ do | ||
18 | clientInfo "S58B-----xxxxxxxxxxx" `shouldBe` "Shadow-5.8.11" | ||
19 | clientInfo "T58B-----xxxxxxxxxxx" `shouldBe` "BitTornado-5.8.11" | ||
20 | |||
21 | it "decode bitcomet style peer id" $ do | ||
22 | clientInfo "exbc01xxxxxxxxxxxxxx" `shouldBe` "BitComet-48.49" | ||
23 | clientInfo "FUTB01xxxxxxxxxxxxxx" `shouldBe` "BitComet-48.49" | ||
24 | clientInfo "exbc01LORDxxxxxxxxxx" `shouldBe` "BitLord-48.49" | ||
25 | |||
26 | it "decode opera style peer id" $ do | ||
27 | clientInfo "OP0123xxxxxxxxxxxxxx" `shouldBe` "Opera-123" | ||
28 | |||
29 | it "decode ML donkey style peer id" $ do | ||
30 | clientInfo "-ML2.7.2-xxxxxxxxxxx" `shouldBe` "MLdonkey-0" | ||
31 | |||
32 | -- TODO XBT, Bits on Wheels, Queen Bee, BitTyrant, TorrenTopia, | ||
33 | -- BitSpirit, Rufus, G3 Torrent, FlashGet \ No newline at end of file | ||
diff --git a/tests/Network/BitTorrent/Core/FingerprintSpec.hs b/tests/Network/BitTorrent/Core/FingerprintSpec.hs new file mode 100644 index 00000000..df62442a --- /dev/null +++ b/tests/Network/BitTorrent/Core/FingerprintSpec.hs | |||
@@ -0,0 +1,33 @@ | |||
1 | -- | see <http://bittorrent.org/beps/bep_0020.html> | ||
2 | module Network.BitTorrent.Core.FingerprintSpec (spec) where | ||
3 | import Test.Hspec | ||
4 | import Network.BitTorrent.Core.PeerId | ||
5 | |||
6 | spec :: Spec | ||
7 | spec = do | ||
8 | describe "client info" $ do | ||
9 | it "decode mainline encoded peer id" $ do | ||
10 | fingerprint "M4-3-6--xxxxxxxxxxxx" `shouldBe` "Mainline-4.3.6" | ||
11 | fingerprint "M4-20-8-xxxxxxxxxxxx" `shouldBe` "Mainline-4.20.8" | ||
12 | |||
13 | it "decode azureus encoded peer id" $ do | ||
14 | fingerprint "-AZ2060-xxxxxxxxxxxx" `shouldBe` "Azureus-2060" | ||
15 | fingerprint "-BS0000-xxxxxxxxxxxx" `shouldBe` "BTSlave-0" | ||
16 | |||
17 | it "decode Shad0w style peer id" $ do | ||
18 | fingerprint "S58B-----xxxxxxxxxxx" `shouldBe` "Shadow-5.8.11" | ||
19 | fingerprint "T58B-----xxxxxxxxxxx" `shouldBe` "BitTornado-5.8.11" | ||
20 | |||
21 | it "decode bitcomet style peer id" $ do | ||
22 | fingerprint "exbc01xxxxxxxxxxxxxx" `shouldBe` "BitComet-48.49" | ||
23 | fingerprint "FUTB01xxxxxxxxxxxxxx" `shouldBe` "BitComet-48.49" | ||
24 | fingerprint "exbc01LORDxxxxxxxxxx" `shouldBe` "BitLord-48.49" | ||
25 | |||
26 | it "decode opera style peer id" $ do | ||
27 | fingerprint "OP0123xxxxxxxxxxxxxx" `shouldBe` "Opera-123" | ||
28 | |||
29 | it "decode ML donkey style peer id" $ do | ||
30 | fingerprint "-ML2.7.2-xxxxxxxxxxx" `shouldBe` "MLdonkey-0" | ||
31 | |||
32 | -- TODO XBT, Bits on Wheels, Queen Bee, BitTyrant, TorrenTopia, | ||
33 | -- BitSpirit, Rufus, G3 Torrent, FlashGet \ No newline at end of file | ||