module Test.SmallCheck.Series.Text.Lazy
(
replicateA
, replicateNull
, replicateChar
, enumAlphabet
, enumChars
, enumString
, jack
, enumNonBmp
) where
import Data.List (inits)
import Data.Text.Lazy (Text, pack)
import Test.SmallCheck.Series
replicateA :: Series m Text
replicateA :: Series m Text
replicateA = Char -> Series m Text
forall (m :: * -> *). Char -> Series m Text
replicateChar Char
'a'
replicateNull :: Series m Text
replicateNull :: Series m Text
replicateNull = Char -> Series m Text
forall (m :: * -> *). Char -> Series m Text
replicateChar Char
'\0'
replicateChar :: Char -> Series m Text
replicateChar :: Char -> Series m Text
replicateChar Char
c = (Depth -> [Text]) -> Series m Text
forall a (m :: * -> *). (Depth -> [a]) -> Series m a
generate ((Depth -> [Text]) -> Series m Text)
-> (Depth -> [Text]) -> Series m Text
forall a b. (a -> b) -> a -> b
$ \Depth
d -> (String -> Text) -> [String] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Text
pack ([String] -> [Text]) -> (String -> [String]) -> String -> [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [String]
forall a. [a] -> [[a]]
inits (String -> [Text]) -> String -> [Text]
forall a b. (a -> b) -> a -> b
$ Depth -> Char -> String
forall a. Depth -> a -> [a]
replicate Depth
d Char
c
enumAlphabet :: Series m Text
enumAlphabet :: Series m Text
enumAlphabet = String -> Series m Text
forall (m :: * -> *). String -> Series m Text
enumString [Char
'a'..Char
'z']
enumChars :: Series m Text
enumChars :: Series m Text
enumChars = String -> Series m Text
forall (m :: * -> *). String -> Series m Text
enumString [Char
'\0'..]
enumString :: String -> Series m Text
enumString :: String -> Series m Text
enumString String
cs = (Depth -> [Text]) -> Series m Text
forall a (m :: * -> *). (Depth -> [a]) -> Series m a
generate ((Depth -> [Text]) -> Series m Text)
-> (Depth -> [Text]) -> Series m Text
forall a b. (a -> b) -> a -> b
$ \Depth
d -> (String -> Text) -> [String] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Text
pack ([String] -> [Text]) -> (String -> [String]) -> String -> [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [String]
forall a. [a] -> [[a]]
inits (String -> [Text]) -> String -> [Text]
forall a b. (a -> b) -> a -> b
$ Depth -> String -> String
forall a. Depth -> [a] -> [a]
take Depth
d String
cs
jack :: Series m Text
jack :: Series m Text
jack = (Depth -> [Text]) -> Series m Text
forall a (m :: * -> *). (Depth -> [a]) -> Series m a
generate ((Depth -> [Text]) -> Series m Text)
-> (Depth -> [Text]) -> Series m Text
forall a b. (a -> b) -> a -> b
$ \Depth
d ->
([String] -> Text) -> [[String]] -> [Text]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (String -> Text
pack (String -> Text) -> ([String] -> String) -> [String] -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [String] -> String
unwords) ([[String]] -> [Text])
-> (String -> [[String]]) -> String -> [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [String] -> [[String]]
forall a. [a] -> [[a]]
inits ([String] -> [[String]])
-> (String -> [String]) -> String -> [[String]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Depth -> [String] -> [String]
forall a. Depth -> [a] -> [a]
take Depth
d ([String] -> [String])
-> (String -> [String]) -> String -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [String] -> [String]
forall a. [a] -> [a]
cycle ([String] -> [String])
-> (String -> [String]) -> String -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [String]
words (String -> [Text]) -> String -> [Text]
forall a b. (a -> b) -> a -> b
$
String
"All work and no play makes Jack a dull boy."
enumNonBmp :: Series m Text
enumNonBmp :: Series m Text
enumNonBmp = String -> Series m Text
forall (m :: * -> *). String -> Series m Text
enumString [Char
'\0',Char
'\x10000'..Char
'\xF0000']