Skip to content

Test Failure: FSharp.Core.Unittests.FSharp_Core.Microsoft_FSharp_Collections.CollectionModulesConsistency.init is consistent  #1639

@KevinRansom

Description

@KevinRansom

I see this test error on an internal build, it is the coreclr x64 build, I see it on multiple machines. I have no idea what causes it, and even less idea what is being tested. It seems to be using fscheck, can someone explain to me what is going on ... so I can try to fix whatever is wrong with the runtime that causes it.

@forki perhaps you know who would be the best person to ping on helping me with this.

Thank you

Kevin

This is the test code:

/// helper function that creates labeled FsCheck properties for equality comparisons
let consistency name sqs ls arr =
    (sqs = arr) |@ (sprintf  "Seq.%s = '%A', Array.%s = '%A'" name sqs name arr) .&. 
    (ls  = arr) |@ (sprintf "List.%s = '%A', Array.%s = '%A'" name ls name arr)

let init<'a when 'a : equality> count f =
    let s = run (fun () -> Seq.init count f |> Seq.toArray)
    let l = run (fun () -> List.init count f |> Seq.toArray)
    let a = run (fun () -> Array.init count f)
    consistency "init" s l a

[<Test>]
let ``init is consistent`` () =
    Check.QuickThrowOnFailure init<int>
    Check.QuickThrowOnFailure init<string>
    Check.QuickThrowOnFailure init<NormalFloat>

Error : FSharp.Core.Unittests.FSharp_Core.Microsoft_FSharp_Collections.CollectionModulesConsistency.init is consistent
System.Exception : Falsifiable, after 11 tests (3 shrinks) (StdGen (1763200978,296218671)):
Labels of failing property (one or more is failing):
List.init = 'Error "The input must be non-negative.
Parameter name: count"', Array.init = 'Error "The input must be non-negative.
count = -1
Parameter name: count"'
Seq.init = 'Error "The input must be non-negative.
Parameter name: count"', Array.init = 'Error "The input must be non-negative.
count = -1
Parameter name: count"'
Original:
-6
<fun:Invoke@3260>
Shrunk:
-1
<fun:Invoke@3260>
   at <StartupCode$FsCheck>[email protected](String message) in c:\Users\Kurt\Projects\FsCheck\fsharp\src\FsCheck\Runner.fs:line 362
   at FsCheck.Runner.check[a](Config config, a p) in c:\Users\Kurt\Projects\FsCheck\fsharp\src\FsCheck\Runner.fs:line 269
   at FSharp.Core.Unittests.FSharp_Core.Microsoft_FSharp_Collections.CollectionModulesConsistency.init is consistent() in c:\kevinransom\visualfsharp\src\fsharp\FSharp.Core.Unittests\FSharp.Core\Microsoft.FSharp.Collections\CollectionModulesConsistency.fs:line 426

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions