Mica: Automated Differential Testing for OCaml Modules

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Ng, Ernest, Goldstein, Harrison, Pierce, Benjamin C.
Format: Preprint
Published: 2024
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866914924861587456
author Ng, Ernest
Goldstein, Harrison
Pierce, Benjamin C.
author_facet Ng, Ernest
Goldstein, Harrison
Pierce, Benjamin C.
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2408_14561
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Mica: Automated Differential Testing for OCaml Modules
Ng, Ernest
Goldstein, Harrison
Pierce, Benjamin C.
Programming Languages
Software Engineering
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.
title Mica: Automated Differential Testing for OCaml Modules
topic Programming Languages
Software Engineering
url https://arxiv.org/abs/2408.14561