Need to expand tests to cover transducers
Attached patch contains both some generative and example tests for transducers. The generative tests build a series of sequence functions (take 5, filter odd?, etc) and apply them to a random vector of numbers as seq transformations, sequence of transducer, into of transducer, and transduce of transducer. The results are compared.
Note: these tests depend on the patch in CLJ-1349 to run as tests.
Added new patch that whitelists only IllegalArgumentException and ClassCastException as the possible allowed exceptions in the transducer tests (they may vary between the transducer and non-transducer form).
The fbind does build a semantic description already in the :desc key which is used on error. Here's an example error - see the :actions key. That will be a list of the transformations applied (although shrinking often minimizes that list):
Alex, would like to discuss two possible changes
make fbind create a symbolic rep of the work to do, so that failure messages are easier to read
whitelist the exceptions we expect, and check with a predicate in seq-and-transducer-same-result
I updated that testing page to cover test.generative as well.
That page is out of date with respect to running tests with either test.generative or test.check (which doesn't actually exist yet until CLJ-1349).
More complete recipe:
1. Apply CLJ-1349 and patches
4. java -cp `cat maven-classpath`:target/classes:src:test clojure.main
5. (require 'clojure.test-clojure.transducers)
6. (clojure.test/run-tests 'clojure.test-clojure.transducers)
Works for me.
Confusingly, the patch in this test uses test.check, which is a generative test but run in the build (post CLJ-1349) as an example-based test. Stu and I are still talking about the best way to address that. One issue is that test.generative tests are time-based for intensity while test.check is iteration-based.
I will update the patch to remove the require of test.check.
Comment made by: zguangyu
There is no need to require clojure.test.check . I remove it and nothing happens.