Skip to content

Instantly share code, notes, and snippets.

@moodmosaic
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moodmosaic/7fba17beae7cee92581a to your computer and use it in GitHub Desktop.
Save moodmosaic/7fba17beae7cee92581a to your computer and use it in GitHub Desktop.
Feedback, related to an answer on Stack Overflow at: http://stackoverflow.com/a/28798955/467754
type OddlySpelledWords =
static member String() =
["zZ"; "oO0Ò"; "eEê"]
|> List.map Gen.elements
|> Gen.sequence
|> Gen.map (List.map string >> List.reduce (+))
|> Arb.fromGen
[<Property(Arbitrary = [| typeof<OddlySpelledWords> |])>]
let ``Generate oddly spelled words`` s =
printfn "%s" s
@ploeh
Copy link

ploeh commented Mar 2, 2015

Nice. This also works:

type OddlySpelledWords =
    static member String() =
        ["zZ"; "oO0Ò"; "eEê"]
        |> List.map Gen.elements
        |> Gen.sequence
        |> Gen.map (List.map string >> String.concat "")
        |> Arb.fromGen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment