smallcheck-series-0.1: Extra series for smallcheck

Safe HaskellSafe
LanguageHaskell2010

Test.SmallCheck.Series.Text

Contents

Description

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

import qualified Test.SmallCheck.Series.Text as T.Series

Synopsis

Replication

aaa :: Series m Text Source

Create a Text Series growing with an extra a Char.

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

Use this when you don't care about the Chars inside Text.

zzz :: Series m Text Source

Create a Text Series growing with an extra NUL Char.

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

replicated :: Char -> Series m Text Source

Create a Text Series growing with an extra custom Char.

>>> list 4 $ replicated '☃'
["","\9731","\9731\9731","\9731\9731\9731","\9731\9731\9731\9731"]

Enumeration

ascii :: Series m Text Source

Create a Text Series growing with ASCII Chars set.

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

alpha :: Series m Text Source

Create a Text Series growing with the alphabet.

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

enumerated :: String -> Series m Text Source

Create a Text Series growing with the given Char set.

>>> list 4 $ enumerated "abc"
["","a","ab","abc","abc"]

Printing

jack :: Series m Text Source

Create a Text Series with a dummy sentence. This can be used when you want to print a Series to the screen.

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

Extra Unicode planes

nonBmp :: Series m Text Source

Create a Text Series with the first character of each Unicode plane.

>>> list 3 nonBmp
["","\NUL","\NUL\65536","\NUL\65536\131072"]

Notice that this covers the 16 unicode planes.

>>> last (list 16 nonBmp) == last (list 17 nonBmp)
True