Skip to content

Can we un-obsolete this? I have use cases. #58

@kindaro

Description

@kindaro

I am not ready to agree that this library is useless and falsify or other randomized checking library should be used instead. I have two use cases unfit for randomized checking. In these use cases, the issue with randomized checking is not that counterexamples are too big. Rather, my use cases require two qualities only SmallCheck and no randomized checking library offers: totality on small examples and immediate access to series.

mathematical properties

This example illustrates the benefit of totality on small examples.

Say you are defining a new group or ring. You surely want that all properties are checked with the additive and multiplicative identity element. But randomized checking does not guarantee this. I have observed this in practice, where my supposed group had a faulty identity — in some runs, the fault will be detected, in other runs, it will be missed. Changing the size and the number of examples checked does not help — the additional examples will only get bigger and bigger, and the identity element is a small one. With SmallCheck, this is not an issue — all the important small elements are always among the first to be generated.

unambiguous parsing

This example illustrates the benefit of immediate access to series.

Say you are defining a language and you wish to have an unambiguous grammar. One approach is to derive a parser and a generator from your grammar, and then see that anything generated is parsed unambiguously. For example, in Haskell, Earley is a library that can automatically derive both a parser and a generator for a given grammar. The function that generates all strings in the language of length up to some number is at once a SmallCheck series, while defining a random generator of strings of a given language may be a non-trivial task of its own, either because of the danger of random combinatorial explosions or because, as in the case of Earley, the library used to define grammars does not provide easy access to the grammar itself, but only offers ready-made parsers and generators.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions