Automatic Synthesis of Random Generators for Numerically Constrained Algebraic Recursive Types

08/26/2022
by   Ghiles Ziat, et al.
0

In program verification, constraint-based random testing is a powerful technique which aims at generating random test cases that satisfy functional properties of a program. However, on recursive constrained data-structures (e.g., sorted lists, binary search trees, quadtrees), and, more generally, when the structures are highly constrained, generating uniformly distributed inputs is difficult. In this paper, we present Testify: a framework in which users can define algebraic data-types decorated with high-level constraints. These constraints are interpreted as membership predicates that restrict the set of inhabitants of the type. From these definitions, Testify automatically synthesises a partial specification of the program so that no function produces a value that violates the constraints (e.g. a binary search tree where nodes are improperly inserted). Our framework augments the original program with tests that check such properties. To achieve that, we automatically produce uniform random samplers that generate values which satisfy the constraints, and verifies the validity of the outputs of the tested functions. By generating the shape of a recursive data-structure using Boltzmann sampling and generating evenly distributed finite domain variable values using constraint solving, our framework guarantees size-constrained uniform sampling of test cases. We provide use-cases of our framework on several key data structures that are of practical relevance for developers. Experiments show encouraging results.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
04/25/2018

Shape Neutral Analysis of Graph-based Data-structures

Malformed data-structures can lead to runtime errors such as arbitrary m...
research
07/03/2019

Using binary decision diagrams for constraint handling in combinatorial interaction testing

Constraints among test parameters often have substantial effects on the ...
research
04/06/2023

Covering All the Bases: Type-Based Verification of Test Input Generators

Test input generators are an important part of property-based testing (P...
research
06/14/2022

Automatic compile-time synthesis of entropy-optimal Boltzmann samplers

We present a famework for the automatic compilation of multi-parametric ...
research
09/09/2023

pun: Fun with Properties; Towards a Programming Language With Built-in Facilities for Program Validation

Property-based testing is a powerful method to validate program correctn...
research
04/09/2021

Automatically Enforcing Fresh and Consistent Inputs in Intermittent Systems

Intermittently powered energy-harvesting devices enable new applications...
research
08/04/2018

Branching Processes for QuickCheck Generators

In QuickCheck (or, more generally, random testing), it is challenging to...

Please sign up or login with your details

Forgot password? Click here to reset