wedge.private.core
Private functions for wedge.core. Do not reference symbols in this ns as they are subject to change
assert-fn-args
(assert-fn-args fn-args)
Asserts that a fn-args parameter is of the correct type. Raises an error if it is not.
fn-args - the fn args parameter to verify
assert-fn-counter
(assert-fn-counter fn-counter)
Asserts that a fn-counter parameter is of the correct type. Raises an error if it is not.
fn-counter - the fn counter parameter to verify
assert-fn-counter-map
(assert-fn-counter-map fn-counter-map)
Asserts that a fn-counter-map parameter is of the correct type. Raises an error if it is not
fn-counter-map - the fn counter map parameter to verify
matches-fn-call
(matches-fn-call preds fn-args)
Tests that all the predicates match a fn call, returning true if they do and falsy if they do not. Predicates will be called on the fn args in order.
The first pred will be called on the first arg, the second pred on the second arg, and so forth
preds - a sequence of fns that take a single parameter and return true if the fn call arg should be included in the fn call count, or falsy otherwise
fn-args - vector containing the args with which the fn under test was called
record-fn-call
(record-fn-call fn-counter-map fn-args)
Records a fn call to a fn counter map, returning the new fn-counter map with the updated fn call counts.
fn-counter-map - the map containing the number of times a fn has been called with certain parameters
fn-args - the vector containing the args with which the fn under test was called
sum-counts
(sum-counts fn-counter-map preds)
Sums all the times a fn was called for the given set of argument predicates. Returns the total number of times a fn was called while under test
fn-counter - fn call counter for a specific fn under test
preds - a sequence of fns that take a single parameter and return true if the fn call arg should be included in the fn call count, or falsy otherwise