 
 (ns #^{:doc "Lazy Testing Framework"
        :author "Stuart Sierra"}
-  com.stuartsierra.lazytest)
+  com.stuartsierra.lazytest
+  (:require clojure.stacktrace))
 
 ;;; PROTOCOLS
 
+;; Generic reporting function for any Test/Assertion Result
 (defprotocol TestSuccess
   (success? [r] "Returns true if r is a 100% successful result."))
 
+;; Generic entry-point for running tests.
 (defprotocol Testable
   (run-tests [x] "Runs tests defined for the Namespace, Var, or TestCase."))
 
+;; Internal generic Test/Assertion invocation.
 (defprotocol TestInvokable
   (invoke-test [t states strategy active]
                "(private) Executes the TestCase or Assertion."))
 
+;; Fn is assumed to be a compiled Assertion
 (extend-class clojure.lang.Fn TestInvokable
               (invoke-test [f states strategy active] (apply f states)))
 

  "Truly lazy test execution strategy; uses (unchunked) map1."
  [map1 lazy-strategy])

(defn parallel-strategy []
  [pmap parallel-strategy])

(defn parallel-upto


(declare run-test-case compile-assertion)

;; Context sets up state for TestCases that depend on it.  parents is
;; a vector of parent Contexts.  before and after are functions.
;; before takes the same number of arguments as there are parent
;; Contexts.  after takes the same arguments, plus an additional first
;; argument, which is the state returned by the before function.
(deftype Context [parents before after])

;; TestCase represents either a "test", which associates Contexts
;; and Assertions, or a "test suite", which is a collection of tests.
;;
;; contexts is a vector of Contexts.  children is a vector of
;; Assertions (optionally compiled into Fns) or a vector of other
;; TestCases.
(deftype TestCase [contexts children] :as this
  clojure.lang.IFn
  (invoke [] (run-test-case this))
