1
0
mirror of synced 2026-02-11 19:04:55 +00:00
Files
Interlisp.medley/internal/test/LANGUAGE/AUTO/ARRAY.TEST

92 lines
2.0 KiB
Plaintext

;; Functions To Be Tested: All of chapter 5 of the IRM
;;
;; Source: IRM, p 5.1
;;
;; Chapter 5: Array
;;
;; Created By: Henry Cate III
;;
;; Creation Date: March 23, 1987
;;
;; Last Update:
;;
;; Filed As: {eris}<lispcore>test>DataTypes>Array.test
;;
;;
(do-test "test array"
(and
(il:arrayp (il:array 5))
(il:arrayp (il:array 10 'il:floatp))
(il:arrayp (il:array 10 'il:floatp 3.141592))
(il:arrayp (il:array 10 'il:floatp 3.141592 0))
T
))
(do-test "test elt"
(let* ((tempx (il:array 10 'il:floatp 3.141592))
(tempy (il:array 100 nil 'a-litatom)))
(and
(equal 3.141592 (il:elt tempx 3))
(equal 3.141592 (il:elt tempx 8))
(equal 'a-litatom (il:elt tempy 2))
(equal 'a-litatom (il:elt tempy 72))
)))
(do-test "test seta"
(let* ((tempx (il:array 10 'il:floatp 3.141592))
(tempy (il:array 100 nil 'a-litatom)))
(and
(equal 2.71828 (il:seta tempx 3 2.71828))
(equal 2.71828 (il:elt tempx 3))
(equal 'Janet (il:seta tempy 62 'Janet))
(equal 'Janet (il:elt tempy 62))
)))
(do-test "test arraytyp"
(let* ((tempx (il:array 10 'il:floatp 3.141592))
(tempy (il:array 100 nil 'a-litatom)))
(and
(equal 'il:floatp (il:arraytyp tempx))
(equal 'il:pointer (il:arraytyp tempy))
)))
(do-test "test arraysize"
(let* ((tempx (il:array 10 'il:floatp 3.141592))
(tempy (il:array 100 nil 'a-litatom)))
(and
(eq 10 (il:arraysize tempx))
(eq 100 (il:arraysize tempy))
)))
(do-test "test arrayorig"
(let* ((tempx (il:array 10 'il:floatp 3.141592 0))
(tempy (il:array 100 nil 'a-litatom 1)))
(and
(eq 0 (il:arrayorig tempx))
(eq 1 (il:arrayorig tempy))
)))
(do-test "test copyarray"
(let* ((tempx (il:array 10 'il:floatp 3.141592 0))
(tempy (il:array 100 nil 'a-litatom 1)))
(and
(il:arrayp (il:copyarray tempx))
(il:arrayp (il:copyarray tempy))
T
)))
STOP