@@ -14,6 +14,7 @@ import Data.Binary.Bits.Get
1414import Data.Binary.Bits.Put
1515
1616import qualified Data.ByteString as B
17+import qualified Data.ByteString.Lazy as L
1718
1819import Control.Applicative
1920import Data.Bits
@@ -39,6 +40,9 @@ tests =
3940 , testGroup "Custom test cases"
4041 [ testProperty "prop_composite_case" prop_composite_case ]
4142
43+ , testGroup "getByteString"
44+ [ testProperty "prop_getByteString_negative" prop_getByteString_negative ]
45+
4246 , testGroup "prop_bitput_with_get_from_binary"
4347 [ testProperty "Word8" (prop_bitput_with_get_from_binary :: W [Word8] -> Property)
4448 , testProperty "Word16" (prop_bitput_with_get_from_binary :: W [Word16] -> Property)
@@ -103,6 +107,12 @@ tests =
103107 ]
104108 ]
105109
110+
111+prop_getByteString_negative :: Int -> Property
112+prop_getByteString_negative n =
113+ n < 1 ==>
114+ runGet (runBitGet (getByteString n)) L.empty == B.empty
115+
106116prop_putget_with_bitreq :: (BinaryBit a, Num a, Bits a, Ord a) => W a -> Property
107117prop_putget_with_bitreq (W w) = property $
108118 -- write all words with as many bits as it's required