GithubHelp home page GithubHelp logo

Comments (4)

UnkindPartition avatar UnkindPartition commented on May 23, 2024

I tried to clarify this in 97d5d12.

Is this what you meant? You emphasized "all values", but I don't see why it has to be so. You could write a reduced generator for a large testing space. Can you explain what you mean by consN not working correctly?

from smallcheck.

jwaldmann avatar jwaldmann commented on May 23, 2024

Thanks for following up on this.

I guess the underlying issue is that the specification of the consN functions is left implicit. Example: why is "instance ... where series d = [d]" not a good generator for natural numbers? Note that with Test.SmallCheck.smallCheck, it behaves as a complete enumeration. But the cons2 of two such generators will not produce all pairs, as I was expecting, but only identical pairs.

More formally, I was expecting that the following holds:

Specification: if consN is applied to "complete" generators, the result will be a complete generator (for the product type)

(and a similar statement for the instances (Serial a, Serial b) => Serial (a,b) etc)

where I was assuming the definition of "complete" is "enumeration (with possible repetitions)":

Definition-1 (wrong): a generator (a Serial instance) is called "complete" for a set S, if for each element x in S, there is some d in Int such that x is contained in series d.

but the above example shows that this is not correct, and the truth is more like:

Definition-2: a generator (a Serial instance) is called "complete" for a set S, if the sequence [ series 0, series 1, ...]
is monotonically increasing (w.r.t. inclusion of the underlying sets) and its limit (supremum, union) is S.

Well, since hackage has source links, it's maybe easier to look at the (one-line) implementation of consN. But on the other hand, testing is about separating specification from implementation, so ...

from smallcheck.

UnkindPartition avatar UnkindPartition commented on May 23, 2024

I see. It seems to me that the main confusion was that "series d" should return only values of depth exactly d rather than up to d. But your point about unspecified behaviour of consN is also valid.

I tried to address those in 23d018b and 0340f53.
Please let me know what you think.

from smallcheck.

jwaldmann avatar jwaldmann commented on May 23, 2024

Yes, I like it.

from smallcheck.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.