#f# #haskell-hedgehog
#f# #haskell-hedgehog
Вопрос:
Я пытаюсь создать список целых чисел в f # hedgehog. список должен содержать от 10 до 20 элементов и содержать целые числа в диапазоне от 0 до 5.
Gen.list (Range.linear 10 20) (Gen.int <| Range.constant 0 5) |> Gen.printSample
выдает исключение:
=== Outcome ===
[5; 5; 2; 2; 0; 2; 3; 1; 1; 4]
=== Shrinks ===
> System.ArgumentException: The index is outside the legal range.
count = 9, distance past the list = 9
Parameter name: count
at Microsoft.FSharp.Core.DetailedExceptions.invalidArgOutOfRange[?](String arg, Int32 index, String text, Int32 bound) in F:workspace_work1ssrcfsharpFSharp.Corelocal.fs:line 57
at Microsoft.FSharp.Collections.ListModule.loop@474-29[a](Int32 count, Int32 i, FSharpList`1 lst) in F:workspace_work1ssrcfsharpFSharp.Corelist.fs:line 477
at Hedgehog.Gen.atLeast[a](Int32 n, FSharpList`1 xs)
at Microsoft.FSharp.Collections.Internal.IEnumerator.next@193[T](FSharpFunc`2 f, IEnumerator`1 e, FSharpRef`1 started, Unit unitVar0) in F:workspace_work1ssrcfsharpFSharp.Coreseq.fs:line 194
at Microsoft.FSharp.Collections.Internal.IEnumerator.filter@188.System-Collections-IEnumerator-MoveNext() in F:workspace_work1ssrcfsharpFSharp.Coreseq.fs:line 196
at Microsoft.FSharp.Collections.Internal.IEnumerator.map@75.DoMoveNext(bamp; curr) in F:workspace_work1ssrcfsharpFSharp.Coreseq.fs:line 77
at Microsoft.FSharp.Collections.Internal.IEnumerator.MapEnumerator`1.System-Collections-IEnumerator-MoveNext() in F:workspace_work1ssrcfsharpFSharp.Coreseq.fs:line 64
at Hedgehog.Gen.PrintSample[a](Gen`1 g)
at <StartupCode$FSI_0044>.$FSI_0044.main@()
Таким образом, обычно генератор создает правильный результат, но затем логика сжатия имеет проблемы. Это ошибка? Я делаю неправильно? Я пропустил документацию, которая объясняет это?
Комментарии:
1. Проблема отслеживается здесь: github.com/hedgehogqa/fsharp-hedgehog/issues/217