@@ -14,6 +14,7 @@ import Data.Binary.Bits.Get
14import Data.Binary.Bits.Put
14import Data.Binary.Bits.Put
16import qualified Data.ByteString as B
16import qualified Data.ByteString as B
17+import qualified Data.ByteString.Lazy as L
18import Control.Applicative
19import Control.Applicative
19import Data.Bits
20import Data.Bits
@@ -39,6 +40,9 @@ tests =
39 , testGroup "Custom test cases"
40 , testGroup "Custom test cases"
40 [ testProperty "prop_composite_case" prop_composite_case ]
41 [ testProperty "prop_composite_case" prop_composite_case ]
43+ , testGroup "getByteString"
44+ [ testProperty "prop_getByteString_negative" prop_getByteString_negative ]
42 , testGroup "prop_bitput_with_get_from_binary"
46 , testGroup "prop_bitput_with_get_from_binary"
43 [ testProperty "Word8" (prop_bitput_with_get_from_binary :: W [Word8] -> Property)
47 [ testProperty "Word8" (prop_bitput_with_get_from_binary :: W [Word8] -> Property)
44 , testProperty "Word16" (prop_bitput_with_get_from_binary :: W [Word16] -> Property)
48 , testProperty "Word16" (prop_bitput_with_get_from_binary :: W [Word16] -> Property)
@@ -103,6 +107,12 @@ tests =
111+prop_getByteString_negative :: Int -> Property
112+prop_getByteString_negative n =
114+ runGet (runBitGet (getByteString n)) L.empty == B.empty
106prop_putget_with_bitreq :: (BinaryBit a, Num a, Bits a, Ord a) => W a -> Property
116prop_putget_with_bitreq :: (BinaryBit a, Num a, Bits a, Ord a) => W a -> Property
107prop_putget_with_bitreq (W w) = property $
117prop_putget_with_bitreq (W w) = property $
108 -- write all words with as many bits as it's required
118 -- write all words with as many bits as it's required