Skip to content

Commit 966fe92

Browse files
committed
Added !rotatef test case
1 parent b5c23d5 commit 966fe92

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/clos.lisp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,27 @@
124124

125125

126126
;;; test change-class rotatef psetf
127+
128+
;;; rotatef test
129+
#+jscl
130+
(let ((a 1)
131+
(b 2)
132+
(c 3)
133+
(d #(1 2 3)))
134+
(!rotatef a b c)
135+
(test (equal '(2 3 1) (list a b c)))
136+
(!rotatef a b c)
137+
(test (equal '(3 1 2) (list a b c)))
138+
(!rotatef (aref d 0) (aref d 2))
139+
(test (equal '(3 2 1) (jscl::vector-to-list d))))
140+
141+
(let* ((a '(1 2))
142+
(b '(3 4))
143+
(c '(a b))
144+
(d (list a b c)))
145+
(!rotatef (nth 0 d) (nth 2 d))
146+
(test (equal '((a b) (3 4) (1 2)) d)))
147+
127148
(defclass rectangle ()
128149
((height :initform 0.0 :initarg :height)
129150
(width :initform 0.0 :initarg :width)))

0 commit comments

Comments
 (0)