Re: restricting test check input size

2016-07-04 Thread Sebastian Oberhoff
Thanks a lot. I'll have to reflect on this. On Monday, July 4, 2016 at 10:46:04 PM UTC+2, Alex Miller wrote: > > Here's what I came up with for custom generators for this example: > > (def char-set (set (map #(-> % char str symbol) (range (int \a) (inc (int > \z)) > > (s/def ::sym (s/with-gen

Re: restricting test check input size

2016-07-04 Thread Alex Miller
Here's what I came up with for custom generators for this example: (def char-set (set (map #(-> % char str symbol) (range (int \a) (inc (int \z)) (s/def ::sym (s/with-gen simple-symbol? #(s/gen char-set))) (s/def ::not (s/cat :not #{'not} :symbol ::sym)) (s/def ::literal (s/or :symbol ::sy

Re: restricting test check input size

2016-07-04 Thread Sebastian Oberhoff
The remainder of the spec is merely (s/fdef reduce-k-to-3-sat :args (s/cat :cnf-expression ::cnf-expression) :ret ::cnf-expression) (stest/summarize-results (first (stest/test `reduce-k-to-3-sat))) reduce-k-to-3-sat does something like a 3x magnification of the input. On Monday, July 4, 201

Re: restricting test check input size

2016-07-04 Thread Alex Miller
This is a common problem with data generators (whether test.check or any other generator I know of). In general the problem of "giving me random (but not ridiculous) data that will also effectively act as a test" is hard. test.check has a number of controls that can be applied; spec exposes som

restricting test check input size

2016-07-04 Thread Sebastian Oberhoff
I set myself the exercise of converting k-SAT CNF-formulas to 3-SAT formulas, a task that most theoretical computer scientists will be familiar with. For that purpose I defined the spec (s/def ::literal (s/or :symbol symbol? :negated-symbol (s/spec (s/cat :not #{'not} :symbol symbol? (s