 ;NOTE: do not forget to clean all tested projects before running the tests
 ;TODO: fix that :)
 
-
-;see http://richhickey.github.com/clojure/clojure.test-api.html for api
-;followed http://twoguysarguing.wordpress.com/2010/03/24/fixies/ to workaround limitations regarding setup/teardown of in
-
-
-;; Supporting functions
-;; --------------------
-
-;; Test setup / teardown
-
-(defn
-  with-ekeko-disabled
-  [f]
-  (println "Disabling Ekeko nature on all projects.")
-  (spm/workspace-disable-soot!)
-  (ws/workspace-disable-ekeko!)
-  (ws/workspace-wait-for-builds-to-finish)
-  (f))
-    
-(defn
-  against-project
-  [p enable-soot? f]
-  (try
-    (println "Enabling Ekeko nature on project: " p)
-    (ws/workspace-project-enable-ekeko! p)
-    (ws/workspace-wait-for-builds-to-finish)
-    (when 
-      enable-soot?
-      (do
-        (println "Enabling Soot nature on project: " p)
-        (spm/enable-soot-nature! p)))
-    (f)
-    (finally
-      (println "Disabling Ekeko nature for project: " p)
-      (when 
-        enable-soot?
-        (do
-          (println "Disabling Soot nature for project: " p)
-          (spm/disable-soot-nature! p)))
-      (ws/workspace-project-disable-ekeko! p))))
-
-(defn
-  against-project-named
-  [n enable-soot? f]
-  (against-project (ws/workspace-project-named n) enable-soot? f))
-
-
-;; Query results
-
-(defn
-  tuples-to-stringset
-  "For a sequence of sequences (e.g., query results), converts each inner sequence 
-   element to a string and returns the resulting set of converted inner sequences."
-  [seqofseqs]
-  (set (map (partial map str) seqofseqs)))
-
-(defn
-  tuples-to-stringsetstring
-  "For a sequence of sequences (e.g., query results), converts each inner sequence 
-   element to a string and returns the string representation of the resulting set of
-   converted inner sequences.
-
-   Run this on the results of a working query to transform them to a string that is
-   used for the tests. For example:
-   (tuples-to-stringsetstring (damp.ekeko/ekeko [?itmethod]
-           (assumptions/intertypemethod-unused ?itmethod)))"
-  [seqofseqs]
-  (str (tuples-to-stringset seqofseqs)))
-
-(defn
-  tuples-are
-  "Verifies whether the stringset representation of the tuples corresponds to the given string
-   (obtained through tuples-to-stringsetstring)."
-  [tuples stringsetstring]
-  (is 
-    (empty?
-      (clojure.set/difference
-        (tuples-to-stringset tuples)
-        (read-string stringsetstring)))))
 
 ;; Actual Tests
 ;; ------------


(deftest
  explicit-decprec+-test 
  (tuples-are 
    (ekeko [?dom ?sub]
           (world/aspect-dominates-aspect-explicitly+ ?dom ?sub))
"#{(\"cl.pleiad.ajlmp.testPrecedence.FirstAspect\" \"cl.pleiad.ajlmp.testPrecedence.FifthAspect\") (\"cl.pleiad.ajlmp.testPrecedence.ThirdAspect\" \"cl.pleiad.ajlmp.testPrecedence.EightAspect\") (\"cl.pleiad.ajlmp.testPrecedence.FirstAspect\" \"cl.pleiad.ajlmp.testPrecedence.SecondAspect\") (\"cl.pleiad.ajlmp.testPrecedence.SeventhAspect\" \"cl.pleiad.ajlmp.testPrecedence.FifthAspect\") (\"cl.pleiad.ajlmp.testPrecedence.ThirdAspect\" \"cl.pleiad.ajlmp.testPrecedence.FourthAspect\") (\"cl.pleiad.ajlmp.testPrecedence.SecondAspect\" \"cl.pleiad.ajlmp.testPrecedence.FifthAspect\")}"))

(deftest
  implicit-precedence+-test 
  (tuples-are 
    (ekeko [?dom ?sub]
           (world/aspect-dominates-aspect-implicitly+ ?dom ?sub))
 "#{(\"cl.pleiad.ajlmp.testPrecedence.FourthAspect\" \"cl.pleiad.ajlmp.testPrecedence.ThirdAspect\") (\"cl.pleiad.ajlmp.testPrecedence.SixthAspect\" \"cl.pleiad.ajlmp.testPrecedence.FourthAspect\") (\"cl.pleiad.ajlmp.testPrecedence.SixthAspect\" \"cl.pleiad.ajlmp.testPrecedence.ThirdAspect\") (\"cl.pleiad.ajlmp.testPrecedence.EightAspect\" \"cl.pleiad.ajlmp.testPrecedence.SeventhAspect\")}"))

