From fda80933f98f6998ac872ab617026ecf06e4768c Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Thu, 5 Dec 2013 04:58:26 +0400 Subject: Rename ClientInfo datatype to Fingerprint --- tests/Network/BitTorrent/Core/FingerprintSpec.hs | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/Network/BitTorrent/Core/FingerprintSpec.hs (limited to 'tests/Network') 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 @@ +-- | see +module Network.BitTorrent.Core.FingerprintSpec (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 + fingerprint "M4-3-6--xxxxxxxxxxxx" `shouldBe` "Mainline-4.3.6" + fingerprint "M4-20-8-xxxxxxxxxxxx" `shouldBe` "Mainline-4.20.8" + + it "decode azureus encoded peer id" $ do + fingerprint "-AZ2060-xxxxxxxxxxxx" `shouldBe` "Azureus-2060" + fingerprint "-BS0000-xxxxxxxxxxxx" `shouldBe` "BTSlave-0" + + it "decode Shad0w style peer id" $ do + fingerprint "S58B-----xxxxxxxxxxx" `shouldBe` "Shadow-5.8.11" + fingerprint "T58B-----xxxxxxxxxxx" `shouldBe` "BitTornado-5.8.11" + + it "decode bitcomet style peer id" $ do + fingerprint "exbc01xxxxxxxxxxxxxx" `shouldBe` "BitComet-48.49" + fingerprint "FUTB01xxxxxxxxxxxxxx" `shouldBe` "BitComet-48.49" + fingerprint "exbc01LORDxxxxxxxxxx" `shouldBe` "BitLord-48.49" + + it "decode opera style peer id" $ do + fingerprint "OP0123xxxxxxxxxxxxxx" `shouldBe` "Opera-123" + + it "decode ML donkey style peer id" $ do + fingerprint "-ML2.7.2-xxxxxxxxxxx" `shouldBe` "MLdonkey-0" + +-- TODO XBT, Bits on Wheels, Queen Bee, BitTyrant, TorrenTopia, +-- BitSpirit, Rufus, G3 Torrent, FlashGet \ No newline at end of file -- cgit v1.2.3