Commits

FlorianHartwig committed 0b447e2

Fix quickcheck properties to work with changed interface

Comments (0)

Files changed (1)

 instance Arbitrary B.ByteString where
     arbitrary   = fmap B.pack arbitrary
 
+
+instance FromBencode BValue where
+    fromBencode = Just
+
 prop_EncodeInteger :: Integer -> Bool
-prop_EncodeInteger n = encode n == B.pack ("i" ++ show n ++ "e")
+prop_EncodeInteger n = encode (BInt n) == B.pack ("i" ++ show n ++ "e")
 
 prop_EncodeString :: B.ByteString -> Bool
 prop_EncodeString bs =
-    encode bs == B.pack (show (B.length bs) ++ ":") `B.append` bs
+    encode (BString bs) == B.pack (show (B.length bs) ++ ":") `B.append` bs
 
+prop_EncodeDecode :: BValue -> Bool
 prop_EncodeDecode bv = case decode (encode bv) of
                             Just bv' -> bv == bv'
                             Nothing  -> False