quickcheck-unicode-1.0.1.0: Generator and shrink functions for testing Unicode-related software.
Copyright(c) 2014-2017 Bryan O'Sullivan
LicenseBSD-style
Maintainerbos@serpentine.com
Stabilitystable
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Test.QuickCheck.Unicode

Description

QuickCheck Generator and shrink functions for testing software that uses Unicode data.

The default Arbitrary instance for the Char type intentionally generates only ASCII values. This can lead to a false sense of security in cases where Unicode compliance is required, as encodings that span multiple bytes or code units will simply not be exercised at all.

This module deliberately avoids using the text and bytestring packages to avoid pulling in extra dependencies.

Synopsis

Newtype wrapper for convenience

data Unicode a Source #

A wrapper for Char and String, for which the Arbitrary instance generates full-Unicode characters.

Instances

Instances details
Eq a => Eq (Unicode a) Source # 
Instance details

Defined in Test.QuickCheck.Unicode

Methods

(==) :: Unicode a -> Unicode a -> Bool

(/=) :: Unicode a -> Unicode a -> Bool

Ord a => Ord (Unicode a) Source # 
Instance details

Defined in Test.QuickCheck.Unicode

Methods

compare :: Unicode a -> Unicode a -> Ordering

(<) :: Unicode a -> Unicode a -> Bool

(<=) :: Unicode a -> Unicode a -> Bool

(>) :: Unicode a -> Unicode a -> Bool

(>=) :: Unicode a -> Unicode a -> Bool

max :: Unicode a -> Unicode a -> Unicode a

min :: Unicode a -> Unicode a -> Unicode a

Read a => Read (Unicode a) Source # 
Instance details

Defined in Test.QuickCheck.Unicode

Methods

readsPrec :: Int -> ReadS (Unicode a)

readList :: ReadS [Unicode a]

readPrec :: ReadPrec (Unicode a)

readListPrec :: ReadPrec [Unicode a]

Show a => Show (Unicode a) Source # 
Instance details

Defined in Test.QuickCheck.Unicode

Methods

showsPrec :: Int -> Unicode a -> ShowS

show :: Unicode a -> String

showList :: [Unicode a] -> ShowS

Arbitrary (Unicode Char) Source # 
Instance details

Defined in Test.QuickCheck.Unicode

Methods

arbitrary :: Gen (Unicode Char) Source #

shrink :: Unicode Char -> [Unicode Char] Source #

Arbitrary (Unicode [Char]) Source # 
Instance details

Defined in Test.QuickCheck.Unicode

Methods

arbitrary :: Gen (Unicode [Char]) Source #

shrink :: Unicode [Char] -> [Unicode [Char]] Source #

Generators

char :: Gen Char Source #

Generate a Unicode code point. This has a much larger range than the default Arbitrary instance for Char.

string :: Gen String Source #

Generate a list of Unicode code points.

string1 :: Gen String Source #

Generate a non-empty list of Unicode code points.

Helpers

list :: Gen a -> Gen [a] Source #

Generate a list of values.

list1 :: Gen a -> Gen [a] Source #

Generate a non-empty list of values.

Basic generators

planes :: [(Int, Gen Int)] Source #

A weighted list of generators that favours ASCII characters, followed by planes 0 and 1.

ascii :: Gen Int Source #

plane0 :: Gen Int Source #

Basic Multilingual Plane.

plane1 :: Gen Int Source #

Supplementary Multilingual Plane.

plane2 :: Gen Int Source #

Supplementary Ideographic Plane.

plane14 :: Gen Int Source #

Supplementary Special-Purpose Plane.

Predicates

reserved :: Int -> Bool Source #

Indicate whether a code point is reserved.

Shrinking functions

shrinkChar :: Char -> [Char] Source #

Shrink a Unicode code point.