summaryrefslogtreecommitdiff
path: root/tests/Data/Torrent/ClientSpec.hs
blob: 4bc881c319f9a8bd7d53e1f2a958c8d7f4959774 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
-- | see <http://bittorrent.org/beps/bep_0020.html>
module Data.Torrent.ClientSpec (spec) where
import Test.Hspec
import Network.BitTorrent.Core.PeerId

spec :: Spec
spec = do
  describe "client info" $ do
    it "decode mainline encoded peer id" $ do
      clientInfo "M4-3-6--xxxxxxxxxxxx" `shouldBe` "Mainline-4.3.6"
      clientInfo "M4-20-8-xxxxxxxxxxxx" `shouldBe` "Mainline-4.20.8"

    it "decode azureus encoded peer id" $ do
      clientInfo "-AZ2060-xxxxxxxxxxxx" `shouldBe` "Azureus-2060"
      clientInfo "-BS0000-xxxxxxxxxxxx" `shouldBe` "BTSlave-0"

    it "decode Shad0w style peer id" $ do
      clientInfo "S58B-----xxxxxxxxxxx" `shouldBe` "Shadow-5.8.11"
      clientInfo "T58B-----xxxxxxxxxxx" `shouldBe` "BitTornado-5.8.11"

    it "decode bitcomet style peer id" $ do
      clientInfo "exbc01xxxxxxxxxxxxxx" `shouldBe` "BitComet-48.49"
      clientInfo "FUTB01xxxxxxxxxxxxxx" `shouldBe` "BitComet-48.49"
      clientInfo "exbc01LORDxxxxxxxxxx" `shouldBe` "BitLord-48.49"

    it "decode opera style peer id" $ do
      clientInfo "OP0123xxxxxxxxxxxxxx" `shouldBe` "Opera-123"

    it "decode ML donkey style peer id" $ do
      clientInfo "-ML2.7.2-xxxxxxxxxxx" `shouldBe` "MLdonkey-0"

-- TODO XBT, Bits on Wheels, Queen Bee, BitTyrant, TorrenTopia,
-- BitSpirit, Rufus, G3 Torrent, FlashGet