Testing framework: improvement on random generation and module PBT
type:added
For LIGO developers
This MR improves a bit the handling of property-based testing, as now it allows generators of small values. It also implements the PBT
module in the testlib.
Changelog details:
Test.PBT
A new module This new module is introduced to do simple property-based testing. It's composed of:
-
val gen : 'a pbt_gen
: gives a generator for type'a
(must be annotated). -
val gen_small : 'a pbt_gen
: : gives a small generator for type'a
(must be annotated). -
val make_test : 'a pbt_gen -> ('a -> bool) -> 'a pbt_test
: creates a test from a generator and a property. -
val run : 'a pbt_test -> nat -> 'a pbt_result
: runs a test for a given number of tries. The introduced types are: -
type 'a pbt_gen
: represents a generator for a type. -
type 'a pbt_test
: represents a test for a type. -
type 'a pbt_result = Success | Fail of 'a
: represents the result of running a test.
Edited by E. Rivas