ANN: double-check, a Clojure/ClojureScript-portable fork of simple-check

133 views
Skip to first unread message

Chas Emerick

unread,
Nov 21, 2013, 11:38:16 AM11/21/13
to clojur...@googlegroups.com, clo...@googlegroups.com
Reid Draper's simple-check[1] is a generative/property-based testing
library for Clojure that implements (and improves upon IMO) the
shrinking of failing test cases seen in e.g. quickcheck in the Haskell
and Erlang lands.

simple-check has totally changed how I do certain kinds of testing. From
the beginning, I've wanted to use it when testing ClojureScript
libraries and apps as well, since most of my ClojureScript code is
portable to Clojure, or made that way with cljx[2].

The result is double-check, a fork of simple-check that provides the
same API and generator semantics for Clojure and ClojureScript:

https://github.com/cemerick/double-check

double-check will fast-follow the development of simple-check, aiming to
provide nothing more than a portable API; there should never be anything
novel or interesting in double-check, except for the recasting of the
simple-check codebase into a portable form.

Naturally, double-check adds support/integration for
clojurescript.test[3] where simple-check supports/integrates clojure.test.

I've discovered (and reported and/or fixed) a number of issues in
ClojureScript itself solely by making simple-check's own tests portable,
and running them on ClojureScript. I suspect you'll have the same
experience with your own Clojure/ClojureScript projects once you apply
double-check to them.

Cheers,

- Chas

[1] https://github.com/reiddraper/simple-check
[2] https://github.com/lynaghk/cljx
[3] https://github.com/cemerick/clojurescript.test

Chas Emerick

unread,
Nov 21, 2013, 2:31:19 PM11/21/13
to clo...@googlegroups.com, clojur...@googlegroups.com, Max Penet
simple-check is planning on remaining Clojure-only, at least for the
foreseeable future. This "non-fork fork" is the best alternative Reid
and I could come up with to enable people to use it on both Clojure and
ClojureScript. Hopefully double-check will be unnecessary at some
point. :-)

- Chas

On Thu 21 Nov 2013 02:01:02 PM EST, Max Penet wrote:
> Looks good!
>
> I am wondering though, why not merging your work on the parent project
> instead of creating a new one (with a new name etc), you seemed to be
> on your way of doing just this?
>
> On Thursday, November 21, 2013 5:38:16 PM UTC+1, Chas Emerick wrote:
>
> Reid Draper's simple-check[1] is a generative/property-based testing
> library for Clojure that implements (and improves upon IMO) the
> shrinking of failing test cases seen in e.g. quickcheck in the
> Haskell
> and Erlang lands.
>
> simple-check has totally changed how I do certain kinds of
> testing. From
> the beginning, I've wanted to use it when testing ClojureScript
> libraries and apps as well, since most of my ClojureScript code is
> portable to Clojure, or made that way with cljx[2].
>
> The result is double-check, a fork of simple-check that provides the
> same API and generator semantics for Clojure and ClojureScript:
>
> https://github.com/cemerick/double-check
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fcemerick%2Fdouble-check&sa=D&sntz=1&usg=AFQjCNGMdmXeOnf3w2MMaq09pIO9XEqONw>
>
>
> double-check will fast-follow the development of simple-check,
> aiming to
> provide nothing more than a portable API; there should never be
> anything
> novel or interesting in double-check, except for the recasting of the
> simple-check codebase into a portable form.
>
> Naturally, double-check adds support/integration for
> clojurescript.test[3] where simple-check supports/integrates
> clojure.test.
>
> I've discovered (and reported and/or fixed) a number of issues in
> ClojureScript itself solely by making simple-check's own tests
> portable,
> and running them on ClojureScript. I suspect you'll have the same
> experience with your own Clojure/ClojureScript projects once you
> apply
> double-check to them.
>
> Cheers,
>
> - Chas
>
> [1] https://github.com/reiddraper/simple-check
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Freiddraper%2Fsimple-check&sa=D&sntz=1&usg=AFQjCNENCgO1ktV_VfKH71w4oza6yEE0xw>
>
> [2] https://github.com/lynaghk/cljx
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Flynaghk%2Fcljx&sa=D&sntz=1&usg=AFQjCNErrEPQTKkQAd-ma4oaCPVdW8BUJQ>
>
> [3] https://github.com/cemerick/clojurescript.test
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fcemerick%2Fclojurescript.test&sa=D&sntz=1&usg=AFQjCNGiV-NGOk4wuDpgDkZolznHF5c1Dg>
>
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient
> with your first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to clojure+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Stephen Cagle

