arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2304.03393cs.PL
收藏

多态覆盖类型

Polymorphic Coverage Types

Purdue University(普渡大学);Indian Institute of Technology Hyderabad(印度理工学院海德拉巴分校)

Zhe Zhou, Ashish Mishra, Benjamin Delaware, Suresh Jagannathan

AI总结:

本文提出了一种基于多态类型的覆盖验证方法,用于验证测试生成器的覆盖能力,通过新的类型解释和高阶函数支持,提升了PBT框架中生成器的静态验证效率。

摘要:

测试输入生成器是属性驱动测试(PBT)框架的重要组成部分,一个关键要求是它们能够生成所有满足函数输入类型和生成器提供的约束的可接受元素。然而,如何验证特定生成器的输出是否满足这一覆盖要求并不明显。在实践中,开发人员通常依赖手动检查和测试运行后的分析来确定生成器是否提供了足够的覆盖;这些方法容易出错且难以扩展,因为随着生成器变得更加复杂。为了解决这个问题,我们提出了一种基于新类型解释的细化类型验证程序,用于验证输入测试生成器提供的覆盖情况。我们的方法基于一种新的类型解释,将

英文摘要:

Test input generators are an important part of property-based testing (PBT) frameworks, and a key expectation is that they be capable of producing all acceptable elements that satisfy both the function's input type and the generator-provided constraints. However, it is not readily apparent how to validate whether a particular generator's output satisfies this coverage requirement. In practice, developers typically rely on manual inspection and post-mortem analysis of test runs to determine whether a generator provides sufficient coverage; these approaches are error-prone and difficult to scale as generators grow more complex. To address this problem, we present a new refinement-type-based verification procedure for validating the coverage provided by input test generators, based on a novel interpretation of types that embeds "must-style" underapproximate reasoning principles as a fundamental part of the type system. In our formulation, the types associated with expressions capture the set of values guaranteed to be produced by the expression, rather than the usual interpretation in which types represent the set of values an expression may produce. We formalize the notion of coverage types in a rich core language supporting higher-order functions and inductive datatypes. To better support real-world test generators, we extend this type system with type and qualifier polymorphism, enabling static verification of coverage guarantees for test input generators constructed using the monadic combinators found in most PBT frameworks. Finally, we have implemented a coverage type checker for OCaml programs based on this core calculus and present a detailed evaluation of its utility using a corpus of benchmarks drawn from both the PBT literature and open-source projects.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