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
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
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
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
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