X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests%2Ftest-oodml.lisp;h=804248bcb09ff262a94145124a828c2e16cd1df5;hb=1c5166f0e106b086a5f50a7ce5af2f50d6c6b58e;hp=7cac6feae92ebfcf34d62ca10246ee518e68c271;hpb=1dda729b250779079efbdc1d3f6bbb3ae4a20ba4;p=clsql.git diff --git a/tests/test-oodml.lisp b/tests/test-oodml.lisp index 7cac6fe..804248b 100644 --- a/tests/test-oodml.lisp +++ b/tests/test-oodml.lisp @@ -59,12 +59,48 @@ 3) (deftest :oodml/select/6 - (slot-value (caar (clsql:select 'employee :where [= 1 [emplid]])) 'married) - t) + (let ((a (caar (clsql:select 'address :where [= 1 [addressid]])))) + (values + (slot-value a 'street-number) + (slot-value a 'street-name) + (slot-value a 'city) + (slot-value a 'postal-code))) + 10 "Park Place" "Leningrad" 123) (deftest :oodml/select/7 - (slot-value (caar (clsql:select 'employee :where [= 4 [emplid]])) 'married) - nil) + (let ((a (caar (clsql:select 'address :where [= 2 [addressid]])))) + (values + (slot-value a 'street-number) + (slot-value a 'street-name) + (slot-value a 'city) + (slot-value a 'postal-code))) + nil "" "no city" 0) + +(deftest :oodml/select/8 + (mapcar #'(lambda (e) (slot-value e 'married)) + (clsql:select 'employee :flatp t :order-by [emplid])) + (t t t nil nil nil nil nil nil nil)) + +(deftest :oodml/select/9 + (mapcar #'(lambda (pair) + (list + (typep (car pair) 'address) + (typep (second pair) 'employee-address) + (slot-value (car pair) 'addressid) + (slot-value (second pair) 'addressid))) + (employee-addresses employee1)) + ((t t 1 1) (t t 2 2))) + +(deftest :oodml/select/10 + (mapcar #'(lambda (pair) + (list + (typep (car pair) 'address) + (typep (second pair) 'employee-address) + (slot-value (car pair) 'addressid) + (slot-value (second pair) 'addressid))) + (employee-addresses employee2)) + ((t t 2 2))) + ;; tests update-records-from-instance (deftest :oodml/update-records/1 @@ -272,11 +308,11 @@ "Lenin"]]) (("Lenin" "Widgets Inc."))) -;(deftest :oodml/iteration/3 -; (loop for (e) being the tuples in -; [select 'employee :where [married] :order-by [emplid]] -; collect (slot-value e 'last-name)) -; ("Lenin" "Stalin" "Trotsky")) +(deftest :oodml/iteration/3 + (loop for (e) being the records in + [select 'employee :where [< [emplid] 4] :order-by [emplid]] + collect (slot-value e 'last-name)) + ("Lenin" "Stalin" "Trotsky")) ))