2
;;;; Author: Paul Dietz
3
;;;; Created: Thu Sep 4 20:01:15 2003
4
;;;; Contains: Tests of INCF
8
(compile-and-load "numbers-aux.lsp")
46
(loop for x from 1 to 5
49
((2 2) (3 3) (4 4) (5 5) (6 6)))
52
(loop for x in '(1.0s0 1.0f0 1.0d0 1.0l0)
55
((2.0s0 2.0s0) (2.0f0 2.0f0) (2.0d0 2.0d0) (2.0l0 2.0l0)))
58
(loop for x in '(1.0s0 1.0f0 1.0d0 1.0f0)
61
for x1c = (complex (1+ x) 0)
62
unless (and (eql y z) (eql x1c y))
63
collect (list x y z x1c))
67
(let ((x most-positive-fixnum))
69
#.(1+ most-positive-fixnum) #.(1+ most-positive-fixnum))
72
(let ((x (1+ most-positive-fixnum)))
74
#.(+ 2 most-positive-fixnum) #.(+ 2 most-positive-fixnum))
77
(loop for x in *numbers*
85
;;; Increment by other than 1
88
(loop for x in *numbers*
89
unless (let* ((y x) (z (incf y 0)))
90
(and (eql x y) (eql y z)))
95
(loop for x in *numbers*
97
(loop for r = (random-from-interval 1000000)
99
when (let* ((y x) (z (incf y r)))
100
(and (not (and (eql (+ x r) y) (eql y z)))
107
(values (incf x 0.0s0) x))
112
(values (incf x 0.0f0) x))
117
(values (incf x 0.0d0) x))
122
(values (incf x 0.0l0) x))
127
(values (incf x #c(0.0s0 0.0s0)) x))
128
#c(1.0s0 0.0s0) #c(1.0s0 0.0s0))
132
(values (incf x #c(0.0f0 2.0f0)) x))
133
#c(1.0f0 2.0f0) #c(1.0f0 2.0f0))
137
(values (incf x #c(0.0d0 2.0d0)) x))
138
#c(1.0d0 2.0d0) #c(1.0d0 2.0d0))
142
(values (incf x #c(0.0l0 -2.0l0)) x))
143
#c(1.0l0 -2.0l0) #c(1.0l0 -2.0l0))
145
(deftest incf.order.2
146
(let ((a (vector 1 2 3 4))
149
(incf (aref (progn (setf x (incf i)) a)
150
(progn (setf y (incf i)) 0))
151
(progn (setf z (incf i)) 17))
153
18 3 1 2 3 #(18 2 3 4))
155
(deftest incf.order.3
156
(let ((a (vector 10 2 3 4))
159
(incf (aref (progn (setf x (incf i)) a)
160
(progn (setf y (incf i)) 0)))
162
11 2 1 2 #(11 2 3 4))