Skip to content
Browse files

Completed test framework.

  • Loading branch information...
1 parent 78c6366 commit 2e9ebfe0831d27f164e37a3e59e6d643cc608e28 @cderoove committed Sep 26, 2012
View
66 EkekoAspectJ/test/test/damp/ekeko/aspectj.clj
@@ -18,9 +18,18 @@
;NOTE: do not forget to clean all tested projects before running the tests
;TODO: fix that :)
+;todo: add parameter to against-project-named that controls whether soot should be run as well
+
+
;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]
@@ -47,6 +56,37 @@
(against-project (ws/workspace-project-named n) 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."
+ [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
aspect-test
(let [grounding
@@ -60,16 +100,36 @@
(is (empty? (clojure.set/difference (set grounding) (set grounding-and-checking))))))
(deftest
+ concretization-test
+ (tuples-are
+ (ekeko [?abpointcut ?concpointcut1 ?concpointcut2]
+ (assumptions/abstractpointcut-concretized-reconcretized ?abpointcut ?concpointcut1 ?concpointcut2))
+
+ "#{(\"pointcut cl.pleiad.ajlmp.testPointcuts.AbstractAspect.abstractpc1()\" \"pointcut cl.pleiad.ajlmp.testPointcuts.FirstAspect.abstractpc1()\" \"pointcut cl.pleiad.ajlmp.testPointcuts.SecondAspect.abstractpc1()\")}"))
+
+;; Test Suite
+;; ----------
+
+;note: (runtests) will report that one more test has been run (successfully)
+;than those that are listed here .. seems "normal"
+
+(deftest
test-suite
- (against-project-named "AJ-LMP-Precedence" aspect-test)
- (against-project-named "AJ-LMP-Wormhole" aspect-test))
+ (against-project-named "AJ-LMP-Precedence" aspect-test )
+ (against-project-named "AJ-LMP-Pointcuts" concretization-test))
(defn
test-ns-hook
[]
(with-ekeko-disabled test-suite))
-
+
+;; Example REPL Session that runs the test
+;; ---------------------------------------
+
+; note: uncommenting would run the tests upon loading
(comment
+
(run-tests)
+
)
View
1 TestCases/AJ-LMP-ITD/.project
@@ -14,6 +14,5 @@
<natures>
<nature>org.eclipse.ajdt.ui.ajnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
- <nature>damp.ekeko.plugin.sootNature</nature>
</natures>
</projectDescription>
View
6 TestCases/AJ-LMP-Pointcuts/.project
@@ -10,15 +10,9 @@
<arguments>
</arguments>
</buildCommand>
- <buildCommand>
- <name>damp.ekeko.plugin.ekekoBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.ajdt.ui.ajnature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
- <nature>damp.ekeko.plugin.ekekoNature</nature>
</natures>
</projectDescription>

0 comments on commit 2e9ebfe

Please sign in to comment.
Something went wrong with that request. Please try again.