45 lines
1.5 KiB
Plaintext
45 lines
1.5 KiB
Plaintext
;;MAKE-HOMOGENEOUS-4-VECTOR
|
|
;; By Peter Reidy
|
|
;; Filed as {ERIS}<LISPCORE>TEST>DISPLAY>MATMULT>MAKE-HOMOGENEOUS-4-VECTOR.TEST
|
|
;; Syntax: (MAKE-HOMOGENEOUS-4-VECTOR &optional X Y Z)
|
|
;; Function description: returns a 4-vector of element-type single-float; the elements are X, Y and Z in the first 2 places, and 1.0 in the fourth.
|
|
;; Arguments: X, Y, Z: optional values for the first three elements of the vector.
|
|
;;
|
|
(do-test-group make-homogeneous-4-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-4-vector-test
|
|
(let ((simple.vector (il:make-homogeneous-4-vector)))
|
|
(and
|
|
(vectest simple.vector 4)
|
|
(= 0.0 (aref simple.vector 0))
|
|
(= 0.0 (aref simple.vector 1))
|
|
)
|
|
)
|
|
)
|
|
;;
|
|
(do-test 4-vector-with-args-test
|
|
(let ((3x (il:make-homogeneous-4-vector random))
|
|
(3y (il:make-homogeneous-4-vector nil most-negative-single-float))
|
|
(3z (il:make-homogeneous-4-vector nil nil most-negative-single-float))
|
|
(3xz (il:make-homogeneous-4-vector random nil most-positive-single-float))
|
|
(3xyz (il:make-homogeneous-4-vector random (random (random most-positive-single-float)) most-positive-single-float))
|
|
)
|
|
(every 'vectest (list 3x 3y 3z 3xz 3xyz) '(4))
|
|
)
|
|
)
|
|
;;
|
|
(do-test 4-vector-complex-test
|
|
(expect-errors (error)
|
|
(il:make-homogeneous-4-vector #c(3 5))
|
|
)
|
|
)
|
|
) ; do-test-group make-homogeneous-4-vector-tests
|
|
END
|
|
|
|
|