find-if.lsp 15.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Wed Aug 28 18:37:52 2002
;;;; Contains: Tests for FIND-IF

(in-package :cl-test)

(deftest find-if-list.1
  (find-if #'identity ())
  nil)

(deftest find-if-list.2
  (find-if #'identity '(a))
  a)

(deftest find-if-list.2a
  (find-if 'identity '(a))
  a)

(deftest find-if-list.3
  (find-if #'evenp '(1 2 4 8 3 1 6 7))
  2)

(deftest find-if-list.4
  (find-if #'evenp '(1 2 4 8 3 1 6 7) :from-end t)
  6)

(deftest find-if-list.5
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
30
        (find-if #'evenp '(1 2 4 8 3 1 6 7) :start i))
31 32 33 34
  (2 2 4 8 6 6 6 nil))

(deftest find-if-list.6
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
35
        (find-if #'evenp '(1 2 4 8 3 1 6 7) :start i :end nil))
36 37 38 39
  (2 2 4 8 6 6 6 nil))

(deftest find-if-list.7
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
40
        (find-if #'evenp '(1 2 4 8 3 1 6 7) :start i :from-end t))
41 42 43 44
  (6 6 6 6 6 6 6 nil))

(deftest find-if-list.8
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
45
        (find-if #'evenp '(1 2 4 8 3 1 6 7) :start i :end nil :from-end t))
46 47 48 49
  (6 6 6 6 6 6 6 nil))

(deftest find-if-list.9
  (loop for i from 0 to 8 collect
sds's avatar
sds committed
50
        (find-if #'evenp '(1 2 4 8 3 1 6 7) :end i))
51 52 53 54
  (nil nil 2 2 2 2 2 2 2))

(deftest find-if-list.10
  (loop for i from 0 to 8 collect
sds's avatar
sds committed
55
        (find-if #'evenp '(1 2 4 8 3 1 6 7) :end i :from-end t))
56 57 58 59
  (nil nil 2 4 8 8 8 6 6))

(deftest find-if-list.11
  (loop for j from 0 to 7
sds's avatar
sds committed
60 61 62
        collect
        (loop for i from (1+ j) to 8 collect
              (find-if #'evenp '(1 2 4 8 3 1 6 7) :start j :end i)))
63 64 65 66 67 68 69 70 71 72 73
  ((nil 2 2 2 2 2 2 2)
   (2 2 2 2 2 2 2)
   (4 4 4 4 4 4)
   (8 8 8 8 8)
   (nil nil 6 6)
   (nil 6 6)
   (6 6)
   (nil)))

(deftest find-if-list.12
  (loop for j from 0 to 7
sds's avatar
sds committed
74 75 76 77
        collect
        (loop for i from (1+ j) to 8 collect
              (find-if #'evenp '(1 2 4 8 3 1 6 7) :start j :end i
                       :from-end t)))
78 79 80 81 82 83 84 85 86 87 88
  ((nil 2 4 8 8 8 6 6)
   (2 4 8 8 8 6 6)
   (4 8 8 8 6 6)
   (8 8 8 6 6)
   (nil nil 6 6)
   (nil 6 6)
   (6 6)
   (nil)))

(deftest find-if-list.13
  (loop for i from 0 to 6
sds's avatar
sds committed
89 90
        collect
        (find-if #'evenp '(1 6 11 32 45 71 100) :key #'1+ :start i))
91 92 93 94
  (1 11 11 45 45 71 nil))

(deftest find-if-list.14
  (loop for i from 0 to 6
sds's avatar
sds committed
95 96
        collect
        (find-if #'evenp '(1 6 11 32 45 71 100) :key '1+ :start i :from-end t))
97 98 99 100
  (71 71 71 71 71 71 nil))

(deftest find-if-list.15
  (loop for i from 0 to 7
sds's avatar
sds committed
101 102
        collect
        (find-if #'evenp '(1 6 11 32 45 71 100) :key #'1+ :end i))
103 104 105 106
  (nil 1 1 1 1 1 1 1))

(deftest find-if-list.16
  (loop for i from 0 to 7
sds's avatar
sds committed
107 108
        collect
        (find-if #'evenp '(1 6 11 32 45 71 100) :key '1+ :end i :from-end t))
109 110 111 112
  (nil 1 1 11 11 45 71 71))

(deftest find-if-list.17
  (loop for j from 0 to 7
sds's avatar
sds committed
113 114 115
        collect
        (loop for i from (1+ j) to 8 collect
              (find-if #'oddp '(1 2 4 8 3 1 6 7) :start j :end i :key #'1-)))
116 117 118 119 120 121 122 123 124 125 126
  ((nil 2 2 2 2 2 2 2)
   (2 2 2 2 2 2 2)
   (4 4 4 4 4 4)
   (8 8 8 8 8)
   (nil nil 6 6)
   (nil 6 6)
   (6 6)
   (nil)))

(deftest find-if-list.18
  (loop for j from 0 to 7
sds's avatar
sds committed
127 128 129 130
        collect
        (loop for i from (1+ j) to 8 collect
              (find-if #'oddp '(1 2 4 8 3 1 6 7) :start j :end i
                       :from-end t :key #'1+)))
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
  ((nil 2 4 8 8 8 6 6)
   (2 4 8 8 8 6 6)
   (4 8 8 8 6 6)
   (8 8 8 6 6)
   (nil nil 6 6)
   (nil 6 6)
   (6 6)
   (nil)))

;;; tests for vectors

(deftest find-if-vector.1
  (find-if #'identity #())
  nil)

(deftest find-if-vector.2
  (find-if #'identity #(a))
  a)

(deftest find-if-vector.2a
  (find-if 'identity #(a))
  a)

(deftest find-if-vector.3
  (find-if #'evenp #(1 2 4 8 3 1 6 7))
  2)

(deftest find-if-vector.4
  (find-if #'evenp #(1 2 4 8 3 1 6 7) :from-end t)
  6)

(deftest find-if-vector.5
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
164
        (find-if #'evenp #(1 2 4 8 3 1 6 7) :start i))
165 166 167 168
  (2 2 4 8 6 6 6 nil))

(deftest find-if-vector.6
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
169
        (find-if #'evenp #(1 2 4 8 3 1 6 7) :start i :end nil))
170 171 172 173
  (2 2 4 8 6 6 6 nil))

(deftest find-if-vector.7
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
174
        (find-if #'evenp #(1 2 4 8 3 1 6 7) :start i :from-end t))
175 176 177 178
  (6 6 6 6 6 6 6 nil))

(deftest find-if-vector.8
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
179
        (find-if #'evenp #(1 2 4 8 3 1 6 7) :start i :end nil :from-end t))
180 181 182 183
  (6 6 6 6 6 6 6 nil))

(deftest find-if-vector.9
  (loop for i from 0 to 8 collect
sds's avatar
sds committed
184
        (find-if #'evenp #(1 2 4 8 3 1 6 7) :end i))
185 186 187 188
  (nil nil 2 2 2 2 2 2 2))

(deftest find-if-vector.10
  (loop for i from 0 to 8 collect
sds's avatar
sds committed
189
        (find-if #'evenp #(1 2 4 8 3 1 6 7) :end i :from-end t))
190 191 192 193
  (nil nil 2 4 8 8 8 6 6))

(deftest find-if-vector.11
  (loop for j from 0 to 7
sds's avatar
sds committed
194 195 196
        collect
        (loop for i from (1+ j) to 8 collect
              (find-if #'evenp #(1 2 4 8 3 1 6 7) :start j :end i)))
197 198 199 200 201 202 203 204 205 206 207
  ((nil 2 2 2 2 2 2 2)
   (2 2 2 2 2 2 2)
   (4 4 4 4 4 4)
   (8 8 8 8 8)
   (nil nil 6 6)
   (nil 6 6)
   (6 6)
   (nil)))

(deftest find-if-vector.12
  (loop for j from 0 to 7
sds's avatar
sds committed
208 209 210 211
        collect
        (loop for i from (1+ j) to 8 collect
              (find-if #'evenp #(1 2 4 8 3 1 6 7) :start j :end i
                       :from-end t)))
212 213 214 215 216 217 218 219 220 221 222
  ((nil 2 4 8 8 8 6 6)
   (2 4 8 8 8 6 6)
   (4 8 8 8 6 6)
   (8 8 8 6 6)
   (nil nil 6 6)
   (nil 6 6)
   (6 6)
   (nil)))

(deftest find-if-vector.13
  (loop for i from 0 to 6
sds's avatar
sds committed
223 224
        collect
        (find-if #'evenp #(1 6 11 32 45 71 100) :key #'1+ :start i))
225 226 227 228
  (1 11 11 45 45 71 nil))

(deftest find-if-vector.14
  (loop for i from 0 to 6
sds's avatar
sds committed
229 230
        collect
        (find-if #'evenp #(1 6 11 32 45 71 100) :key '1+ :start i :from-end t))
231 232 233 234
  (71 71 71 71 71 71 nil))

(deftest find-if-vector.15
  (loop for i from 0 to 7
sds's avatar
sds committed
235 236
        collect
        (find-if #'evenp #(1 6 11 32 45 71 100) :key #'1+ :end i))
237 238 239 240
  (nil 1 1 1 1 1 1 1))

(deftest find-if-vector.16
  (loop for i from 0 to 7
sds's avatar
sds committed
241 242
        collect
        (find-if #'evenp #(1 6 11 32 45 71 100) :key '1+ :end i :from-end t))
243 244 245 246
  (nil 1 1 11 11 45 71 71))

(deftest find-if-vector.17
  (loop for j from 0 to 7
sds's avatar
sds committed
247 248 249
        collect
        (loop for i from (1+ j) to 8 collect
              (find-if #'oddp #(1 2 4 8 3 1 6 7) :start j :end i :key #'1-)))
250 251 252 253 254 255 256 257 258 259 260
  ((nil 2 2 2 2 2 2 2)
   (2 2 2 2 2 2 2)
   (4 4 4 4 4 4)
   (8 8 8 8 8)
   (nil nil 6 6)
   (nil 6 6)
   (6 6)
   (nil)))

(deftest find-if-vector.18
  (loop for j from 0 to 7
sds's avatar
sds committed
261 262 263 264
        collect
        (loop for i from (1+ j) to 8 collect
              (find-if #'oddp #(1 2 4 8 3 1 6 7) :start j :end i
                       :from-end t :key #'1+)))
265 266 267 268 269 270 271 272 273
  ((nil 2 4 8 8 8 6 6)
   (2 4 8 8 8 6 6)
   (4 8 8 8 6 6)
   (8 8 8 6 6)
   (nil nil 6 6)
   (nil 6 6)
   (6 6)
   (nil)))

274 275
(deftest find-if-vector.19
  (let ((a (make-array '(10) :initial-contents '(1 2 3 4 5 6 7 8 9 10)
sds's avatar
sds committed
276
                       :fill-pointer 5)))
277 278 279 280 281 282 283 284
    (values
     (find-if #'evenp a)
     (find-if #'evenp a :from-end t)
     (find-if #'oddp a)
     (find-if #'oddp a :from-end t)
     ))
  2 4 1 5)

285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300
;;; Tests for bit vectors

(deftest find-if-bit-vector.1
  (find-if #'identity #*)
  nil)

(deftest find-if-bit-vector.2
  (find-if #'identity #*1)
  1)

(deftest find-if-bit-vector.3
  (find-if #'identity #*0)
  0)

(deftest find-if-bit-vector.4
  (loop for i from 0 to 6
sds's avatar
sds committed
301 302
        collect (loop for j from i to 7
                      collect (find-if #'evenp #*0110110 :start i :end j)))
303 304 305 306 307 308 309 310 311 312
  ((nil 0 0 0 0 0 0 0)
   (nil nil nil 0 0 0 0)
   (nil nil 0 0 0 0)
   (nil 0 0 0 0)
   (nil nil nil 0)
   (nil nil 0)
   (nil 0)))

(deftest find-if-bit-vector.5
  (loop for i from 0 to 6
sds's avatar
sds committed
313 314 315
        collect (loop for j from i to 7
                      collect (find-if #'evenp #*0110110 :start i :end j
                                       :from-end t)))
316 317 318 319 320 321 322 323 324 325
  ((nil 0 0 0 0 0 0 0)
   (nil nil nil 0 0 0 0)
   (nil nil 0 0 0 0)
   (nil 0 0 0 0)
   (nil nil nil 0)
   (nil nil 0)
   (nil 0)))

(deftest find-if-bit-vector.6
  (loop for i from 0 to 6
sds's avatar
sds committed
326 327 328
        collect (loop for j from i to 7
                      collect (find-if #'oddp #*0110110 :start i :end j
                                       :from-end t :key #'1+)))
329 330 331 332 333 334 335 336 337 338
  ((nil 0 0 0 0 0 0 0)
   (nil nil nil 0 0 0 0)
   (nil nil 0 0 0 0)
   (nil 0 0 0 0)
   (nil nil nil 0)
   (nil nil 0)
   (nil 0)))

(deftest find-if-bit-vector.7
  (loop for i from 0 to 6
sds's avatar
sds committed
339 340 341
        collect (loop for j from i to 7
                      collect (find-if #'oddp #*0110110 :start i :end j
                                       :key '1-)))
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
  ((nil 0 0 0 0 0 0 0)
   (nil nil nil 0 0 0 0)
   (nil nil 0 0 0 0)
   (nil 0 0 0 0)
   (nil nil nil 0)
   (nil nil 0)
   (nil 0)))

;;; Tests for strings

(deftest find-if-string.1
  (find-if #'identity "")
  nil)

(deftest find-if-string.2
  (find-if #'identity "a")
  #\a)

(deftest find-if-string.2a
  (find-if 'identity "a")
  #\a)

(deftest find-if-string.3
  (find-if #'evendigitp "12483167")
  #\2)
sds's avatar
sds committed
367

368 369 370 371 372 373 374 375 376 377
(deftest find-if-string.3a
  (find-if #'evenp "12483167" :key #'(lambda (c) (read-from-string (string c))))
  #\2)

(deftest find-if-string.4
  (find-if #'evendigitp "12483167" :from-end t)
  #\6)

(deftest find-if-string.5
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
378
        (find-if #'evendigitp "12483167" :start i))
379 380 381 382
  (#\2 #\2 #\4 #\8 #\6 #\6 #\6 nil))

(deftest find-if-string.6
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
383
        (find-if #'evendigitp "12483167" :start i :end nil))
384 385 386 387
  (#\2 #\2 #\4 #\8 #\6 #\6 #\6 nil))

(deftest find-if-string.7
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
388
        (find-if #'evendigitp "12483167" :start i :from-end t))
389 390 391 392
  (#\6 #\6 #\6 #\6 #\6 #\6 #\6 nil))

(deftest find-if-string.8
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
393
        (find-if #'evendigitp "12483167" :start i :end nil :from-end t))
394 395 396 397
  (#\6 #\6 #\6 #\6 #\6 #\6 #\6 nil))

(deftest find-if-string.9
  (loop for i from 0 to 8 collect
sds's avatar
sds committed
398
        (find-if #'evendigitp "12483167" :end i))
399 400 401 402
  (nil nil #\2 #\2 #\2 #\2 #\2 #\2 #\2))

(deftest find-if-string.10
  (loop for i from 0 to 8 collect
sds's avatar
sds committed
403
        (find-if #'evendigitp "12483167" :end i :from-end t))
404 405 406 407
  (nil nil #\2 #\4 #\8 #\8 #\8 #\6 #\6))

(deftest find-if-string.11
  (loop for j from 0 to 7
sds's avatar
sds committed
408 409 410
        collect
        (loop for i from (1+ j) to 8 collect
              (find-if #'evendigitp "12483167" :start j :end i)))
411 412 413 414 415 416 417 418 419 420 421
  ((nil #\2 #\2 #\2 #\2 #\2 #\2 #\2)
   (#\2 #\2 #\2 #\2 #\2 #\2 #\2)
   (#\4 #\4 #\4 #\4 #\4 #\4)
   (#\8 #\8 #\8 #\8 #\8)
   (nil nil #\6 #\6)
   (nil #\6 #\6)
   (#\6 #\6)
   (nil)))

(deftest find-if-string.12
  (loop for j from 0 to 7
sds's avatar
sds committed
422 423 424 425
        collect
        (loop for i from (1+ j) to 8 collect
              (find-if #'evendigitp "12483167" :start j :end i
                       :from-end t)))
426 427 428 429 430 431 432 433 434 435 436
  ((nil #\2 #\4 #\8 #\8 #\8 #\6 #\6)
   (#\2 #\4 #\8 #\8 #\8 #\6 #\6)
   (#\4 #\8 #\8 #\8 #\6 #\6)
   (#\8 #\8 #\8 #\6 #\6)
   (nil nil #\6 #\6)
   (nil #\6 #\6)
   (#\6 #\6)
   (nil)))

(deftest find-if-string.13
  (loop for i from 0 to 6
sds's avatar
sds committed
437 438 439 440
        collect
        (find-if #'evenp "1473816"
                 :key (compose #'read-from-string #'string)
                 :start i))
441 442 443 444
  (#\4 #\4 #\8 #\8 #\8 #\6 #\6))

(deftest find-if-string.14
  (loop for i from 0 to 6
sds's avatar
sds committed
445 446 447 448
        collect
        (find-if #'evenp "1473816"
                 :key (compose #'read-from-string #'string)
                 :start i :from-end t))
449 450 451 452
  (#\6 #\6 #\6 #\6 #\6 #\6 #\6))

(deftest find-if-string.15
  (loop for i from 0 to 7
sds's avatar
sds committed
453 454 455 456
        collect
        (find-if #'evenp "1473816"
                 :key (compose #'read-from-string #'string)
                 :end i))
457 458 459 460
  (nil nil #\4 #\4 #\4 #\4 #\4 #\4))

(deftest find-if-string.16
  (loop for i from 0 to 7
sds's avatar
sds committed
461 462 463 464
        collect
        (find-if #'evenp "1473816"
                 :key (compose #'read-from-string #'string)
                 :end i :from-end t))
465 466 467 468
  (nil nil #\4 #\4 #\4 #\8 #\8 #\6))

(deftest find-if-string.17
  (loop for j from 0 to 6
sds's avatar
sds committed
469 470 471 472 473
        collect
        (loop for i from (1+ j) to 7 collect
              (find-if #'evenp "1473816"
                 :key (compose #'read-from-string #'string)
                 :start j :end i)))
474 475 476 477 478 479
  ((nil #\4 #\4 #\4 #\4 #\4 #\4)
   (#\4 #\4 #\4 #\4 #\4 #\4)
   (nil nil #\8 #\8 #\8)
   (nil #\8 #\8 #\8)
   (#\8 #\8 #\8)
   (nil #\6)
sds's avatar
sds committed
480
   (#\6)))
481 482 483

(deftest find-if-string.18
  (loop for j from 0 to 6
sds's avatar
sds committed
484 485 486 487 488 489
        collect
        (loop for i from (1+ j) to 7 collect
              (find-if #'evenp "1473816"
                 :key (compose #'read-from-string #'string)
                 :start j :end i
                 :from-end t)))
490 491 492 493 494 495 496 497
  ((nil #\4 #\4 #\4 #\8 #\8 #\6)
   (#\4 #\4 #\4 #\8 #\8 #\6)
   (nil nil #\8 #\8 #\6)
   (nil #\8 #\8 #\6)
   (#\8 #\8 #\6)
   (nil #\6)
   (#\6)))

498
(deftest find-if-string.19
499
  (let ((a (make-array '(10) :initial-contents "123456789a"
sds's avatar
sds committed
500 501
                       :fill-pointer 5
                       :element-type 'character)))
502 503 504 505 506 507 508 509
    (values
     (find-if #'evendigitp a)
     (find-if #'evendigitp a :from-end t)
     (find-if #'odddigitp a)
     (find-if #'odddigitp a :from-end t)
     ))
  #\2 #\4 #\1 #\5)

510 511 512 513 514 515
(deftest find-if-string.20
  (do-special-strings
   (s "123a456" nil)
   (assert (eql (find-if #'alpha-char-p s) #\a)))
  nil)

516 517 518 519 520 521 522 523 524 525 526 527 528
;;; Keyword tests

(deftest find-if.allow-other-keys.1
  (find-if #'evenp '(1 2 3 4 5) :bad t :allow-other-keys t)
  2)

(deftest find-if.allow-other-keys.2
  (find-if #'evenp '(1 2 3 4 5) :allow-other-keys t :also-bad t)
  2)

;;; The leftmost of two :allow-other-keys arguments is the one that  matters.
(deftest find-if.allow-other-keys.3
  (find-if #'evenp '(1 2 3 4 5)
sds's avatar
sds committed
529 530 531
            :allow-other-keys t
            :allow-other-keys nil
            :bad t)
532 533 534 535 536 537 538 539 540 541 542
  2)

(deftest find-if.keywords.4
  (find-if #'evenp '(1 2 3 4 5) :key #'identity :key #'1+)
  2)

(deftest find-if.allow-other-keys.5
  (find-if #'identity '(nil a b c nil) :allow-other-keys nil)
  a)


543 544
;;; Error tests

545
(deftest find-if.error.1
546 547
  (check-type-error #'(lambda (x) (find-if #'null x)) #'(lambda (x) (typep x 'sequence)))
  nil)
548

549
(deftest find-if.error.4
550 551
  (signals-error (find-if 'null '(a b c . d)) type-error)
  t)
552 553

(deftest find-if.error.5
554 555
  (signals-error (find-if) program-error)
  t)
556 557

(deftest find-if.error.6
558 559
  (signals-error (find-if #'null) program-error)
  t)
560 561

(deftest find-if.error.7
562 563
  (signals-error (find-if #'null nil :bad t) program-error)
  t)
564 565

(deftest find-if.error.8
566
  (signals-error (find-if #'null nil :bad t :allow-other-keys nil)
sds's avatar
sds committed
567
                 program-error)
568
  t)
569 570

(deftest find-if.error.9
571 572
  (signals-error (find-if #'null nil 1 1) program-error)
  t)
573 574

(deftest find-if.error.10
575 576
  (signals-error (find-if #'null nil :key) program-error)
  t)
577 578

(deftest find-if.error.11
579 580
  (signals-error (locally (find-if #'null 'b) t) type-error)
  t)
581

582
(deftest find-if.error.12
583 584
  (signals-error (find-if #'cons '(a b c)) program-error)
  t)
585 586

(deftest find-if.error.13
587 588
  (signals-error (find-if #'car '(a b c)) type-error)
  t)
589 590

(deftest find-if.error.14
591 592
  (signals-error (find-if #'identity '(a b c) :key #'cons) program-error)
  t)
593 594

(deftest find-if.error.15
595
  (signals-error (find-if #'identity '(a b c) :key #'car)
sds's avatar
sds committed
596
                 type-error)
597
  t)
598

599 600 601 602 603 604
;;; Order of evaluation tests

(deftest find-if.order.1
  (let ((i 0) x y)
    (values
     (find-if (progn (setf x (incf i)) #'identity)
sds's avatar
sds committed
605
              (progn (setf y (incf i)) '(nil nil nil a nil nil)))
606 607 608 609
     i x y))
  a 2 1 2)

(deftest find-if.order.2
610
  (let ((i 0) a b c d e f)
611 612
    (values
     (find-if (progn (setf a (incf i)) #'null)
sds's avatar
sds committed
613 614 615 616 617 618
              (progn (setf b (incf i)) '(nil nil nil a nil nil))
              :start (progn (setf c (incf i)) 1)
              :end   (progn (setf d (incf i)) 4)
              :from-end (setf e (incf i))
              :key   (progn (setf f (incf i)) #'null)
              )
619 620 621 622 623
     i a b c d e f))
  a 6 1 2 3 4 5 6)


(deftest find-if.order.3
624
  (let ((i 0) a b c d e f)
625 626
    (values
     (find-if (progn (setf a (incf i)) #'null)
sds's avatar
sds committed
627 628 629 630 631 632
              (progn (setf b (incf i)) '(nil nil nil a nil nil))
              :key   (progn (setf c (incf i)) #'null)
              :from-end (setf d (incf i))
              :end   (progn (setf e (incf i)) 4)
              :start (progn (setf f (incf i)) 1)
              )
633 634
     i a b c d e f))
  a 6 1 2 3 4 5 6)