Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save stijnmoreels/410742d6d8ab52e75db385a81491269c to your computer and use it in GitHub Desktop.

Select an option

Save stijnmoreels/410742d6d8ab52e75db385a81491269c to your computer and use it in GitHub Desktop.
open FsCheck
module Gen =
module FolderDto =
let tooWide =
tree 0 maxDepth 10 10 (fun xs ->
Folder.id
|> Gen.map (fun x -> Tree.create x.Value xs))
|> Gen.filter (fun t -> t.Branches <> [])
|> Gen.map treeToDto
let tooDeep =
tree 5 10 1 maxWidth (fun xs ->
Folder.id
|> Gen.map (fun x -> Tree.create x.Value xs))
|> Gen.scaleSize ((+) (maxDepth + 1))
|> Gen.map treeToDto
let duplicates = gen {
let! duplicateRoot =
Folder.id |> Gen.map (fun id ->
[ folderDto_withoutParent id.Value None
folderDto_withoutParent id.Value None ])
let! duplicateSub =
Gen.map Alphanum10.value Folder.id
|> Gen.two |> Gen.map (fun (x, y) ->
[ folderDto_withParent x None y
folderDto_withParent x None y ])
return List.concat [ duplicateRoot; duplicateSub ] }
let recurseItem =
Folder.id
|> Gen.map (Alphanum10.value >> fun id -> folderDto_withParent id None id)
|> Gen.nonEmptyListOf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment