Advertisement
Guest User

compare test

a guest
Mar 16th, 2011
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (defmacro defcomparisontest
  2.   "Define a GReQL/FunQL comparison test with name n on graph g that asserts the
  3. equality of the results evaluating greql and funql."
  4.   [n g greql funql]
  5.   `(deftest ~n
  6.      ~g ;; ensure the graph is loaded, if it is given as memoized function.
  7.      (println "####################################################")
  8.      (println "Comparison test:" ~(name n))
  9.      (is (=
  10.       (do
  11.         (print "GReQL evaluation time:")
  12.         (jvalue-unpack (time (greql-eval ~g ~greql))))
  13.       (do
  14.         (print "FunQL evaluation time:")
  15.         ;; Ensure that we realize LazySeqs completely, to get a fair
  16.         ;; timing.
  17.         (time (let [r# ~funql]
  18.             (if (instance? clojure.lang.LazySeq r#)
  19.               (doall r#)
  20.               r#))))))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement