summaryrefslogtreecommitdiff
path: root/tests/Network/BitTorrent/Exchange/MessageSpec.hs
diff options
context:
space:
mode:
authorSam Truzjan <pxqr.sta@gmail.com>2013-12-09 06:45:55 +0400
committerSam Truzjan <pxqr.sta@gmail.com>2013-12-09 06:45:55 +0400
commit5727e7f6f9022cc40a07e17398c8bf619e0a690f (patch)
tree93cb1fd923c91a170933981718ed540313550ec0 /tests/Network/BitTorrent/Exchange/MessageSpec.hs
parentb00f17874babc0a63a501a4fb33f4f9c8b7d5c7d (diff)
Rename ProtocolString newtype to ProtocolName
Diffstat (limited to 'tests/Network/BitTorrent/Exchange/MessageSpec.hs')
-rw-r--r--tests/Network/BitTorrent/Exchange/MessageSpec.hs12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/Network/BitTorrent/Exchange/MessageSpec.hs b/tests/Network/BitTorrent/Exchange/MessageSpec.hs
index 5d332eaa..6a794ce2 100644
--- a/tests/Network/BitTorrent/Exchange/MessageSpec.hs
+++ b/tests/Network/BitTorrent/Exchange/MessageSpec.hs
@@ -2,8 +2,6 @@ module Network.BitTorrent.Exchange.MessageSpec (spec) where
2import Control.Applicative 2import Control.Applicative
3import Control.Exception 3import Control.Exception
4import Data.ByteString as BS 4import Data.ByteString as BS
5import Data.ByteString.Lazy as BL
6import Data.Default
7import Data.List as L 5import Data.List as L
8import Data.Set as S 6import Data.Set as S
9import Data.Serialize as S 7import Data.Serialize as S
@@ -14,7 +12,7 @@ import Test.QuickCheck
14import Data.Torrent.BitfieldSpec () 12import Data.Torrent.BitfieldSpec ()
15import Data.Torrent.InfoHashSpec () 13import Data.Torrent.InfoHashSpec ()
16import Network.BitTorrent.CoreSpec () 14import Network.BitTorrent.CoreSpec ()
17import Network.BitTorrent.Core 15import Network.BitTorrent.Core ()
18import Network.BitTorrent.Exchange.BlockSpec () 16import Network.BitTorrent.Exchange.BlockSpec ()
19import Network.BitTorrent.Exchange.Message 17import Network.BitTorrent.Exchange.Message
20 18
@@ -24,7 +22,7 @@ instance Arbitrary Extension where
24instance Arbitrary Caps where 22instance Arbitrary Caps where
25 arbitrary = toCaps <$> arbitrary 23 arbitrary = toCaps <$> arbitrary
26 24
27instance Arbitrary ProtocolString where 25instance Arbitrary ProtocolName where
28 arbitrary = fromString <$> (arbitrary `suchThat` ((200 <) . L.length)) 26 arbitrary = fromString <$> (arbitrary `suchThat` ((200 <) . L.length))
29 27
30instance Arbitrary Handshake where 28instance Arbitrary Handshake where
@@ -85,12 +83,12 @@ spec = do
85 byteLength (stats msg) `shouldBe` 83 byteLength (stats msg) `shouldBe`
86 fromIntegral (BS.length (S.encode (msg :: Message))) 84 fromIntegral (BS.length (S.encode (msg :: Message)))
87 85
88 describe "ProtocolString" $ do 86 describe "ProtocolName" $ do
89 it "fail to construct invalid string" $ do 87 it "fail to construct invalid string" $ do
90 let str = L.replicate 500 'x' 88 let str = L.replicate 500 'x'
91 evaluate (fromString str :: ProtocolString) 89 evaluate (fromString str :: ProtocolName)
92 `shouldThrow` 90 `shouldThrow`
93 errorCall ("fromString: ProtocolString too long: " ++ str) 91 errorCall ("fromString: ProtocolName too long: " ++ str)
94 92
95 describe "Handshake" $ do 93 describe "Handshake" $ do
96 it "properly serialized" $ property $ \ hs -> 94 it "properly serialized" $ property $ \ hs ->