find-if-not.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 20:53:24 2002
;;;; Contains: Tests for FIND-IF-NOT

(in-package :cl-test)

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

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

(deftest find-if-not-list.2a
  (find-if-not 'null '(a))
  a)

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

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

(deftest find-if-not-list.5
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
30
        (find-if-not #'oddp '(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-not-list.6
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
35
        (find-if-not #'oddp '(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-not-list.7
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
40
        (find-if-not #'oddp '(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-not-list.8
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
45
        (find-if-not #'oddp '(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-not-list.9
  (loop for i from 0 to 8 collect
sds's avatar
sds committed
50
        (find-if-not #'oddp '(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-not-list.10
  (loop for i from 0 to 8 collect
sds's avatar
sds committed
55
        (find-if-not #'oddp '(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-not-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-not #'oddp '(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-not-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-not #'oddp '(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-not-list.13
  (loop for i from 0 to 6
sds's avatar
sds committed
89 90
        collect
        (find-if-not #'oddp '(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-not-list.14
  (loop for i from 0 to 6
sds's avatar
sds committed
95 96
        collect
        (find-if-not #'oddp '(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-not-list.15
  (loop for i from 0 to 7
sds's avatar
sds committed
101 102
        collect
        (find-if-not #'oddp '(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-not-list.16
  (loop for i from 0 to 7
sds's avatar
sds committed
107 108
        collect
        (find-if-not #'oddp '(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-not-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-not #'evenp '(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-not-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-not #'evenp '(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-not-vector.1
  (find-if-not #'identity #())
  nil)

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

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

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

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

(deftest find-if-not-vector.5
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
164
        (find-if-not #'oddp #(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-not-vector.6
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
169
        (find-if-not #'oddp #(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-not-vector.7
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
174
        (find-if-not #'oddp #(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-not-vector.8
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
179
        (find-if-not #'oddp #(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-not-vector.9
  (loop for i from 0 to 8 collect
sds's avatar
sds committed
184
        (find-if-not #'oddp #(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-not-vector.10
  (loop for i from 0 to 8 collect
sds's avatar
sds committed
189
        (find-if-not #'oddp #(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-not-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-not #'oddp #(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-not-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-not #'oddp #(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-not-vector.13
  (loop for i from 0 to 6
sds's avatar
sds committed
223 224
        collect
        (find-if-not #'oddp #(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-not-vector.14
  (loop for i from 0 to 6
sds's avatar
sds committed
229 230
        collect
        (find-if-not #'oddp #(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-not-vector.15
  (loop for i from 0 to 7
sds's avatar
sds committed
235 236
        collect
        (find-if-not #'oddp #(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-not-vector.16
  (loop for i from 0 to 7
sds's avatar
sds committed
241 242
        collect
        (find-if-not #'oddp #(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-not-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-not #'evenp #(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-not-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-not #'evenp #(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 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289
  ((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 bit vectors

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

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

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

(deftest find-if-not-bit-vector.4
  (loop for i from 0 to 6
sds's avatar
sds committed
290 291
        collect (loop for j from i to 7
                      collect (find-if-not #'oddp #*0110110 :start i :end j)))
292 293 294 295 296 297 298 299 300 301
  ((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-not-bit-vector.5
  (loop for i from 0 to 6
sds's avatar
sds committed
302 303 304
        collect (loop for j from i to 7
                      collect (find-if-not #'oddp #*0110110 :start i :end j
                                       :from-end t)))
305 306 307 308 309 310 311 312 313 314
  ((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-not-bit-vector.6
  (loop for i from 0 to 6
sds's avatar
sds committed
315 316 317
        collect (loop for j from i to 7
                      collect (find-if-not #'evenp #*0110110 :start i :end j
                                       :from-end t :key #'1+)))
318 319 320 321 322 323 324 325 326 327
  ((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-not-bit-vector.7
  (loop for i from 0 to 6
sds's avatar
sds committed
328 329 330
        collect (loop for j from i to 7
                      collect (find-if-not #'evenp #*0110110 :start i :end j
                                       :key '1-)))
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
  ((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-not-string.1
  (find-if-not #'identity "")
  nil)

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

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

(deftest find-if-not-string.3
  (find-if-not #'odddigitp "12483167")
  #\2)
sds's avatar
sds committed
356

357 358 359 360 361 362 363 364 365 366
(deftest find-if-not-string.3a
  (find-if-not #'oddp "12483167" :key #'(lambda (c) (read-from-string (string c))))
  #\2)

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

(deftest find-if-not-string.5
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
367
        (find-if-not #'odddigitp "12483167" :start i))
368 369 370 371
  (#\2 #\2 #\4 #\8 #\6 #\6 #\6 nil))

(deftest find-if-not-string.6
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
372
        (find-if-not #'odddigitp "12483167" :start i :end nil))
373 374 375 376
  (#\2 #\2 #\4 #\8 #\6 #\6 #\6 nil))

(deftest find-if-not-string.7
  (loop for i from 0 to 7 collect
sds's avatar
sds committed
377
        (find-if-not #'odddigitp "12483167" :start i :from-end t))
378 379 380 381
  (#\6 #\6 #\6 #\6 #\6 #\6 #\6 nil))

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

(deftest find-if-not-string.9
  (loop for i from 0 to 8 collect
sds's avatar
sds committed
387
        (find-if-not #'odddigitp "12483167" :end i))
388 389 390 391
  (nil nil #\2 #\2 #\2 #\2 #\2 #\2 #\2))

(deftest find-if-not-string.10
  (loop for i from 0 to 8 collect
sds's avatar
sds committed
392
        (find-if-not #'odddigitp "12483167" :end i :from-end t))
393 394 395 396
  (nil nil #\2 #\4 #\8 #\8 #\8 #\6 #\6))

(deftest find-if-not-string.11
  (loop for j from 0 to 7
sds's avatar
sds committed
397 398 399
        collect
        (loop for i from (1+ j) to 8 collect
              (find-if-not #'odddigitp "12483167" :start j :end i)))
400 401 402 403 404 405 406 407 408 409 410
  ((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-not-string.12
  (loop for j from 0 to 7
sds's avatar
sds committed
411 412 413 414
        collect
        (loop for i from (1+ j) to 8 collect
              (find-if-not #'odddigitp "12483167" :start j :end i
                       :from-end t)))
415 416 417 418 419 420 421 422 423 424 425
  ((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-not-string.13
  (loop for i from 0 to 6
sds's avatar
sds committed
426 427 428 429
        collect
        (find-if-not #'oddp "1473816"
                 :key (compose #'read-from-string #'string)
                 :start i))
430 431 432 433
  (#\4 #\4 #\8 #\8 #\8 #\6 #\6))

(deftest find-if-not-string.14
  (loop for i from 0 to 6
sds's avatar
sds committed
434 435 436 437
        collect
        (find-if-not #'oddp "1473816"
                 :key (compose #'read-from-string #'string)
                 :start i :from-end t))
438 439 440 441
  (#\6 #\6 #\6 #\6 #\6 #\6 #\6))

(deftest find-if-not-string.15
  (loop for i from 0 to 7
sds's avatar
sds committed
442 443 444 445
        collect
        (find-if-not #'oddp "1473816"
                 :key (compose #'read-from-string #'string)
                 :end i))
446 447 448 449
  (nil nil #\4 #\4 #\4 #\4 #\4 #\4))

(deftest find-if-not-string.16
  (loop for i from 0 to 7
sds's avatar
sds committed
450 451 452 453
        collect
        (find-if-not #'oddp "1473816"
                 :key (compose #'read-from-string #'string)
                 :end i :from-end t))
454 455 456 457
  (nil nil #\4 #\4 #\4 #\8 #\8 #\6))

(deftest find-if-not-string.17
  (loop for j from 0 to 6
sds's avatar
sds committed
458 459 460 461 462
        collect
        (loop for i from (1+ j) to 7 collect
              (find-if-not #'oddp "1473816"
                 :key (compose #'read-from-string #'string)
                 :start j :end i)))
463 464 465 466 467 468
  ((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
469
   (#\6)))
470 471 472

(deftest find-if-not-string.18
  (loop for j from 0 to 6
sds's avatar
sds committed
473 474 475 476 477 478
        collect
        (loop for i from (1+ j) to 7 collect
              (find-if-not #'oddp "1473816"
                 :key (compose #'read-from-string #'string)
                 :start j :end i
                 :from-end t)))
479 480 481 482 483 484 485 486
  ((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)))

487 488 489 490 491
(deftest find-if-not-string.19
  (do-special-strings
   (s "abc1def" nil)
   (assert (eql (find-if-not #'alpha-char-p s) #\1)))
  nil)
492 493 494 495 496 497 498 499 500 501 502 503 504 505

;;; Keyword tests

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

(deftest find-if-not.allow-other-keys.2
  (find-if-not #'oddp '(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-not.allow-other-keys.3
  (find-if-not #'oddp '(1 2 3 4 5)
sds's avatar
sds committed
506 507 508
            :allow-other-keys t
            :allow-other-keys nil
            :bad t)
509 510 511 512 513 514 515 516 517 518
  2)

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

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

519 520
;;; Error tests

521
(deftest find-if-not.error.1
522 523
  (check-type-error #'(lambda (x) (find-if-not #'null x)) #'(lambda (x) (typep x 'sequence)))
  nil)
524

525
(deftest find-if-not.error.4
526
  (signals-error (find-if-not 'identity '(a b c . d))
sds's avatar
sds committed
527
                 type-error)
528
  t)
529 530

(deftest find-if-not.error.5
531 532
  (signals-error (find-if-not) program-error)
  t)
533 534

(deftest find-if-not.error.6
535 536
  (signals-error (find-if-not #'null) program-error)
  t)
537 538

(deftest find-if-not.error.7
539 540
  (signals-error (find-if-not #'null nil :bad t) program-error)
  t)
541 542

(deftest find-if-not.error.8
543
  (signals-error (find-if-not #'null nil :bad t :allow-other-keys nil)
sds's avatar
sds committed
544
                 program-error)
545
  t)
546 547

(deftest find-if-not.error.9
548 549
  (signals-error (find-if-not #'null nil 1 1) program-error)
  t)
550 551

(deftest find-if-not.error.10
552 553
  (signals-error (find-if-not #'null nil :key) program-error)
  t)
554 555

(deftest find-if-not.error.11
556 557
  (signals-error (locally (find-if-not #'null 'b) t) type-error)
  t)
558

559
(deftest find-if-not.error.12
560 561
  (signals-error (find-if-not #'cons '(a b c)) program-error)
  t)
562 563

(deftest find-if-not.error.13
564 565
  (signals-error (find-if-not #'car '(a b c)) type-error)
  t)
566 567

(deftest find-if-not.error.14
568
  (signals-error (find-if-not #'identity '(a b c) :key #'cons)
sds's avatar
sds committed
569
                 program-error)
570
  t)
571 572

(deftest find-if-not.error.15
573
  (signals-error (find-if-not #'identity '(a b c) :key #'car)
sds's avatar
sds committed
574
                 type-error)
575
  t)
576

577 578 579 580 581 582
;;; Order of evaluation tests

(deftest find-if-not.order.1
  (let ((i 0) x y)
    (values
     (find-if-not (progn (setf x (incf i)) #'null)
sds's avatar
sds committed
583
                  (progn (setf y (incf i)) '(nil nil nil a nil nil)))
584 585 586 587
     i x y))
  a 2 1 2)

(deftest find-if-not.order.2
588
  (let ((i 0) a b c d e f)
589 590
    (values
     (find-if-not (progn (setf a (incf i)) #'identity)
sds's avatar
sds committed
591 592 593 594 595 596
                  (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)
                  )
597 598 599 600 601
     i a b c d e f))
  a 6 1 2 3 4 5 6)


(deftest find-if-not.order.3
602
  (let ((i 0) a b c d e f)
603 604
    (values
     (find-if-not (progn (setf a (incf i)) #'identity)
sds's avatar
sds committed
605 606 607 608 609 610
                  (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)
                  )
611 612
     i a b c d e f))
  a 6 1 2 3 4 5 6)