Beginner's Luck: A Language for Property-Based Generators

Leonidas Lampropoulos, Diane Gallois-Wong, Catalin Hritcu, John Hughes, Benjamin C. Pierce +1 more
7/19/2016
60 citations
cs.PL

Official code: QuickChick/Luck (38 stars, Haskell, MIT, last commit 2025-02-28).

Abstract

Property-based random testing a la QuickCheck requires building efficient generators for well-distributed random data satisfying complex logical predicates, but writing these generators can be difficult and error prone. We propose a domain-specific language in which generators are conveniently expressed by decorating predicates with lightweight annotations to control both the distribution of generated values and the amount of constraint solving that happens before each variable is instantiated.

Show full abstract

This language, called Luck, makes generators easier to write, read, and maintain. We give Luck a formal semantics and prove several fundamental properties, including the soundness and completeness of random generation with respect to a standard predicate semantics. We evaluate Luck on common examples from the property-based testing literature and on two significant case studies, showing that it can be used in complex domains with comparable bug-finding effectiveness and a significant reduction in testing code size compared to handwritten generators.

View on arXivView PDF

Code Implementations(1)

QuickChick/LuckOfficial100%
MIT

Luck -- A Language for Property-Based Generators

384Haskell, CoqNov 6, 20161 years agoMIT

Similar Papers

Cite this paper

@article{lampropoulos2016beginners,
  title  = {Beginner's Luck: A Language for Property-Based Generators},
  author = {Leonidas Lampropoulos and Diane Gallois-Wong and Catalin Hritcu and John Hughes and Benjamin C. Pierce and Li-yao Xia},
  year   = {2016},
  eprint = {1607.05443},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1607.05443}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/1607.05443.svg)](https://codeofpaper.com/paper/1607.05443)

Discussion