quickcheck-unicode-1.0.0.0: Generator and shrink functions for testing Unicode-related software.

Copyright(c) 2014 Bryan O'Sullivan
LicenseBSD-style
Maintainerbos@serpentine.com
Stabilitystable
Portabilityportable
Safe HaskellSafe-Inferred
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 Source

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

Instances

Eq a => Eq (Unicode a) 
Ord a => Ord (Unicode a) 
Read a => Read (Unicode a) 
Show a => Show (Unicode a) 
Arbitrary (Unicode Char) 
Arbitrary (Unicode [Char]) 

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.

Helpers

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

Generate a 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.

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.