Skip to main content

every

macrov1.9

cljs.spec/every

(every [pred & {:keys [into kind count max-count min-count distinct gen-max gen-into gen], :as opts}])
takes a pred and validates collection elements against that pred. Note that 'every' does not do exhaustive checking, rather it samples *coll-check-limit* elements. Nor (as a result) does it do any conforming of elements. 'explain' will report at most *coll-error-limit* problems. Thus 'every' should be suitable for potentially large collections. Takes several kwargs options that further constrain the collection: :kind - a pred/spec that the collection type must satisfy, e.g. vector? (default nil) Note that if :kind is specified and :into is not, this pred must generate in order for every to generate. :count - specifies coll has exactly this count (default nil) :min-count, :max-count - coll has count (<= min-count count max-count) (defaults nil) :distinct - all the elements are distinct (default nil) And additional args that control gen :gen-max - the maximum coll size to generate (default 20) :into - one of [], (), {}, #{} - the default collection to generate into (default same as :kind if supplied, else [] Optionally takes :gen generator-fn, which must be a fn of no args that returns a test.check generator See also - coll-of, every-kv

No examples yet. Be the first to add one!