Need to expand tests to cover transducers
Description
Environment
Attachments
Activity
Alex Miller November 12, 2014 at 6:08 PM
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):
Stuart Halloway November 10, 2014 at 6:15 PM
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 readwhitelist the exceptions we expect, and check with a predicate in
seq-and-transducer-same-result
Alex Miller November 3, 2014 at 5:14 PM
I updated that testing page to cover test.generative as well.
Alex Miller November 3, 2014 at 4:46 PM
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
2. ./antsetup.sh
3. ant
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.
import November 2, 2014 at 6:46 AM
Comment made by: zguangyu
There is no need to require clojure.test.check . I remove it and nothing happens.
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.
Patch: clj-1554-5.patch