File tree Expand file tree Collapse file tree 2 files changed +35
-14
lines changed
Expand file tree Collapse file tree 2 files changed +35
-14
lines changed Original file line number Diff line number Diff line change 486486 ([name sym-or-syms] `(defspec-test ~name ~sym-or-syms nil ))
487487 ([name sym-or-syms opts]
488488 `(t/deftest ~name (do-spec-check-report ~sym-or-syms ~opts))))
489+
490+ #?(:clj (defmacro is-spec-check
491+ " Runs generative tests for spec conformance and reports results.
492+ Equivalent to (is (spec-check ...)) but more direct.
493+
494+ See `spec-check` for available options."
495+ ([sym-or-syms] `(is-spec-check ~sym-or-syms {}))
496+ ([sym-or-syms opts]
497+ `(do-spec-check-report ~sym-or-syms ~opts))))
498+
499+ #?(:clj (defmacro is-spec-check-with-gen
500+ " Runs generative tests with custom generators and reports results.
501+ Takes gen-map as first argument for convenience when custom generators
502+ are always needed.
503+
504+ gen-map is a map from spec names to generator functions.
505+ See `spec-check` for other available options."
506+ ([gen-map sym-or-syms] `(is-spec-check-with-gen ~gen-map ~sym-or-syms {}))
507+ ([gen-map sym-or-syms opts]
508+ (let [merged-opts (merge {:gen gen-map} opts)]
509+ `(do-spec-check-report ~sym-or-syms ~merged-opts)))))
Original file line number Diff line number Diff line change 171171 (t/is-valid int? 1 ))
172172
173173(deftest data-approx=-test
174- (is ( t/ data-approx=
175- {:a 1.0
176- :b #{1.0 }}
177- {:a 1.0000001
178- :b #{1.0 }}) )
179- (is ( t/ data-approx=
180- {:a 1.0 }
181- {:a 1.001 }
182- { :tolerance 1e-2 }) )
183- (is ( t/ data-approx= [[1.0000001 ]] [[1.0 ]]) )
184- (is ( not (t/data-approx= {:a 1 } {:b 1 }) ))
185- (is ( not (t/data-approx=
186- {:a 1.0 }
187- {:a 1.01 }) )))
174+ (t/is- data-approx=
175+ {:a 1.0
176+ :b #{1.0 }}
177+ {:a 1.0000001
178+ :b #{1.0 }})
179+ (t/is- data-approx=
180+ {:a 1.0 }
181+ {:a 1.001 }
182+ :tolerance 1e-2 )
183+ (t/is- data-approx= [[1.0000001 ]] [[1.0 ]])
184+ (t/is- not (#' t/data-approx= {:a 1 } {:b 1 }))
185+ (t/is- not (#' t/data-approx=
186+ {:a 1.0 }
187+ {:a 1.01 })))
You can’t perform that action at this time.
0 commit comments