[isidorus-cvs] r373 - trunk/src/unit_tests

Lukas Giessmann lgiessmann at common-lisp.net
Sat Dec 18 05:43:44 UTC 2010


Author: lgiessmann
Date: Sat Dec 18 00:43:43 2010
New Revision: 373

Log:
TM-SPARQL: added unit-tests for all compare-operators

Modified:
   trunk/src/unit_tests/sparql_test.lisp

Modified: trunk/src/unit_tests/sparql_test.lisp
==============================================================================
--- trunk/src/unit_tests/sparql_test.lisp	(original)
+++ trunk/src/unit_tests/sparql_test.lisp	Sat Dec 18 00:43:43 2010
@@ -35,7 +35,8 @@
 	   :test-set-unary-operators
 	   :test-set-or-and-operators
 	   :test-set-*-and-/-operators
-	   :test-set-+-and---operators))
+	   :test-set-+-and---operators
+	   :test-set-compare-operators))
 
 
 (in-package :sparql-test)
@@ -1315,6 +1316,119 @@
 		 "(and(prognisLITERAL((/(progn(*(progn(+1\"(13+4*5))\"))3))4)))(progn(progn(or(progn12=(+13(*1415)))(progn(*23)=1)))))"))
     (is (string= (string-replace result-5-4 " " "")
 		 "(or(progn(progn(+12)>=3))(progn(progn(+(+(progn(-24))5)6))=3))"))))
