code.test.checker.collection

contains

added in 3.0

(contains x & modifiers)

checker for maps and vectors

((contains {:a odd? :b even?}) {:a 1 :b 4}) => true

((contains {:a 1 :b even?}) {:a 2 :b 4}) => false

((contains 1 2 3) 1 2 3 4) => true

((contains 1 3) 1 2 3 4) => false

contains-in

macro

added in 3.0

(contains-in x)

shorthand for checking nested maps and vectors

((contains-in {:a {:b {:c odd?}}}) {:a {:b {:c 1 :d 2}}}) => true

((contains-in odd? {:a {:b even?}}) 3 {:a {:b 4 :c 5}}) => true

contains-map

added in 3.0

(contains-map x)

map check helper function for contains

contains-set

added in 3.0

(contains-set x)

set check helper function for contains

((contains-set #{1 2 3}) 1 2 3 4 5) => true

((contains-set #{1 2 4}) 1 2 3 4 5) => false

contains-vector

added in 3.0

(contains-vector x)(contains-vector x modifiers)

vector check helper function for contains

just

added in 3.0

(just x & modifiers)

combination checker for both maps and vectors

((just {:a odd? :b even?}) {:a 1 :b 4}) => true

((just {:a 1 :b even?}) {:a 1 :b 2 :c 3}) => false

((just 1 2 3 4) 1 2 3 4) => true

((just 1 2 3) 1 2 3 4) => false

((just 3 2 4 1 :in-any-order) 1 2 3 4) => true

just-in

macro

added in 3.0

(just-in x)

shorthand for exactly checking nested maps and vectors

((just-in {:a {:b {:c odd?}}}) {:a {:b {:c 1 :d 2}}}) => false

((just-in odd? {:a {:b even?}}) 3 {:a {:b 4}})

((just-in odd? {:a {:b even?}}) 3 {:a {:b 4}}) => true

just-map

added in 3.0

(just-map x)

map check helper function for just

just-set

added in 3.0

(just-set x)

set check helper function for just

((just-set #{1 2 3}) 1 2 3) => true

just-vector

added in 3.0

(just-vector x)(just-vector x modifiers)

vector check helper function for just

throws-info

added in 3.0

(throws-info)(throws-info m)

checker that determines if an ex-info has been thrown

((throws-info {:a “hello” :b “there”}) (process/evaluate {:form ’(throw (ex-info “hello” {:a “hello” :b “there”}))})) => true

verify-map

added in 3.0

(verify-map ck data)

takes two maps and determines if they fit (verify-map {:a (base/satisfies odd?) :b (base/satisfies even?)} {:a 1 :b 2}) => true

verify-seq

added in 3.0

(verify-seq ck data modifiers)

takes two seqs and determines if they fit (verify-seq (base/satisfies 1) (base/satisfies 2) 2 1 #{:in-any-order}) => true

(verify-seq (base/satisfies 1) (base/satisfies 2) 2 3 1 #{:in-any-order :gaps-ok}) => true