Is there a way to generate a string in FsCheck by selecting just one item from each of a list of strings and then concatenating the result?
I'm just completely stuck and can't seem to figure it out. I've looked at the docs and in the github repo for something similar. And I've done most of my reading on FsCheck from FSharpForFunAndProfit.
This is something like what I would be thinking of:
let rand = System.Random()
let randInt max = rand.Next(0, max)
let selectLetter (string: string) =
let whichLettersIndex = String.length string |> randInt
string.Substring(whichLettersIndex, 1)
let generateOddlySpelledWord listOfStrings =
List.map selectLetter listOfStrings
|> String.concat ""
let usingGenerateOddlySpelledWord =
generateOddlySpelledWord ["zZ"; "oO0Ò"; "eEê"]
That should generate something like "Z0ê" or "zÒE".
string seq
then applyGen.elements
. – Swenson