arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2408.14561cs.PLcs.SE
收藏

Mica:针对 OCaml 模块的自动化差分测试

Mica: Automated Differential Testing for OCaml Modules

Ernest Ng, Harrison Goldstein, Benjamin C. Pierce

AI总结:

Mica 是一个作为 PPX 编译器扩展的自动化工具,通过最小注释自动推导基于属性的测试代码,用于检测 OCaml 模块间的观察等价性,有效减少样板代码。

摘要:

假设给定两个实现相同签名的 OCaml 模块。我们如何检查它们是否具有观察等价性——即对所有输入表现一致?一种成熟技术是使用如 QuickCheck 这样的基于属性的测试(PBT)工具。然而,目前这需要大量样板代码和临时测试框架。为此,我们提出 Mica,一个用于测试 OCaml 模块观察等价性的自动化工具。Mica 作为 PPX 编译器扩展实现,允许用户提供最小注释到模块签名。这些注释引导 Mica 自动推导出检查观察等价性的专用 PBT 代码。我们讨论了 Mica 的设计,并在真实 OCaml 库的多个模块上验证了其作为测试工具的有效性。

英文摘要:

Suppose we are given two OCaml modules implementing the same signature. How do we check that they are observationally equivalent -- that is, that they behave the same on all inputs? One established technique is to use a property-based testing (PBT) tool such as QuickCheck. Currently, however, this can require significant amounts of boilerplate code and ad-hoc test harnesses. To address this issue, we present Mica, an automated tool for testing observational equivalence of OCaml modules. Mica is implemented as a PPX compiler extension, allowing users to supply minimal annotations to a module signature. These annotations guide Mica to automatically derive specialized PBT code that checks observational equivalence. We discuss the design of Mica and demonstrate its efficacy as a testing tool on various modules taken from real-world OCaml libraries.

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

↑