43 lines
1.3 KiB
Plaintext
43 lines
1.3 KiB
Plaintext
;;MAKE-HOMOGENEOUS-3-VECTOR
|
|
;; By Peter Reidy
|
|
;; Filed as {ERIS}<LISPCORE>TEST>DISPLAY>MATMULT>MAKE-HOMOGENEOUS-3-VECTOR.TEST
|
|
;; Syntax: (MAKE-HOMOGENEOUS-3-VECTOR &optional X Y)
|
|
;; Function description: returns a 3-vector of element-type single-float; the elements are X and Y in the first 2 places, and 1.0 in the third.
|
|
;; Arguments: X, Y: optional values for the first and second elements of the vector.
|
|
;;
|
|
(do-test-group make-homogeneous-3-vector-tests
|
|
:before
|
|
(progn
|
|
(il:load? '{eris}<lispcore>test>display>matmult>matmult-test.source)
|
|
(test-setq random (- most-positive-single-float (random most-positive-single-float)))
|
|
)
|
|
;;
|
|
(do-test simple-3-vector-test
|
|
(let ((simple.vector (il:make-homogeneous-3-vector)))
|
|
(and
|
|
(vectest simple.vector 3)
|
|
(= 0.0 (aref simple.vector 0))
|
|
(= 0.0 (aref simple.vector 1))
|
|
)
|
|
)
|
|
)
|
|
;;
|
|
(do-test 3-vector-with-args-test
|
|
(let ((3x (il:make-homogeneous-3-vector random))
|
|
(3y (il:make-homogeneous-3-vector nil most-negative-single-float))
|
|
(3xy (il:make-homogeneous-3-vector random most-positive-single-float))
|
|
)
|
|
(every 'vectest (list 3x 3y 3xy) '(3))
|
|
)
|
|
)
|
|
;;
|
|
(do-test 3-vector-complex-test
|
|
(expect-errors (error)
|
|
(il:make-homogeneous-3-vector #c(3 5))
|
|
)
|
|
)
|
|
) ; do-test-group make-homogeneous-3-vector-tests
|
|
END
|
|
|
|
|