Liking cljdoc? Tell your friends :D

code.test.checker.common


->checkerclj

(->checker x)

creates a 'satisfies' checker if not already a checker

((->checker 1) 1) => true

((->checker (exactly 1)) 1) => true

creates a 'satisfies' checker if not already a checker

((->checker 1) 1) => true

((->checker (exactly 1)) 1) => true
raw docstring

anythingclj

(anything x)

a checker that returns true for any value

(anything nil) => true

(anything [:hello :world]) => true

a checker that returns true for any value

(anything nil) => true

(anything [:hello :world]) => true
raw docstring

approxclj

(approx v)
(approx v threshold)

checker that allows approximate verifications

((approx 1) 1.000001) => true

((approx 1) 1.1) => false

((approx 1 0.0000001) 1.001) => false

checker that allows approximate verifications

((approx 1) 1.000001) => true

((approx 1) 1.1) => false

((approx 1 0.0000001) 1.001) => false
raw docstring

capturecljmacro

(capture)
(capture checker)
(capture checker sym)

adds a form to capture test input

adds a form to capture test input
raw docstring

checkerclj

(checker m)

creates a 'code.test.checker.common.Checker' object

(checker {:tag :anything :fn (fn [x] true)}) => code.test.checker.common.Checker

creates a 'code.test.checker.common.Checker' object

(checker {:tag :anything :fn (fn [x] true)})
=> code.test.checker.common.Checker
raw docstring

checker?clj

(checker? x)

checks to see if a datastructure is a 'code.test.checker.common.Checker'

(checker? (checker {:tag :anything :fn (fn [x] true)})) => true

checks to see if a datastructure is a 'code.test.checker.common.Checker'

(checker? (checker {:tag :anything :fn (fn [x] true)}))
=> true
raw docstring

exactlyclj

(exactly v)
(exactly v function)

checker that allows exact verifications

((exactly 1) 1) => true

((exactly Long) 1) => false

((exactly number?) 1) => false

checker that allows exact verifications

((exactly 1) 1) => true

((exactly Long) 1) => false

((exactly number?) 1) => false
raw docstring

function-stringclj

(function-string func)

returns the string representation of a function

(function-string every?) => "every?"

(function-string reset!) => "reset!"

returns the string representation of a function

(function-string every?) => "every?"

(function-string reset!) => "reset!"
raw docstring

satisfiesclj

(satisfies v)
(satisfies v function)

checker that allows loose verifications

((satisfies 1) 1) => true

((satisfies Long) 1) => true

((satisfies number?) 1) => true

((satisfies #{1 2 3}) 1) => true

((satisfies [1 2 3]) 1) => false

((satisfies number?) "e") => false

((satisfies #"hello") #"hello") => true

checker that allows loose verifications

((satisfies 1) 1) => true

((satisfies Long) 1) => true

((satisfies number?) 1) => true

((satisfies #{1 2 3}) 1) => true

((satisfies [1 2 3]) 1) => false

((satisfies number?) "e") => false

((satisfies #"hello") #"hello") => true
raw docstring

storesclj

(stores v)

a checker that looks into a ref object

((stores 1) (volatile! 1)) => true

((stores 1) 1) => false

a checker that looks into a ref object

((stores 1) (volatile! 1)) => true

((stores 1) 1) => false
raw docstring

succeeded?clj

(succeeded? {:keys [status data]})

determines if the results of a check have succeeded

(-> (satisfies Long) (verify 1) succeeded?) => true

(-> (satisfies even?) (verify 1) succeeded?) => false

determines if the results of a check have succeeded

(-> (satisfies Long)
    (verify 1)
    succeeded?)
=> true

(-> (satisfies even?)
    (verify 1)
    succeeded?)
=> false
raw docstring

throwsclj

(throws)
(throws e)
(throws e msg)

checker that determines if an exception has been thrown

((throws Exception "Hello There") (res/result {:status :exception :data (Exception. "Hello There")})) => true

checker that determines if an exception has been thrown

((throws Exception "Hello There")
 (res/result
  {:status :exception
   :data (Exception. "Hello There")}))
=> true
raw docstring

verifyclj

(verify ck result)

verifies a value with it's associated check

(verify (satisfies 2) 1) => (contains-in {:status :success :data false :checker {:tag :satisfies :doc string? :expect 2} :actual 1 :from :verify})

(verify (->checker #(/ % 0)) 1) => (contains {:status :exception :data java.lang.ArithmeticException :from :verify})

verifies a value with it's associated check

(verify (satisfies 2) 1)
=> (contains-in {:status :success
                 :data false
                 :checker {:tag :satisfies
                           :doc string?
                           :expect 2}
                 :actual 1
                 :from :verify})

(verify (->checker #(/ % 0)) 1)
=> (contains {:status :exception
              :data java.lang.ArithmeticException
              :from :verify})
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close