+
+
+(test test-set-compare-operators
+  "Tests various cases of the function set-*-and-/-operators."
+  (let* ((dummy-object (make-instance 'TM-SPARQL::SPARQL-Query :query "  "))
+	 (str-1 "x = a + b * c && y = a / 3 + b * 2 || 0 = 12 - 14 + 2 * 3 / 3}")
+	 (str-2 "x = 2 && (2 + 2) * 2 + 12 * 4 / 2 - 10 + 2 * (12 - 3) + (12 * 3)}")
+	 (str-3 "(x < a || ( a = 4 && 4 = x / y + (+1)) && -1)}")
+	 (str-4 "isLITERAL(((1 + '(13+4*5))') * 3) / 4) && (12 = 13 + 14 * 15 || 2 * 3 = 1)}")
+	 (str-5 "(1 + 2 >= 3) || ((2 - 4) + 5 + 6) = 3}")
+	 (str-6 "2 > 1 <= 0 != 99 || true}")
+	 (result-1
+	  (getf (tm-sparql::set-boundings dummy-object str-1) :filter-string))
+	 (result-1-1
+	  (tm-sparql::set-unary-operators dummy-object result-1))
+	 (result-1-2
+	  (tm-sparql::set-or-and-operators dummy-object result-1-1 result-1))
+	 (result-1-3
+	  (tm-sparql::set-*-and-/-operators dummy-object result-1-2))
+	 (result-1-4
+	  (tm-sparql::set-+-and---operators dummy-object result-1-3))
+	 (result-1-5
+	  (tm-sparql::set-compare-operators dummy-object result-1-4))
+	 (result-2
+	  (getf (tm-sparql::set-boundings dummy-object str-2) :filter-string))
+	 (result-2-1
+	  (tm-sparql::set-unary-operators dummy-object result-2))
+	 (result-2-2
+	  (tm-sparql::set-or-and-operators dummy-object result-2-1 result-2))
+	 (result-2-3
+	  (tm-sparql::set-*-and-/-operators dummy-object result-2-2))
+	 (result-2-4
+	  (tm-sparql::set-+-and---operators dummy-object result-2-3))
+	 (result-2-5
+	  (tm-sparql::set-compare-operators dummy-object result-2-4))
+	 (result-3
+	  (getf (tm-sparql::set-boundings dummy-object str-3) :filter-string))
+	 (result-3-1
+	  (tm-sparql::set-unary-operators dummy-object result-3))
+	 (result-3-2
+	  (tm-sparql::set-or-and-operators dummy-object result-3-1 result-3))
+	 (result-3-3
+	  (tm-sparql::set-*-and-/-operators dummy-object result-3-2))
+	 (result-3-4
+	  (tm-sparql::set-+-and---operators dummy-object result-3-3))
+	 (result-3-5
+	  (tm-sparql::set-compare-operators dummy-object result-3-4))
+	 (result-4
+	  (getf (tm-sparql::set-boundings dummy-object str-4) :filter-string))
+	 (result-4-1
+	  (tm-sparql::set-unary-operators dummy-object result-4))
+	 (result-4-2
+	  (tm-sparql::set-or-and-operators dummy-object result-4-1 result-4))
+	 (result-4-3
+	  (tm-sparql::set-*-and-/-operators dummy-object result-4-2))
+	 (result-4-4
+	  (tm-sparql::set-+-and---operators dummy-object result-4-3))
+	 (result-4-5
+	  (tm-sparql::set-compare-operators dummy-object result-4-4))
+	 (result-5
+	  (getf (tm-sparql::set-boundings dummy-object str-5) :filter-string))
+	 (result-5-1
+	  (tm-sparql::set-unary-operators dummy-object result-5))
+	 (result-5-2
+	  (tm-sparql::set-or-and-operators dummy-object result-5-1 result-5))
+	 (result-5-3
+	  (tm-sparql::set-*-and-/-operators dummy-object result-5-2))
+	 (result-5-4
+	  (tm-sparql::set-+-and---operators dummy-object result-5-3))
+	 (result-5-5
+	  (tm-sparql::set-compare-operators dummy-object result-5-4))
+	 (result-6
+	  (getf (tm-sparql::set-boundings dummy-object str-6) :filter-string))
+	 (result-6-1
+	  (tm-sparql::set-unary-operators dummy-object result-6))
+	 (result-6-2
+	  (tm-sparql::set-or-and-operators dummy-object result-6-1 result-6))
+	 (result-6-3
+	  (tm-sparql::set-*-and-/-operators dummy-object result-6-2))
+	 (result-6-4
+	  (tm-sparql::set-+-and---operators dummy-object result-6-3))
+	 (result-6-5
+	  (tm-sparql::set-compare-operators dummy-object result-6-4)))
+    (is-true result-1) (is-true result-1-1)
+    (is-true result-1-2) (is-true result-1-3)
+    (is-true result-2) (is-true result-2-1)
+    (is-true result-2-2) (is-true result-2-3)
+    (is-true result-3) (is-true result-3-1)
+    (is-true result-3-2) (is-true result-3-3)
+    (is-true result-4) (is-true result-4-1)
+    (is-true result-4-2) (is-true result-4-3)
+    (is-true result-1-4) (is-true result-2-4)
+    (is-true result-3-4) (is-true result-4-4)
+    (is-true result-5) (is-true result-5-1)
+    (is-true result-5-2) (is-true result-5-3)
+    (is-true result-5-4) (is-true result-1-5)
+    (is-true result-2-5) (is-true result-3-5)
+    (is-true result-4-5) (is-true result-5-5)
+    (is-true result-6-1) (is-true result-6-2)
+    (is-true result-6-3) (is-true result-6-4)
+    (is-true result-6-5)
+    (is (string= (string-replace result-1-5 " " "")
+		 "(or(progn(and(progn(=x(+a(*bc))))(progn(=y(+(/a3)(*b2))))))(progn(=0(+(-1214)(/(*23)3)))))"))
+    (is (string= (string-replace result-2-5 " " "")
+		 "(and(progn(=x2))(progn(+(+(-(+(*(progn(+22))2)(/(*124)2))10)(*2(progn(-123))))(progn(*123)))))"))
+    (is (string= (string-replace result-3-4 " " "")
+		 "(progn(and(progn(or(prognx<a)(progn(progn(and(progna=4)(progn4=(+(/xy)(progn(one+1)))))))))(progn(one-1))))"))
+    (is (string= (string-replace result-4-5 " " "")
+		 "(and(prognisLITERAL((/(progn(*(progn(+1\"(13+4*5))\"))3))4)))(progn(progn(or(progn(=12(+13(*1415))))(progn(=(*23)1))))))"))
+    (is (string= (string-replace result-5-5 " " "")
+		 "(or(progn(progn(>=(+12)3)))(progn(=(progn(+(+(progn(-24))5)6))3)))"))
+    (is (string= (string-replace result-6-5 " " "")
+		 "(or(progn(!=(<=(>21)0)99))(progntrue))"))))
 	 
     
 




More information about the Isidorus-cvs mailing list