smallcheck-series-0.6.1.1: Extra SmallCheck series and utilities

Safe HaskellSafe
LanguageHaskell2010

Test.SmallCheck.Series.ByteString.Lazy

Contents

Description

Following the convention from Data.ByteString.Lazy, this module is intended to be imported qualified. For example:

import qualified Test.SmallCheck.Series.ByteString.Lazy as L.Series
Synopsis

Replication

replicateA :: Series m ByteString Source #

A ByteString Series that grows by replicating the 97 Word8, which encodes the 'a' Char in ASCII.

>>> list 4 replicateA
["","a","aa","aaa","aaaa"]

Use this when you don't care about the Word8 inside ByteString.

replicate0 :: Series m ByteString Source #

A ByteString Series that grows by replicating the 0 Word8.

>>> list 4 replicate0
["","\NUL","\NUL\NUL","\NUL\NUL\NUL","\NUL\NUL\NUL\NUL"]

replicateW8 :: Word8 -> Series m ByteString Source #

A ByteString Series that grows by replicating the given Word8.

>>> list 4 $ replicateW8 64
["","@","@@","@@@","@@@@"]

Enumeration

enumW8s :: Series m ByteString Source #

A ByteString Series that grows by enumerating every Word8.

>>> list 4 enumW8s
["","\NUL","\NUL\SOH","\NUL\SOH\STX","\NUL\SOH\STX\ETX"]

enumAlphabet :: Series m ByteString Source #

A ByteString Series that grows by enumerating the Word8s which encode the latin alphabet in ASCII.

>>> list 4 enumAlphabet
["","a","ab","abc","abcd"]

enumList :: [Word8] -> Series m ByteString Source #

A ByteString Series that grows by enumerating every Word8 in the given list.

>>> list 4 . enumList $ fmap (fromIntegral . ord) "abc"
["","a","ab","abc"]

Printing

jack :: Series m ByteString Source #

A ByteString Series that grows with ASCII dummy English words encoded in ASCII.

This is useful when you want to print Series.

>>> let s = list 20 jack
>>> take 3 s
["","All","All work"]
>>> last s
"All work and no play makes Jack a dull boy. All work and no play makes Jack a dull boy."