Created
November 2, 2023 06:50
-
-
Save stijnmoreels/410742d6d8ab52e75db385a81491269c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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