;; This Source Code Form is subject to the terms of the Mozilla Public ;; License, v. 2.0. If a copy of the MPL was not distributed with this ;; file, You can obtain one at http://mozilla.org/MPL/2.0/. ;; ;; Copyright (c) UXBOX Labs SL (ns user (:require [clojure.java.io :as io] [clojure.pprint :refer [pprint print-table]] [clojure.repl :refer :all] [clojure.spec.alpha :as s] [clojure.spec.gen.alpha :as sgen] [clojure.test :as test] [clojure.tools.namespace.repl :as repl] [clojure.walk :refer [macroexpand-all]] [criterium.core :refer [quick-bench bench with-progress-reporting]])) ;; --- Benchmarking Tools (defmacro run-quick-bench [& exprs] `(with-progress-reporting (quick-bench (do ~@exprs) :verbose))) (defmacro run-quick-bench' [& exprs] `(quick-bench (do ~@exprs))) (defmacro run-bench [& exprs] `(with-progress-reporting (bench (do ~@exprs) :verbose))) (defmacro run-bench' [& exprs] `(bench (do ~@exprs))) ;; --- Development Stuff (defn- run-tests ([] (run-tests #"^app.common.*-test$")) ([o] (repl/refresh) (cond (instance? java.util.regex.Pattern o) (test/run-all-tests o) (symbol? o) (if-let [sns (namespace o)] (do (require (symbol sns)) (test/test-vars [(resolve o)])) (test/test-ns o)))))