Added tests for various.lisp
This commit is contained in:
parent
8ea70b812d
commit
80c82ea6ac
@ -5,4 +5,6 @@
|
|||||||
:version "0.1"
|
:version "0.1"
|
||||||
:depends-on (:kenzo :fiveam)
|
:depends-on (:kenzo :fiveam)
|
||||||
:pathname #P"test/"
|
:pathname #P"test/"
|
||||||
:components ((:file "combinations-test")))
|
:components ((:file "package")
|
||||||
|
(:file "combinations-test")
|
||||||
|
(:file "various-test")))
|
||||||
|
|||||||
10
package.lisp
10
package.lisp
@ -44,5 +44,15 @@
|
|||||||
|
|
||||||
;; various.lisp
|
;; various.lisp
|
||||||
|
|
||||||
|
<A-B<
|
||||||
|
<A-B>
|
||||||
|
>A-B<
|
||||||
|
>A-B>
|
||||||
|
BINOMIAL-N-P
|
||||||
|
CLOCK
|
||||||
|
DONE
|
||||||
|
SRANDOM
|
||||||
|
V<A-B>
|
||||||
|
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|||||||
@ -43,12 +43,6 @@
|
|||||||
((> pp p) rslt)
|
((> pp p) rslt)
|
||||||
(declare (fixnum nn pp 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
|
(SETF *PRINT-LEVEL* 5
|
||||||
*PRINT-LENGTH* 10)
|
*PRINT-LENGTH* 10)
|
||||||
@ -85,12 +79,6 @@
|
|||||||
((= i a) rslt)
|
((= i a) rslt)
|
||||||
(declare (fixnum i) (list 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)
|
(DEFUN V<A-B> (a b)
|
||||||
(declare (fixnum a b))
|
(declare (fixnum a b))
|
||||||
@ -104,9 +92,6 @@
|
|||||||
(setf (aref rslt mark) i))
|
(setf (aref rslt mark) i))
|
||||||
rslt)))
|
rslt)))
|
||||||
|
|
||||||
#|
|
|
||||||
(v<a-b> -5 5))
|
|
||||||
|#
|
|
||||||
|
|
||||||
(DEFUN SRANDOM (max)
|
(DEFUN SRANDOM (max)
|
||||||
(declare (fixnum max))
|
(declare (fixnum max))
|
||||||
@ -117,9 +102,6 @@
|
|||||||
max
|
max
|
||||||
rslt))))
|
rslt))))
|
||||||
|
|
||||||
#|
|
|
||||||
(dotimes (i 20) (print (srandom 3))))
|
|
||||||
|#
|
|
||||||
|
|
||||||
(DEFUN CLOCK ()
|
(DEFUN CLOCK ()
|
||||||
(multiple-value-bind (sec min hour day month year)
|
(multiple-value-bind (sec min hour day month year)
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
|
|
||||||
(defpackage :kenzo-test
|
|
||||||
(:use :cl :fiveam))
|
|
||||||
|
|
||||||
(in-package :kenzo-test)
|
(in-package :kenzo-test)
|
||||||
|
|
||||||
(def-suite :kenzo)
|
|
||||||
(in-suite :kenzo)
|
(in-suite :kenzo)
|
||||||
|
|
||||||
(test f-cmpr
|
(test f-cmpr
|
||||||
|
|||||||
9
test/package.lisp
Normal file
9
test/package.lisp
Normal 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
39
test/various-test.lisp
Normal 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))))))
|
||||||
Loading…
Reference in New Issue
Block a user