unread,
Nov 21, 2013, 2:57:20 PM11/21/13
to clo...@googlegroups.com, clojur...@googlegroups.com, Max Penet
Did you try out test.generative? If so, how does simple check contrast to test.generative?

Chas Emerick

unread,
Nov 21, 2013, 6:07:31 PM11/21/13
to clojur...@googlegroups.com
test.generative does enable testing with generated data, but it doesn't
provide any shrinking. It was still helpful when I used it, but
depending on the properties / specifications you're testing, the
generated data can be *very* large, deeply nested, etc. Still useful
for finding failing test cases (and way better than e.g. some fixed
number of artisanal unit tests), but not as magical as when
simple-check/quickcheck/double-check shrinks a deeply-nested data
structure to something like the minimal failing case for a particular
property.

I became a convert when simple-check shrunk an initial failure case of
a nested set of vectors that pr-str'd to something like 50k down to a
flat 10-element vector that contained some nils and a few oddly-shaped
keywords.

- Chas
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fcemerick%2Fdouble-check&sa=D&sntz=1&usg=AFQjCNGMdmXeOnf3w2MMaq09pIO9XEqONw
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fcemerick%2Fdouble-check&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNGMdmXeOnf3w2MMaq09pIO9XEqONw>>
>
> >
> >
> > double-check will fast-follow the development of simple-check,
> > aiming to
> > provide nothing more than a portable API; there should never be
> > anything
> > novel or interesting in double-check, except for the
> recasting of the
> > simple-check codebase into a portable form.
> >
> > Naturally, double-check adds support/integration for
> > clojurescript.test[3] where simple-check supports/integrates
> > clojure.test.
> >
> > I've discovered (and reported and/or fixed) a number of
> issues in
> > ClojureScript itself solely by making simple-check's own tests
> > portable,
> > and running them on ClojureScript. I suspect you'll have
> the same
> > experience with your own Clojure/ClojureScript projects once
> you
> > apply
> > double-check to them.
> >
> > Cheers,
> >
> > - Chas
> >
> > [1] https://github.com/reiddraper/simple-check
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Freiddraper%2Fsimple-check&sa=D&sntz=1&usg=AFQjCNENCgO1ktV_VfKH71w4oza6yEE0xw>
>
> >
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Freiddraper%2Fsimple-check&sa=D&sntz=1&usg=AFQjCNENCgO1ktV_VfKH71w4oza6yEE0xw
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Freiddraper%2Fsimple-check&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNENCgO1ktV_VfKH71w4oza6yEE0xw>>
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Flynaghk%2Fcljx&sa=D&sntz=1&usg=AFQjCNErrEPQTKkQAd-ma4oaCPVdW8BUJQ
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Flynaghk%2Fcljx&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNErrEPQTKkQAd-ma4oaCPVdW8BUJQ>>
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fcemerick%2Fclojurescript.test&sa=D&sntz=1&usg=AFQjCNGiV-NGOk4wuDpgDkZolznHF5c1Dg
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fcemerick%2Fclojurescript.test&amp;sa=D&amp;sntz=1&amp;usg=AFQjCNGiV-NGOk4wuDpgDkZolznHF5c1Dg>>
>
> >
> >
> > --
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To post to this group, send email to clo...@googlegroups.com
> <javascript:>
> > Note that posts from new members are moderated - please be patient
> > with your first post.
> > To unsubscribe from this group, send email to
> > clojure+u...@googlegroups.com <javascript:>
> > For more options, visit this group at
> > http://groups.google.com/group/clojure?hl=en
> <http://groups.google.com/group/clojure?hl=en>
> > ---
> > You received this message because you are subscribed to the Google
> > Groups "Clojure" group.
> > To unsubscribe from this group and stop receiving emails from
> it, send
> > an email to clojure+u...@googlegroups.com <javascript:>.
> > For more options, visit https://groups.google.com/groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
> --
> Note that posts from new members are moderated - please be patient
> with your first post.
> ---
> You received this message because you are subscribed to the Google
> Groups "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to clojurescrip...@googlegroups.com.
> To post to this group, send email to clojur...@googlegroups.com.
> Visit this group at http://groups.google.com/group/clojurescript.
Reply all
Reply to author
Forward
0 new messages