Added tests for various.lisp

This commit is contained in:
gheber 2014-12-24 11:56:09 -06:00
parent 8ea70b812d
commit 80c82ea6ac
6 changed files with 61 additions and 23 deletions

View File

@ -5,4 +5,6 @@
:version "0.1"
:depends-on (:kenzo :fiveam)
:pathname #P"test/"
:components ((:file "combinations-test")))
:components ((:file "package")
(:file "combinations-test")
(:file "various-test")))

View File

@ -44,5 +44,15 @@
;; various.lisp
<A-B<
<A-B>
>A-B<
>A-B>
BINOMIAL-N-P
CLOCK
DONE
SRANDOM
V<A-B>
))

View File

@ -43,12 +43,6 @@
((> pp p) rslt)
(declare (fixnum nn pp rslt)))))
#|
(dotimes (i 6)
(print (binomial-n-p 5 i)))
(dotimes (i 6)
(print (binomial-p-q (- 5 i) i))))
|#
(SETF *PRINT-LEVEL* 5
*PRINT-LENGTH* 10)
@ -85,12 +79,6 @@
((= i a) rslt)
(declare (fixnum i) (list rslt)))))
#|
(<a-b< 0 5)
(<a-b> 0 5)
(>a-b< 0 5)
(>a-b> 0 5))
|#
(DEFUN V<A-B> (a b)
(declare (fixnum a b))
@ -104,9 +92,6 @@
(setf (aref rslt mark) i))
rslt)))
#|
(v<a-b> -5 5))
|#
(DEFUN SRANDOM (max)
(declare (fixnum max))
@ -117,9 +102,6 @@
max
rslt))))
#|
(dotimes (i 20) (print (srandom 3))))
|#
(DEFUN CLOCK ()
(multiple-value-bind (sec min hour day month year)

View File

@ -1,10 +1,6 @@
(defpackage :kenzo-test
(:use :cl :fiveam))
(in-package :kenzo-test)
(def-suite :kenzo)
(in-suite :kenzo)
(test f-cmpr

9
test/package.lisp Normal file
View File

@ -0,0 +1,9 @@
;;;; package.lisp
(defpackage :kenzo-test
(:use :cl :fiveam))
(in-package :kenzo-test)
(def-suite :kenzo)

39
test/various-test.lisp Normal file
View File

@ -0,0 +1,39 @@
(in-package :kenzo-test)
(in-suite :kenzo)
(test binomial-n-p
(let ((rslt '(1 5 10 10 5 1)))
(dotimes (i 6)
(is (equal (cat:binomial-n-p 5 i)
(nth i rslt)))))
(let ((rslt '(1 4 3 1 1 1)))
(dotimes (i 6)
(is (equal (cat:binomial-n-p (- 5 i) i)
(nth i rslt))))))
(test <a-b<
(is (equal (cat:<a-b< 0 5) '(0 1 2 3 4))))
(test <a-b>
(is (equal (cat:<a-b> 0 5) '(0 1 2 3 4 5))))
(test >a-b<
(is (equal (cat:>a-b< 0 5) '(1 2 3 4))))
(test >a-b>
(is (equal (cat:>a-b> 0 5) '(1 2 3 4 5))))
(test v<a-b>
(is (equalp (cat:v<a-b> -5 5)
(make-array 11 :element-type 'fixnum
:initial-contents '(-5 -4 -3 -2 -1
0 1 2 3 4 5)))))
(test srandom
(dotimes (i 20)
(let ((rslt (cat:srandom 3)))
(is (and (typep rslt 'fixnum)
(<= -3 rslt 3))))))