-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Generate random strings with specific qualities -- -- Useful for generating test/benchmark data, the -- Test.RandomStrings module provides functions for generating -- random character strings in the ASCII range. You can specify -- probabilities for the alphabet-range chars and capital case -- characters. @package random-strings @version 0.1.0.0 -- | A helper for randomly changing the case in strings. Useful for -- generating test-cases for case-insensitive matching. module Test.RandomStrings.FlipCase -- | Toggle the case of a Char. flipCase :: Char -> Char -- | Toggle character case for a String. flipCaseString :: String -> String -- | Randomly flip the case of a Char. randomFlipCase :: Rational -> Char -> IO Char -- | Randomly flip the case of a String. randomFlipCaseString :: Rational -> String -> IO String -- | A way to generate random character strings for testing. Functions -- allow tuning of strings, setting the probability of alphabetic and -- upper-case characters in the resulting strings. -- -- Hopefully this is useful for building test and benchmark cases that -- are more meaningful than the overly random strings generated by -- libraries like QuickCheck. -- -- Note: Please don't use this to generate passwords! -- -- Examples: -- -- Generate a 10-letter word with 1 in 10 upper-case characters -- --
--   word <- randomWord' randomASCII (1%10) 10
--   
-- -- Generate a list of 500 strings from the printable ISO-8859-1 -- characters with random lengths beween 5 and 20 characters. -- --
--   let iso_printable = randomString $ onlyPrintable randomChar8
--   strings <- randomStringsLen iso_printable (5,20) 500
--   
--   -- benchmarks ...
--   
module Test.RandomStrings -- | Generate a random Char randomChar :: IO Char -- | Generate a random ASCII (7-bit) char in the printable range. randomASCII :: IO Char -- | Generate a random ISO-8859-1 (8-bit) char randomChar8 :: IO Char -- | Random character passing a test onlyWith :: (Char -> Bool) -> IO Char -> IO Char -- | Supply a random printable character. onlyPrintable :: IO Char -> IO Char -- | Generate a random alphabetic char. onlyAlpha :: IO Char -> IO Char -- | Generate a random alphabetic char with a probability of being -- upper-case. onlyAlpha' :: Rational -> IO Char -> IO Char -- | Generate an alphanumeric char. onlyAlphaNum :: IO Char -> IO Char -- | Generate a random upper-case letter. onlyUpper :: IO Char -> IO Char -- | Generate a random lower-case letter. onlyLower :: IO Char -> IO Char -- | Randomly generate one of two character types randomClass :: Rational -> IO Char -> IO Char -> IO Char -- | Generate a random string of alphabetic characters. randomWord :: IO Char -> Int -> IO String randomWord' :: IO Char -> Rational -> Int -> IO String -- | Generate a random string randomString :: IO Char -> Int -> IO String -- | Generate a random string of printable characters with a balance of -- alphabetic and upper-case characters. randomString' :: IO Char -> Rational -> Rational -> Int -> IO String -- | Generate a list of strings of uniform length. -- --
--   randomStrings (randomString (onlyAlpha randomChar8) 20) 50
--   
-- -- will build a list of 50 alphabetical strings, each 20 characters long. randomStrings :: IO String -> Int -> IO [String] -- | Generate a list of strings of variable length. -- -- Similar to randomStrings, but generates strings with random -- length. Example: -- --
--   randomStringsLen (randomString' randomASCII (3%4) (1%8)) (10,30) 100
--   
-- -- Returns a list of 100 strings that are between 10 and 30 characters, -- with 34 of them being alphabetical and 18 of those being -- upper-case. randomStringsLen :: (Int -> IO String) -> (Int, Int) -> Int -> IO [String]