bytestring-arbitrary-0.1.2: Arbitrary instances for ByteStrings

Safe HaskellSafe
LanguageHaskell2010

Data.ByteString.Arbitrary

Synopsis

Documentation

newtype ArbByteString1M Source #

A wrapper to generate 1MB bytestrings. The shrink implementation still returns ArbByteString1M instances, of course, but they're smaller than 1MB.

Constructors

ABS1M 

newtype ArbByteString10M Source #

A wrapper to generate 10MB bytestrings. I should really figure out how type-level Nats work, so one can just do (ArbByteStringN 10000000) and have selectable sizes, but I don't see how to do that yet, so 10MB is as big as this library goes. As with the 1MB version, shrink here will generate ArbByteString10M instances that wrap ByteStrings smaller than 10MB.

Constructors

ABS10M 

fastRandBs :: Int -> Gen ByteString Source #

Generate a bunch of binary data quickly. This abuses the cryptohash skein function to generate a megabyte of data at a time, and then concats chunks until it has enough.

slowRandBs :: Int -> Gen ByteString Source #

Generate binary data slowly. This generates a list of Word8s, and then uses Data.ByteString.pack to concatenate it into a single ByteString.