diff options
Diffstat (limited to 'tests/Network')
-rw-r--r-- | tests/Network/BitTorrent/Core/FingerprintSpec.hs | 33 |
1 files changed, 33 insertions, 0 deletions
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 | ||