Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt an initial migration to test.generative 1.0.0 #198

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
:exclusions [com.fasterxml.jackson.core/jackson-databind]]
[tigris "0.1.2"]]
:profiles {:dev {:dependencies [[org.clojure/clojure "1.11.1"]
[org.clojure/test.generative "0.1.4"]
[org.clojure/test.generative "1.0.0"]
[org.clojure/tools.namespace "0.3.1"]]}
:1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]}
:1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
Expand Down
27 changes: 11 additions & 16 deletions test/cheshire/test/generative.clj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(ns cheshire.test.generative
(:use [cheshire.core]
[clojure.test.generative]
[clojure.test :only [deftest is]]))

;; determines whether generative stuff is printed to stdout
(def verbose true)
(:require
[cheshire.core :refer [decode encode]]
[clojure.data.generators]
[clojure.test :refer [deftest is]]
[clojure.test.generative :refer [defspec]]
[clojure.test.generative.runner :as runner]))

(defn encode-equality [x]
[x (decode (encode x))])
Expand Down Expand Up @@ -43,13 +43,8 @@
(is (= (first %) (last %))))

(deftest ^{:generative true} t-generative
;; I want the seeds to change every time, set the number higher if
;; you have more than 16 CPU cores
(let [seeds (take 16 (repeatedly #(rand-int 1024)))]
(when-not verbose
(reset! report-fn identity))
(println "Seeds:" seeds)
(binding [*msec* 25000
*seeds* seeds
*verbose* false]
(doall (map deref (test-namespaces 'cheshire.test.generative))))))
(runner/run-suite {:nthreads (-> (Runtime/getRuntime) .availableProcessors)
:msec 25000
:progress (constantly true)}
(->> 'cheshire.test.generative ns-interns vals
(mapcat runner/get-tests))))