SHARE
TWEET

Untitled

a guest Mar 16th, 2011 74 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 all funqls."
  4.   [n g greql & funqls]
  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.      (let [gr# (do
  10.                  (print "GReQL evaluation time:")
  11.                  (jvalue-unpack (time (greql-eval ~g ~greql))))]
  12.        (doseq [funql# '~funqls]
  13.            (print "FunQL evaluation time:")
  14.            (is (= gr#
  15.                   (time (let [r# (eval funql#)]
  16.                           (if (instance? clojure.lang.LazySeq r#)
  17.                             (doall r#)
  18.                             r#)))))))))
  19.  
  20. funql.test.core> (macroexpand-1 '(defcomparisontest first-100-edges-in-eseq (gbjg) "edgeSeq(E[0], E[99])" (take 100 (eseq (gbjg)))))
  21.  
  22. (clojure.test/deftest first-100-edges-in-eseq (gbjg)
  23.   (clojure.core/println "####################################################")
  24.   (clojure.core/println "Comparison test:" "first-100-edges-in-eseq")
  25.   (clojure.core/let [gr__16923__auto__
  26.                      (do
  27.                        (clojure.core/print "GReQL evaluation time:")
  28.                        (funql.test.core/jvalue-unpack
  29.                         (clojure.core/time
  30.                          (funql.test.core/greql-eval (gbjg) "edgeSeq(E[0], E[99])"))))]
  31.                     (clojure.core/doseq [funql__16924__auto__ (quote ((take 100 (eseq (gbjg)))))]
  32.                                         (clojure.core/print "FunQL evaluation time:")
  33.                                         (clojure.test/is
  34.                                          (clojure.core/=
  35.                                           gr__16923__auto__
  36.                                           (clojure.core/time
  37.                                            (clojure.core/let [r__16925__auto__ (clojure.core/eval funql__16924__auto__)]
  38.                                                              (if (clojure.core/instance? clojure.lang.LazySeq r__16925__auto__)
  39.                                                                (clojure.core/doall r__16925__auto__)
  40.                                                                r__16925__auto__))))))))
  41.  
  42. But I get this error when running the test.  eseq is a function in funql.core, which my test file uses in its ns declaration.
  43.  
  44.   actual: clojure.lang.Compiler$CompilerException: java.lang.Exception: Unable to resolve symbol: eseq in this context (NO_SOURCE_FILE:395)
  45.  at clojure.lang.Compiler.analyze (Compiler.java:5205)
  46.     clojure.lang.Compiler.analyze (Compiler.java:5151)
  47.     clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3036)
  48.     clojure.lang.Compiler.analyzeSeq (Compiler.java:5371)
  49.     clojure.lang.Compiler.analyze (Compiler.java:5190)
  50.     clojure.lang.Compiler.analyze (Compiler.java:5151)
  51.     clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3057)
  52.     clojure.lang.Compiler.analyzeSeq (Compiler.java:5371)
  53.     clojure.lang.Compiler.analyze (Compiler.java:5190)
  54.     clojure.lang.Compiler.analyze (Compiler.java:5151)
  55.     clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:4670)
  56.     clojure.lang.Compiler$FnMethod.parse (Compiler.java:4328)
  57.     clojure.lang.Compiler$FnExpr.parse (Compiler.java:3173)
  58.     clojure.lang.Compiler.analyzeSeq (Compiler.java:5367)
  59.     clojure.lang.Compiler.analyze (Compiler.java:5190)
  60.     clojure.lang.Compiler.eval (Compiler.java:5421)
  61.     clojure.lang.Compiler.eval (Compiler.java:5391)
  62.     clojure.core$eval.invoke (core.clj:2382)
  63.     funql.test.core$fn__774$fn__786.invoke (core.clj:393)
  64.     funql.test.core/fn (core.clj:393)
  65.     ...
  66. Caused by: java.lang.Exception: Unable to resolve symbol: eseq in this context
  67.  at clojure.lang.Compiler.resolveIn (Compiler.java:5677)
  68.     clojure.lang.Compiler.resolve (Compiler.java:5621)
  69.     clojure.lang.Compiler.analyzeSymbol (Compiler.java:5584)
  70.     clojure.lang.Compiler.analyze (Compiler.java:5172)
  71.     clojure.lang.Compiler.analyze (Compiler.java:5151)
  72.     clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3036)
  73.     clojure.lang.Compiler.analyzeSeq (Compiler.java:5371)
  74.     clojure.lang.Compiler.analyze (Compiler.java:5190)
  75.     clojure.lang.Compiler.analyze (Compiler.java:5151)
  76.     clojure.lang.Compiler$InvokeExpr.parse (Compiler.java:3057)
  77.     clojure.lang.Compiler.analyzeSeq (Compiler.java:5371)
  78.     clojure.lang.Compiler.analyze (Compiler.java:5190)
  79.     clojure.lang.Compiler.analyze (Compiler.java:5151)
  80.     clojure.lang.Compiler$BodyExpr$Parser.parse (Compiler.java:4670)
  81.     clojure.lang.Compiler$FnMethod.parse (Compiler.java:4328)
  82.     clojure.lang.Compiler$FnExpr.parse (Compiler.java:3173)
  83.     clojure.lang.Compiler.analyzeSeq (Compiler.java:5367)
  84.     clojure.lang.Compiler.analyze (Compiler.java:5190)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top