Coverage report: /home/samppa/personal/opiskelu/ohtuprojekti/pulsu/trunk/test.lisp
Kind | Covered | All | % |
expression | 76 | 84 | 90.5 |
branch | 5 | 12 | 41.7 |
Key
Not instrumented
Conditionalized out
Executed
Not executed
Both branches taken
One branch taken
Neither branch taken
1
(in-package :puls.test)
3
(defvar *test-name* nil)
5
(defmacro deftest (name parameters &body body)
6
"Define a test function. Within a test function we can call
7
other test functions or use 'check' to run individual test
9
`(defun ,name ,parameters
10
(let ((*test-name* (append *test-name* (list ',name))))
13
(defmacro check (&body forms)
14
"Run each expression in 'forms' as a test case."
16
,@(loop for f in forms collect `(report-result ,f ',f))))
18
(defmacro combine-results (&body forms)
19
"Combine the results (as booleans) of evaluating 'forms' in order."
20
(with-gensyms (result)
22
,@(loop for f in forms collect `(unless ,f (setf ,result nil)))
25
(defun report-result (result form)
26
"Report the results of a single test case. Called by 'check'."
27
(format t "~:[FAIL~;pass~] ... ~a~:[: ~a~;~]~%"
28
result *test-name* result form)
31
(defun map-check (test list)
32
"Run test on each of the elements in list and collect results."
34
(notany #'null (mapcar test list))))
37
(check (equal (subseq "abcd" 1 2)
43
(let* ((hunchentoot:*reply* (make-instance 'hunchentoot::reply))
45
'((:HOST . "localhost:10001")
47
. "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/2008111317 Ubuntu/8.04 (hardy) Firefox/3.0.4")
49
. "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
50
(:ACCEPT-LANGUAGE . "en-us,en;q=0.5") (:ACCEPT-ENCODING . "gzip,deflate")
51
(:ACCEPT-CHARSET . "ISO-8859-1,utf-8;q=0.7,*;q=0.7") (:KEEP-ALIVE . "300")
52
(:CONNECTION . "keep-alive")
53
(:AUTHORIZATION . "Basic cHVsc3U6cHVsc3UwOA==")
54
(:CACHE-CONTROL . "max-age=0")))
55
(hunchentoot:*request*
56
(make-instance 'hunchentoot::request
57
:headers-in headers-in)))
59
(setf (slot-value hunchentoot:*request* 'hunchentoot::get-parameters)
65
(puls.ui::test-newest)
66
(puls.controller::test-controller)
67
; (puls.ui::test-document-view)
68
(puls.ui::test-headerfooter)