; OK 16 oct
(deftest
  incomplete-precedence-test
  (test/tuples-are
    (ekeko [?first ?second]
           (assumptions/incomplete-precedence ?first ?second))
    "#{(\"cl.pleiad.ajlmp.testPrecedence.FirstAspect\" \"cl.pleiad.ajlmp.testPrecedence.EightAspect\") (\"cl.pleiad.ajlmp.testPrecedence.EightAspect\" \"cl.pleiad.ajlmp.testPrecedence.FirstAspect\") (\"cl.pleiad.ajlmp.testPrecedence.SecondAspect\" \"cl.pleiad.ajlmp.testPrecedence.SeventhAspect\") (\"cl.pleiad.ajlmp.testPrecedence.SecondAspect\" \"cl.pleiad.ajlmp.testPrecedence.FourthAspect\") (\"cl.pleiad.ajlmp.testPrecedence.SixthAspect\" \"cl.pleiad.ajlmp.testPrecedence.SecondAspect\") (\"cl.pleiad.ajlmp.testPrecedence.FirstAspect\" \"cl.pleiad.ajlmp.testPrecedence.SixthAspect\") (\"cl.pleiad.ajlmp.testPrecedence.ThirdAspect\" \"cl.pleiad.ajlmp.testPrecedence.FirstAspect\") (\"cl.pleiad.ajlmp.testPrecedence.SecondAspect\" \"cl.pleiad.ajlmp.testPrecedence.ThirdAspect\") (\"cl.pleiad.ajlmp.testPrecedence.EightAspect\" \"cl.pleiad.ajlmp.testPrecedence.SecondAspect\") (\"cl.pleiad.ajlmp.testPrecedence.FourthAspect\" \"cl.pleiad.ajlmp.testPrecedence.FirstAspect\") (\"cl.pleiad.ajlmp.testPrecedence.SeventhAspect\" \"cl.pleiad.ajlmp.testPrecedence.FirstAspect\") (\"cl.pleiad.ajlmp.testPrecedence.FirstAspect\" \"cl.pleiad.ajlmp.testPrecedence.SeventhAspect\") (\"cl.pleiad.ajlmp.testPrecedence.FirstAspect\" \"cl.pleiad.ajlmp.testPrecedence.FourthAspect\") (\"cl.pleiad.ajlmp.testPrecedence.SecondAspect\" \"cl.pleiad.ajlmp.testPrecedence.EightAspect\") (\"cl.pleiad.ajlmp.testPrecedence.ThirdAspect\" \"cl.pleiad.ajlmp.testPrecedence.SecondAspect\") (\"cl.pleiad.ajlmp.testPrecedence.FirstAspect\" \"cl.pleiad.ajlmp.testPrecedence.ThirdAspect\") (\"cl.pleiad.ajlmp.testPrecedence.SixthAspect\" \"cl.pleiad.ajlmp.testPrecedence.FirstAspect\") (\"cl.pleiad.ajlmp.testPrecedence.FourthAspect\" \"cl.pleiad.ajlmp.testPrecedence.SecondAspect\") (\"cl.pleiad.ajlmp.testPrecedence.SecondAspect\" \"cl.pleiad.ajlmp.testPrecedence.SixthAspect\") (\"cl.pleiad.ajlmp.testPrecedence.SeventhAspect\" \"cl.pleiad.ajlmp.testPrecedence.SecondAspect\")}"))

(deftest
  incomplete-precedence-shadow-test
  (test/tuples-are
    (ekeko [?first ?second ?shadow]
           (assumptions/incomplete-precedence-shadow ?first ?second ?shadow))
"#{(\"cl.pleiad.ajlmp.testPrecedence.FirstAspect\" \"cl.pleiad.ajlmp.testPrecedence.ThirdAspect\" \"baseMethod1()\") (\"cl.pleiad.ajlmp.testPrecedence.FirstAspect\" \"cl.pleiad.ajlmp.testPrecedence.FourthAspect\" \"baseMethod1()\") (\"cl.pleiad.ajlmp.testPrecedence.FourthAspect\" \"cl.pleiad.ajlmp.testPrecedence.FirstAspect\" \"baseMethod1()\") (\"cl.pleiad.ajlmp.testPrecedence.ThirdAspect\" \"cl.pleiad.ajlmp.testPrecedence.FirstAspect\" \"baseMethod1()\")}"))
