* Add tests for markdown-clj and tools.namespace
See comment for why only one markdown test could be run.
Closes #1069 and #1064
* Convert 10 test libs using add-libtest
Also improved add-libtest to only require maven artifact
and rely on clojars for getting git-url most of the time
* Convert 8 more test libs using add-libtest
Also updated table and added comment for newline test
* Fix doric test
* Disable tools.namespace test that fails on windows
* Added dozen manual test libs and converted 2 test libs
add-libtest.clj supports manually-added and test-directories options
* Converts last tests to test namespaces and write libraries.csv
* Add a number of library tests from projects.md
Also add more docs around adding test libs and tweak add script
* Use :sha for gitlib and older clojure cli
* Revert "Use :sha for gitlib and older clojure cli"
This reverts commit c663ab8368.
* Fix and disable failing tests
Disabled tests that fail consistently and fixed windows one
35 lines
1.1 KiB
Clojure
35 lines
1.1 KiB
Clojure
(ns clojure.data.generators-test
|
|
(:require [clojure.data.generators :as gen]
|
|
[clojure.test :refer (deftest is)]))
|
|
|
|
(defn print-read-roundtrip
|
|
[o]
|
|
(binding [*print-length* nil
|
|
*print-level* nil]
|
|
(-> o pr-str read-string)))
|
|
|
|
(defn check-print-read-roundtrip
|
|
[o]
|
|
(let [o2 (print-read-roundtrip o)]
|
|
(when-not (= o o2)
|
|
(throw (ex-info "Value cannot roundtrip, see ex-data" {:value o :roundtrip o2})))))
|
|
|
|
(deftest test-print-read-roundtrip
|
|
(dotimes [_ 50]
|
|
(check-print-read-roundtrip (gen/anything))))
|
|
|
|
(deftest test-shuffle
|
|
(dotimes [_ 50]
|
|
(let [coll (gen/vec gen/anything)
|
|
shuf (gen/shuffle coll)]
|
|
(is (= (into #{} coll)
|
|
(into #{} shuf))))))
|
|
|
|
(deftest test-reservoir-sample-consistency
|
|
(dotimes [n 50]
|
|
(let [coll (range 100)
|
|
sample-1 (binding [gen/*rnd* (java.util.Random. n)]
|
|
(gen/reservoir-sample 10 coll))
|
|
sample-2 (binding [gen/*rnd* (java.util.Random. n)]
|
|
(gen/reservoir-sample 10 coll))]
|
|
(is (= sample-1 sample-2)))))
|