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

Contents

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 #

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

Instances

Eq a => Eq (Unicode a) # 

Methods

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

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

Ord a => Ord (Unicode a) # 

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) # 
Show a => Show (Unicode a) # 

Methods

showsPrec :: Int -> Unicode a -> ShowS #

show :: Unicode a -> String #

showList :: [Unicode a] -> ShowS #

Arbitrary (Unicode Char) # 
Arbitrary (Unicode [Char]) # 

Generators

char :: Gen Char #

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

string :: Gen String #

Generate a list of Unicode code points.

string1 :: Gen String #

Generate a non-empty list of Unicode code points.

Helpers

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

Generate a list of values.

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

Generate a non-empty list of values.

Basic generators

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

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

plane0 :: Gen Int #

Basic Multilingual Plane.

plane1 :: Gen Int #

Supplementary Multilingual Plane.

plane2 :: Gen Int #

Supplementary Ideographic Plane.

plane14 :: Gen Int #

Supplementary Special-Purpose Plane.

Predicates

reserved :: Int -> Bool #

Indicate whether a code point is reserved.

Shrinking functions

shrinkChar :: Char -> [Char] #

Shrink a Unicode code point.