 (assert (= ::TestCase (type t11)))
 (assert (= [c4 c5] (:contexts t11)))
 (assert (= [t9 t10] (:children t11)))
+
+
+;; README examples
+    (defassert positive [x] (pos? x))
+    (success? (positive 1))
+    ;;=> true
+    (success? (positive -1))
+    ;;=> false
+    (success? (positive "hello"))
+    ;;=> false
+    (deftest addition [a 1, b 2]
+      (integer? a)
+      (integer? b)
+      (integer? (+ a b)))
+    (success? (addition))
+    ;;=> true
+    (defcontext random-int []
+      (rand-int Integer/MAX_VALUE))
+    (deftest random-addition [a random-int, b random-int]
+      (integer? (+ a b))
+      (= (+ a b) (+ b a)))
+
+    (success? (random-addition))
+    ;;=> true
+    (defsuite all-tests [] addition random-addition)
+
+    (success? (all-tests))
+    ;;=> true

  (eval (format-assertion a)))
 
(defmacro assertion [locals & body]
  (format-assertion (Assertion locals `(do ~@body))))

(defmacro defassert
  "Defines an Assertion.

  TestResult and all its children."
  [r]
  (tree-seq :children :children r))

(require 'clojure.stacktrace)

(defn result-identifier [r]
  (let [m (meta (:source r))]
    (or (:name m) (:form m)
        (:source r))))

(defn simple-report
  ([r] (simple-report r ""))
  ([r indent]
     (cond (= ::TestResult (type r))
           (do (println indent (if (success? r) "OK" "TEST")
                        (result-identifier r))
               (doseq [c (:children r)]
                 (simple-report c (str indent "   "))))

           (= ::TestThrown (type r))
           (do (println indent "ERROR" (result-identifier r))
               (when-let [d (:doc (meta r))] (prn d))
               (clojure.stacktrace/print-cause-trace (:error r)))

           (= ::AssertionPassed (type r))
           (println indent "OK" (result-identifier r))

           (= ::AssertionFailed (type r))
           (do (println indent "FAIL" (result-identifier r))
               (when-let [d (:doc (meta r))] (prn d)))

           (= ::AssertionThrown (type r))
           (do (println indent "ERROR" (result-identifier r))
               (when-let [d (:doc (meta r))] (prn d))
               (clojure.stacktrace/print-cause-trace (:error r))))))


;;; TESTABLE IMPLEMENTATIONS
