more tests, start working with data sets and parameter sets
This commit is contained in:
parent
dcc401b6e9
commit
580d9f34df
2 changed files with 19 additions and 2 deletions
|
@ -37,4 +37,4 @@
|
|||
;;;; parameterized functions
|
||||
|
||||
(defun line (x)
|
||||
#'(lambda (w b) (+ b (* w x))))
|
||||
#'(lambda (theta) (+ (cadr theta) (* (car theta) x))))
|
||||
|
|
|
@ -11,7 +11,24 @@
|
|||
(defun run ()
|
||||
(let ((t:*test-suite* (t:test-suite "decons")))
|
||||
(test-basic)
|
||||
(test-line)
|
||||
(t:show-result)))
|
||||
|
||||
(deftest test-basic ()
|
||||
(== decons:*pi* 3.14159))
|
||||
(== decons:*pi* 3.14159)
|
||||
(let ((c (make-instance 'decons:circle :radius 2.0)))
|
||||
(== (decons:area c) 12.56636))
|
||||
(== (funcall (decons:double #'1+) 7) 16)
|
||||
(== (decons:absv 7) 7)
|
||||
(== (decons:absv -7) 7)
|
||||
(== (decons:remainder 7 4) 3)
|
||||
)
|
||||
|
||||
(deftest test-line ()
|
||||
(let ((p1 (decons:line 0.0))
|
||||
(p2 (decons:line 1.0))
|
||||
(ds1 '((2.0 1.0 4.0 3.0)
|
||||
(1.8 1.2 4.2 3.3))))
|
||||
(== (funcall p1 '(0.5 2.0)) 2.0)
|
||||
(== (funcall p2 '(0.5 2.0)) 2.5)
|
||||
))
|
||||
|
|
Loading…
Add table
Reference in a new issue