<< Back to previous view

[TCHECK-40] Typo: alpha-numeric should be alphanumeric Created: 25/Aug/14  Updated: 27/Aug/14

Status: Open
Project: test.check
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Trivial
Reporter: john walker Assignee: Reid Draper
Resolution: Unresolved Votes: 0
Labels: None

Attachments: File alphanumeric.diff    
Patch: Code and Test


This replaces all instances of alpha-numeric with alphanumeric. This includes renaming the following functions:

char-alpha-numeric -> char-alphanumeric
string-alpha-numeric -> string-alphanumeric

Comment by Reid Draper [ 26/Aug/14 2:22 PM ]

test.check hasn't reached 1.0, so we can break backward compatibility. However, I want to still communicate clearly to users. Maybe we can leave a definition of the hyphenated versions that raises a 'deprecated/removed' exception?

Comment by john walker [ 27/Aug/14 10:44 AM ]

This seems reasonable. Are generators of this form alright?

(defn make-deprecated-generator
  ([msg map]
      (fn [_ _]
        (throw (ex-info msg map)))))
  ([msg map cause]
      (fn [_ _]
        (throw (ex-info msg map cause))))))

  ^{:deprecated "TODO"}
  "DEPRECATED - use char-alphanumeric instead."
  (make-deprecated-generator "DEPRECATED - use char-alphanumeric instead." {:deprecated "TODO"}))

If so, I can supply a macro to create these things. It would attach the metadata like docstrings and the deprecation version to the var, and usage might look like

(def-deprecated-generator char-alpha-numeric 
  "DEPRECATED - use char-alphanumeric instead."
  {:deprecated "TODO"})

[TCHECK-39] such-that stops after 10 tries Created: 23/Aug/14  Updated: 26/Aug/14  Resolved: 26/Aug/14

Status: Resolved
Project: test.check
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Paul Lange Assignee: Reid Draper
Resolution: Declined Votes: 0
Labels: None

clojure 1.5.1, test.check 0.5.9


The documentation for such-that states that "it will keep trying forever" till it finds values that satisfy f.

I use it with a prime? predicate to generate primes: (such-that prime? gen/pos-int)

This sometimes results in this error when running a tc/quick-check which contradicts the docs:
ExceptionInfo Couldn't satisfy such-that predicate after 10 tries. clojure.core/ex-info (core.clj:4327)

Comment by john walker [ 25/Aug/14 5:27 PM ]

Where do you see this in the documentation?


"By default, `such-that` will try 10 times to generate a value that
satisfies the predicate. If no value passes this predicate after this number
of iterations, a runtime exception will be throw." [sic]

Comment by Paul Lange [ 26/Aug/14 2:52 AM ]

Thanks, saw it here (which seem out of date): https://clojure.github.io/test.check/clojure.test.check.generators.html#var-such-that

Comment by Reid Draper [ 26/Aug/14 2:19 PM ]

I've just updated that page. Apologies on it being out of date. Would be nice to have a little version selector thing on it, so you can know you're viewing docs for the version of test.check that you use.

Generated at Wed Aug 27 14:00:14 CDT 2014 using JIRA 4.4#649-r158309.