Vavr物业测试 [英] Vavr property testing

查看:118
本文介绍了Vavr物业测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

属性检查功能在最新的 Vavr文档中以及以下内容中进行了公布使用示例:

 任意<整数> ints = Arbitrary.integer(); 

// square(int)> = 0:好的,通过了1000次测试。
Property.def(square(int)> = 0)
.forAll(int)
.suchThat(i - > i * i> = 0)
.check()
.assertIsSatisfied();

但是,根据图书馆的 javadoc ,既不是任意生成器也不是属性类型存在。

我错过了什么,如果有的话?是否文档是最新的?

解决方案

原来, vavr-test 依赖项缺失,这在Vavr文档中并不明显:

 <依赖关系> 
< groupId> io.vavr< / groupId>
< artifactId> vavr-test< / artifactId>
< version> 0.9.1< / version>
< /依赖关系>


Property checking feature is advertised in the latest Vavr documentation along with the following example of its usage:

Arbitrary<Integer> ints = Arbitrary.integer();

// square(int) >= 0: OK, passed 1000 tests.
Property.def("square(int) >= 0")
        .forAll(ints)
        .suchThat(i -> i * i >= 0)
        .check()
        .assertIsSatisfied();

However, as per the library's javadoc, neither Arbitrary generator nor Property type exist.

What am I missing, if any? Is the documentation up to date?

解决方案

Turns out, the following vavr-test dependency was missing, which is not obvious from Vavr documentation:

<dependency>
    <groupId>io.vavr</groupId>
    <artifactId>vavr-test</artifactId>
    <version>0.9.1</version>
</dependency>

这篇关于Vavr物业测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