我们如何使用带有 FsCheck 的生成器?

问题描述 投票:0回答:0

此链接 解释了生成器,但没有具体说明如何使用它。 我不确定如何测试生成器生成的列表的内容。

我想要以下代码。 (forall 是虚函数。)

open FsCheck
open FsCheck.Xunit

let isZero x = (x = 0)

let Zeros = Gen.constant 0 |> Gen.sample 0 100 

[<Property>]
let TestSample =
    forall isZero Zeros
f# xunit fscheck
© www.soinside.com 2019 - 2024. All rights reserved.