diff options
author | Sam T <pxqr.sta@gmail.com> | 2013-05-25 21:41:15 +0400 |
---|---|---|
committer | Sam T <pxqr.sta@gmail.com> | 2013-05-25 21:41:15 +0400 |
commit | 5e92eec501e0a1ca6d09a01e078cf54ff3277273 (patch) | |
tree | 09879470eb7a5cd73c80bd2c84e589bd7e58b052 /tests | |
parent | 12769d2f1cfc29e08c4e451d3b65db81cfeb9cac (diff) |
~ Use PortNumber instead of Word16 in Port message.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Encoding.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/Encoding.hs b/tests/Encoding.hs index fe0e1d7e..d43045bc 100644 --- a/tests/Encoding.hs +++ b/tests/Encoding.hs | |||
@@ -13,6 +13,8 @@ import Test.Framework.Providers.QuickCheck2 (testProperty) | |||
13 | import Test.QuickCheck | 13 | import Test.QuickCheck |
14 | 14 | ||
15 | import Network.URI | 15 | import Network.URI |
16 | import Network | ||
17 | |||
16 | 18 | ||
17 | import Data.Bitfield | 19 | import Data.Bitfield |
18 | import Data.Torrent | 20 | import Data.Torrent |
@@ -33,6 +35,9 @@ instance Arbitrary Block where | |||
33 | 35 | ||
34 | deriving instance Arbitrary Bitfield | 36 | deriving instance Arbitrary Bitfield |
35 | 37 | ||
38 | instance Arbitrary PortNumber where | ||
39 | arbitrary = fromIntegral <$> (arbitrary :: Gen Word16) | ||
40 | |||
36 | instance Arbitrary Message where | 41 | instance Arbitrary Message where |
37 | arbitrary = oneof | 42 | arbitrary = oneof |
38 | [ pure KeepAlive | 43 | [ pure KeepAlive |
@@ -45,7 +50,7 @@ instance Arbitrary Message where | |||
45 | , Request <$> arbitrary | 50 | , Request <$> arbitrary |
46 | , Piece <$> arbitrary | 51 | , Piece <$> arbitrary |
47 | , Cancel <$> arbitrary | 52 | , Cancel <$> arbitrary |
48 | , Port <$> choose (0, fromIntegral (maxBound :: Word16)) | 53 | , Port <$> arbitrary |
49 | ] | 54 | ] |
50 | 55 | ||
51 | instance Arbitrary PeerID where | 56 | instance Arbitrary PeerID where |