1-- | Benchmarking utilities.  For example, functions for generating
2-- random 'ByteString's.
3module Util.ByteString where
4
5import qualified Data.ByteString as S
6import qualified Data.ByteString.Char8 as C
7
8import Util.String as String
9
10-- | Generate a number of fixed length 'ByteString's where the content
11-- of the strings are letters in ascending order.
12asc :: Int  -- ^ Length of each string
13    -> Int  -- ^ Number of strings
14    -> [S.ByteString]
15asc strlen num = map C.pack $ String.asc strlen num
16
17-- | Generate a number of fixed length 'ByteString's where the content
18-- of the strings are letters in random order.
19rnd :: Int  -- ^ Length of each string
20    -> Int  -- ^ Number of strings
21    -> [S.ByteString]
22rnd strlen num = map C.pack $ String.rnd strlen num
23
24-- | Generate a number of fixed length 'ByteString's where the content
25-- of the strings are letters in random order, different from @rnd@.
26rnd' :: Int  -- ^ Length of each string
27     -> Int  -- ^ Number of strings
28     -> [S.ByteString]
29rnd' strlen num = map C.pack $ String.rnd' strlen num
30