diff options
author | joe <joe@jerkface.net> | 2017-01-17 18:42:09 -0500 |
---|---|---|
committer | joe <joe@jerkface.net> | 2017-01-17 18:42:09 -0500 |
commit | 5d0791e6ed2e500c08e7dadda39a254c8340cef5 (patch) | |
tree | 1232e01ea7452473941e488af01b98bc90202554 /tests | |
parent | 5c54f6570a27e1509ddf048a91bd69c05052f2f1 (diff) |
Handle reflected IP addresses (see bep 42).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Network/KRPC/MessageSpec.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/Network/KRPC/MessageSpec.hs b/tests/Network/KRPC/MessageSpec.hs index 7aca4489..498ef679 100644 --- a/tests/Network/KRPC/MessageSpec.hs +++ b/tests/Network/KRPC/MessageSpec.hs | |||
@@ -20,7 +20,8 @@ instance Arbitrary KQuery where | |||
20 | arbitrary = KQuery <$> pure (BInteger 0) <*> arbitrary <*> arbitrary | 20 | arbitrary = KQuery <$> pure (BInteger 0) <*> arbitrary <*> arbitrary |
21 | 21 | ||
22 | instance Arbitrary KResponse where | 22 | instance Arbitrary KResponse where |
23 | arbitrary = KResponse <$> pure (BList []) <*> arbitrary | 23 | -- TODO: Abitrary instance for ReflectedIP |
24 | arbitrary = KResponse <$> pure (BList []) <*> arbitrary <*> pure Nothing | ||
24 | 25 | ||
25 | instance Arbitrary KMessage where | 26 | instance Arbitrary KMessage where |
26 | arbitrary = frequency | 27 | arbitrary = frequency |
@@ -64,8 +65,8 @@ spec = do | |||
64 | 65 | ||
65 | it "properly bencoded" $ do | 66 | it "properly bencoded" $ do |
66 | BE.decode "d1:rle1:t2:aa1:y1:re" `shouldBe` | 67 | BE.decode "d1:rle1:t2:aa1:y1:re" `shouldBe` |
67 | Right (KResponse (BList []) "aa") | 68 | Right (KResponse (BList []) "aa" Nothing) |
68 | 69 | ||
69 | describe "generic message" $ do | 70 | describe "generic message" $ do |
70 | it "properly bencoded (iso)" $ property $ \ km -> | 71 | it "properly bencoded (iso)" $ property $ \ km -> |
71 | BE.decode (BL.toStrict (BE.encode km)) `shouldBe` Right (km :: KMessage) \ No newline at end of file | 72 | BE.decode (BL.toStrict (BE.encode km)) `shouldBe` Right (km :: KMessage) |