merge.lsp 16.4 KB
Newer Older
1 2 3 4 5 6 7 8 9
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Fri Sep  6 07:24:17 2002
;;;; Contains: Tests for MERGE

(in-package :cl-test)

(deftest merge-list.1
  (let ((x (list 1 3 7 8 10))
sds's avatar
sds committed
10
        (y (list 2 4 5 8 11)))
11 12 13 14 15
    (merge 'list x y #'<))
  (1 2 3 4 5 7 8 8 10 11))

(deftest merge-list.2
  (let ((x nil)
sds's avatar
sds committed
16
        (y (list 2 4 5 8 11)))
17 18 19 20 21
    (merge 'list x y #'<))
  (2 4 5 8 11))

(deftest merge-list.3
  (let ((x nil)
sds's avatar
sds committed
22
        (y (list 2 4 5 8 11)))
23 24 25 26 27 28 29 30 31
    (merge 'list y x #'<))
  (2 4 5 8 11))

(deftest merge-list.4
  (merge 'list nil nil #'<)
  nil)

(deftest merge-list.5
  (let ((x (vector 1 3 7 8 10))
sds's avatar
sds committed
32
        (y (list 2 4 5 8 11)))
33 34 35 36 37
    (merge 'list x y #'<))
  (1 2 3 4 5 7 8 8 10 11))

(deftest merge-list.6
  (let ((x (list 1 3 7 8 10))
sds's avatar
sds committed
38
        (y (vector 2 4 5 8 11)))
39 40 41 42 43
    (merge 'list x y #'<))
  (1 2 3 4 5 7 8 8 10 11))

(deftest merge-list.7
  (let ((x (vector 1 3 7 8 10))
sds's avatar
sds committed
44
        (y (vector 2 4 5 8 11)))
45 46 47 48 49
    (merge 'list x y #'<))
  (1 2 3 4 5 7 8 8 10 11))

(deftest merge-list.8
  (let ((x (sort (list 1 3 7 8 10) #'>))
sds's avatar
sds committed
50
        (y (sort (list 2 4 5 8 11) #'>)))
51 52 53 54 55
    (merge 'list x y #'< :key #'-))
  (11 10 8 8 7 5 4 3 2 1))

(deftest merge-list.9
  (let ((x (list 1 3 7 8 10))
sds's avatar
sds committed
56
        (y (list 2 4 5 8 11)))
57 58 59 60 61
    (merge 'list x y #'< :key nil))
  (1 2 3 4 5 7 8 8 10 11))

(deftest merge-list.10
  (let ((x (list 1 3 7 8 10))
sds's avatar
sds committed
62
        (y (list 2 4 5 8 11)))
63 64 65 66 67 68 69 70 71 72 73 74 75 76
    (merge 'list x y '<))
  (1 2 3 4 5 7 8 8 10 11))

(deftest merge-list.11
  (let ((x (vector)) (y (vector)))
    (merge 'list x y #'<))
  nil)

(deftest merge-list.12
  (let ((x nil) (y (vector 1 2 3)))
    (merge 'list x y #'<))
  (1 2 3))

(deftest merge-list.13
77
  (let ((x (vector)) (y (list 1 2 3)))
78 79 80 81 82 83 84 85 86
    (merge 'list x y #'<))
  (1 2 3))

(deftest merge-list.14
  (let ((x nil) (y (vector 1 2 3)))
    (merge 'list y x #'<))
  (1 2 3))

(deftest merge-list.15
87
  (let ((x (vector)) (y (list 1 2 3)))
88 89 90 91 92 93 94
    (merge 'list y x #'<))
  (1 2 3))

;;; Tests yielding vectors

(deftest merge-vector.1
  (let ((x (list 1 3 7 8 10))
sds's avatar
sds committed
95
        (y (list 2 4 5 8 11)))
96 97 98 99 100
    (merge 'vector x y #'<))
  #(1 2 3 4 5 7 8 8 10 11))

(deftest merge-vector.2
  (let ((x nil)
sds's avatar
sds committed
101
        (y (list 2 4 5 8 11)))
102 103 104 105 106
    (merge 'vector x y #'<))
  #(2 4 5 8 11))

(deftest merge-vector.3
  (let ((x nil)
sds's avatar
sds committed
107
        (y (list 2 4 5 8 11)))
108 109 110 111 112 113 114 115 116
    (merge 'vector y x #'<))
  #(2 4 5 8 11))

(deftest merge-vector.4
  (merge 'vector nil nil #'<)
  #())

(deftest merge-vector.5
  (let ((x (vector 1 3 7 8 10))
sds's avatar
sds committed
117
        (y (list 2 4 5 8 11)))
118 119 120 121 122
    (merge 'vector x y #'<))
  #(1 2 3 4 5 7 8 8 10 11))

(deftest merge-vector.6
  (let ((x (list 1 3 7 8 10))
sds's avatar
sds committed
123
        (y (vector 2 4 5 8 11)))
124 125 126 127 128
    (merge 'vector x y #'<))
  #(1 2 3 4 5 7 8 8 10 11))

(deftest merge-vector.7
  (let ((x (vector 1 3 7 8 10))
sds's avatar
sds committed
129
        (y (vector 2 4 5 8 11)))
130 131 132 133 134
    (merge 'vector x y #'<))
  #(1 2 3 4 5 7 8 8 10 11))

(deftest merge-vector.8
  (let ((x (sort (list 1 3 7 8 10) #'>))
sds's avatar
sds committed
135
        (y (sort (list 2 4 5 8 11) #'>)))
136 137 138 139 140
    (merge 'vector x y #'< :key #'-))
  #(11 10 8 8 7 5 4 3 2 1))

(deftest merge-vector.9
  (let ((x (list 1 3 7 8 10))
sds's avatar
sds committed
141
        (y (list 2 4 5 8 11)))
142 143 144 145 146
    (merge 'vector x y #'< :key nil))
  #(1 2 3 4 5 7 8 8 10 11))

(deftest merge-vector.10
  (let ((x (list 1 3 7 8 10))
sds's avatar
sds committed
147
        (y (list 2 4 5 8 11)))
148 149 150 151 152 153 154 155 156 157 158 159 160 161
    (merge 'vector x y '<))
  #(1 2 3 4 5 7 8 8 10 11))

(deftest merge-vector.11
  (let ((x (vector)) (y (vector)))
    (merge 'vector x y #'<))
  #())

(deftest merge-vector.12
  (let ((x nil) (y (vector 1 2 3)))
    (merge 'vector x y #'<))
  #(1 2 3))

(deftest merge-vector.13
162
  (let ((x (vector)) (y (list 1 2 3)))
163 164 165 166 167 168 169 170 171
    (merge 'vector x y #'<))
  #(1 2 3))

(deftest merge-vector.14
  (let ((x nil) (y (vector 1 2 3)))
    (merge 'vector y x #'<))
  #(1 2 3))

(deftest merge-vector.15
172
  (let ((x (vector)) (y (list 1 2 3)))
173 174 175
    (merge 'vector y x #'<))
  #(1 2 3))

176 177
(deftest merge-vector.16
  (let ((x (make-array '(10) :initial-contents '(2 5 8 9 11 12 14 15 18 30)
sds's avatar
sds committed
178 179
                       :fill-pointer 5))
        (y (list 1 6 10)))
180 181 182 183 184
    (merge 'vector x y #'<))
  #(1 2 5 6 8 9 10 11))

(deftest merge-vector.16a
  (let ((x (make-array '(10) :initial-contents '(2 5 8 9 11 12 14 15 18 30)
sds's avatar
sds committed
185 186
                       :fill-pointer 5))
        (y (list 1 6 10)))
187 188 189 190 191
    (merge 'vector y x #'<))
  #(1 2 5 6 8 9 10 11))

(deftest merge-vector.17
  (let* ((x (make-array '(10) :initial-contents '(2 5 8 9 11 12 14 15 18 30)
sds's avatar
sds committed
192 193
                        :fill-pointer 5))
         (result (merge 'vector x () #'<)))
194 195 196 197 198 199
    (values
     (array-element-type result)
     result))
  t
  #(2 5 8 9 11))

200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
(deftest merge-vector.18
  (merge '(vector) (list 1 3 10) (list 2 4 6) #'<)
  #(1 2 3 4 6 10))

(deftest merge-vector.19
  (merge '(vector *) (list 1 3 10) (list 2 4 6) #'<)
  #(1 2 3 4 6 10))

(deftest merge-vector.20
  (merge '(vector t) (list 1 3 10) (list 2 4 6) #'<)
  #(1 2 3 4 6 10))

(deftest merge-vector.21
  (merge '(vector * 6) (list 1 3 10) (list 2 4 6) #'<)
  #(1 2 3 4 6 10))

(deftest merge-vector.22
  (merge '(simple-vector) (list 2 4 6) (list 1 3 5) #'<)
  #(1 2 3 4 5 6))

(deftest merge-vector.23
  (merge '(simple-vector *) (list 2 4 6) (list 1 3 5) #'<)
  #(1 2 3 4 5 6))

(deftest merge-vector.24
  (merge '(simple-vector 6) (list 2 4 6) (list 1 3 5) #'<)
  #(1 2 3 4 5 6))

228 229 230 231
;;; Tests on strings

(deftest merge-string.1
  (let ((x (list #\1 #\3 #\7 #\8))
sds's avatar
sds committed
232
        (y (list #\2 #\4 #\5 #\9)))
233 234 235 236
    (merge 'string x y #'char<))
  "12345789")

(deftest merge-string.1a
237
  (let ((x (copy-seq "1378"))
sds's avatar
sds committed
238
        (y (list #\2 #\4 #\5 #\9)))
239 240 241 242 243
    (merge 'string x y #'char<))
  "12345789")

(deftest merge-string.1b
  (let ((x (list #\1 #\3 #\7 #\8))
sds's avatar
sds committed
244
        (y (copy-seq "2459")))
245 246 247 248
    (merge 'string x y #'char<))
  "12345789")

(deftest merge-string.1c
249
  (let ((x (copy-seq "1378"))
sds's avatar
sds committed
250
        (y (copy-seq "2459")))
251 252 253 254
    (merge 'string x y #'char<))
  "12345789")

(deftest merge-string.1d
255
  (let ((x (copy-seq "1378"))
sds's avatar
sds committed
256
        (y (copy-seq "2459")))
257 258 259 260 261
    (merge 'string y x #'char<))
  "12345789")

(deftest merge-string.2
  (let ((x nil)
sds's avatar
sds committed
262
        (y (list #\2 #\4 #\5 #\9)))
263 264 265 266 267
    (merge 'string x y #'char<))
  "2459")

(deftest merge-string.3
  (let ((x nil)
sds's avatar
sds committed
268
        (y (list #\2 #\4 #\5 #\9)))
269 270 271 272 273 274 275 276 277
    (merge 'string y x #'char<))
  "2459")

(deftest merge-string.4
  (merge 'string nil nil #'char<)
  "")

(deftest merge-string.8
  (let ((x (list #\1 #\3 #\7 #\8))
sds's avatar
sds committed
278
        (y (list #\2 #\4 #\5)))
279 280
    (merge 'string x y #'char< :key #'nextdigit))
  "1234578")
sds's avatar
sds committed
281

282 283
(deftest merge-string.9
  (let ((x (list #\1 #\3 #\7 #\8))
sds's avatar
sds committed
284
        (y (list  #\2 #\4 #\5 #\9)))
285 286 287 288 289
    (merge 'string x y #'char< :key nil))
  "12345789")

(deftest merge-string.10
  (let ((x (list #\1 #\3 #\7 #\8))
sds's avatar
sds committed
290
        (y (list  #\2 #\4 #\5 #\9)))
291 292 293 294 295 296 297 298 299 300 301 302 303 304
    (merge 'string x y 'char<))
  "12345789")

(deftest merge-string.11
  (let ((x (vector)) (y (vector)))
    (merge 'string x y #'char<))
  "")

(deftest merge-string.12
  (let ((x nil) (y (vector #\1 #\2 #\3)))
    (merge 'string x y #'char<))
  "123")

(deftest merge-string.13
305
  (let ((x (vector)) (y (list #\1 #\2 #\3)))
306 307 308 309
    (merge 'string x y #'char<))
  "123")

(deftest merge-string.13a
310
  (let ((x (copy-seq "")) (y (list #\1 #\2 #\3)))
311 312 313 314 315 316 317 318 319
    (merge 'string x y #'char<))
  "123")

(deftest merge-string.14
  (let ((x nil) (y (vector #\1 #\2 #\3)))
    (merge 'string y x #'char<))
  "123")

(deftest merge-string.14a
320
  (let ((x (copy-seq "")) (y (vector #\1 #\2 #\3)))
321 322 323
    (merge 'string y x #'char<))
  "123")

324
(deftest merge-string.15
325
  (let* ((x (make-array '(10) :initial-contents "adgkmpruwv"
sds's avatar
sds committed
326 327
                        :fill-pointer 5 :element-type 'character))
         (y (copy-seq "bci")))
328 329 330 331
    (merge 'string x y #'char<))
  "abcdgikm")

(deftest merge-string.16
332
  (let* ((x (make-array '(10) :initial-contents "adgkmpruwv"
sds's avatar
sds committed
333 334
                        :fill-pointer 5 :element-type 'character))
         (y (copy-seq "bci")))
335 336 337 338
    (merge 'string y x #'char<))
  "abcdgikm")

(deftest merge-string.17
339
  (let* ((x (make-array '(10) :initial-contents "adgkmpruwv"
sds's avatar
sds committed
340
                        :fill-pointer 5 :element-type 'character)))
341 342 343 344
    (merge 'string nil x #'char<))
  "adgkm")

(deftest merge-string.18
345
  (let* ((x (make-array '(10) :initial-contents "adgkmpruwv"
sds's avatar
sds committed
346
                        :fill-pointer 5 :element-type 'character)))
347 348 349
    (merge 'string x nil #'char<))
  "adgkm")

350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379
(deftest merge-string.19
  (do-special-strings
   (s "ace" nil)
   (assert (string= (merge 'string s (copy-seq "bdf") #'char<) "abcdef")))
  nil)

(deftest merge-string.20
  (do-special-strings
   (s "ace" nil)
   (assert (string= (merge 'base-string (copy-seq "bdf") s #'char<) "abcdef")))
  nil)

(deftest merge-string.21
  (do-special-strings
   (s "ace" nil)
   (assert (string= (merge 'simple-string s (copy-seq "bdf") #'char<) "abcdef")))
  nil)

(deftest merge-string.22
  (do-special-strings
   (s "ace" nil)
   (assert (string= (merge 'simple-base-string s (copy-seq "bdf") #'char<) "abcdef")))
  nil)

(deftest merge-string.23
  (do-special-strings
   (s "ace" nil)
   (assert (string= (merge '(vector character) s (copy-seq "bdf") #'char<) "abcdef")))
  nil)

380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428
(deftest merge-string.24
  (merge '(string) (copy-seq "ace") (copy-seq "bdf") #'char<)
  "abcdef")

(deftest merge-string.25
  (merge '(string *) (copy-seq "ace") (copy-seq "bdf") #'char<)
  "abcdef")

(deftest merge-string.26
  (merge '(string 6) (copy-seq "ace") (copy-seq "bdf") #'char<)
  "abcdef")

(deftest merge-string.27
  (merge '(simple-string) (copy-seq "ace") (copy-seq "bdf") #'char<)
  "abcdef")

(deftest merge-string.28
  (merge '(simple-string *) (copy-seq "ace") (copy-seq "bdf") #'char<)
  "abcdef")

(deftest merge-string.29
  (merge '(simple-string 6) (copy-seq "ace") (copy-seq "bdf") #'char<)
  "abcdef")

(deftest merge-string.30
  (merge '(base-string) (copy-seq "ace") (copy-seq "bdf") #'char<)
  "abcdef")

(deftest merge-string.31
  (merge '(base-string *) (copy-seq "ace") (copy-seq "bdf") #'char<)
  "abcdef")

(deftest merge-string.32
  (merge '(base-string 6) (copy-seq "ace") (copy-seq "bdf") #'char<)
  "abcdef")

(deftest merge-string.33
  (merge '(simple-base-string) (copy-seq "ace") (copy-seq "bdf") #'char<)
  "abcdef")

(deftest merge-string.34
  (merge '(simple-base-string *) (copy-seq "ace") (copy-seq "bdf") #'char<)
  "abcdef")

(deftest merge-string.35
  (merge '(simple-base-string 6) (copy-seq "ace") (copy-seq "bdf") #'char<)
  "abcdef")


429 430
;;; Tests for bit vectors

431
(deftest merge-bit-vector.1
432
  (let ((x (list 0 0 1 1 1))
sds's avatar
sds committed
433
        (y (list 0 0 0 1 1)))
434 435 436
    (merge 'bit-vector x y #'<))
  #*0000011111)

437
(deftest merge-bit-vector.2
438
  (let ((x nil)
sds's avatar
sds committed
439
        (y (list 0 0 0 1 1)))
440 441 442
    (merge 'bit-vector x y #'<))
  #*00011)

443
(deftest merge-bit-vector.3
444
  (let ((x nil)
sds's avatar
sds committed
445
        (y (list 0 0 0 1 1)))
446 447 448
    (merge 'bit-vector y x #'<))
  #*00011)

449
(deftest merge-bit-vector.4
450 451 452
  (merge 'bit-vector nil nil #'<)
  #*)

453
(deftest merge-bit-vector.5
454
  (let ((x (vector 0 0 1 1 1))
sds's avatar
sds committed
455
        (y (list 0 0 0 1 1)))
456 457 458
    (merge 'bit-vector x y #'<))
  #*0000011111)

459
(deftest merge-bit-vector.5a
460
  (let ((x (copy-seq #*00111))
sds's avatar
sds committed
461
        (y (list 0 0 0 1 1)))
462 463 464
    (merge 'bit-vector x y #'<))
  #*0000011111)

465
(deftest merge-bit-vector.5b
466
  (let ((x (list 0 0 1 1 1))
sds's avatar
sds committed
467
        (y (copy-seq #*00011)))
468 469 470
    (merge 'bit-vector x y #'<))
  #*0000011111)

471
(deftest merge-bit-vector.5c
472
  (let ((x (copy-seq #*00111))
sds's avatar
sds committed
473
        (y (copy-seq #*00011)))
474 475 476
    (merge 'bit-vector x y #'<))
  #*0000011111)

477
(deftest merge-bit-vector.5d
478
  (let ((x (copy-seq #*11111))
sds's avatar
sds committed
479
        (y (copy-seq #*00000)))
480 481 482
    (merge 'bit-vector x y #'<))
  #*0000011111)

483
(deftest merge-bit-vector.5e
484
  (let ((x (copy-seq #*11111))
sds's avatar
sds committed
485
        (y (copy-seq #*00000)))
486 487 488
    (merge 'bit-vector y x #'<))
  #*0000011111)

489
(deftest merge-bit-vector.6
490
  (let ((x (list 0 0 1 1 1))
sds's avatar
sds committed
491
        (y (vector 0 0 0 1 1)))
492 493 494
    (merge 'bit-vector x y #'<))
  #*0000011111)

495
(deftest merge-bit-vector.7
496
  (let ((x (vector 0 0 1 1 1))
sds's avatar
sds committed
497
        (y (vector 0 0 0 1 1)))
498 499 500
    (merge 'bit-vector x y #'<))
  #*0000011111)

501
(deftest merge-bit-vector.8
502
  (let ((x (list 1 1 1 0 0))
sds's avatar
sds committed
503
        (y (list 1 1 0 0 0)))
504 505 506
    (merge 'bit-vector x y #'< :key #'-))
  #*1111100000)

507
(deftest merge-bit-vector.9
508
  (let ((x (list 0 0 1 1 1))
sds's avatar
sds committed
509
        (y (list 0 0 0 1 1)))
510 511 512
    (merge 'bit-vector x y #'< :key nil))
  #*0000011111)

513
(deftest merge-bit-vector.10
514
  (let ((x (list 0 0 1 1 1))
sds's avatar
sds committed
515
        (y (list 0 0 0 1 1)))
516 517 518
    (merge 'bit-vector x y '<))
  #*0000011111)

519
(deftest merge-bit-vector.11
520 521 522 523
  (let ((x (copy-seq #*)) (y (copy-seq #*)))
    (merge 'bit-vector x y #'<))
  #*)

524
(deftest merge-bit-vector.12
525 526 527
  (let ((x (copy-seq #*)) (y (copy-seq #*011)))
    (merge 'bit-vector x y #'<))
  #*011)
sds's avatar
sds committed
528

529
(deftest merge-bit-vector.13
530 531 532 533
  (let ((x (copy-seq #*)) (y (list 0 1 1)))
    (merge 'bit-vector x y #'<))
  #*011)

534
(deftest merge-bit-vector.14
535 536 537 538
  (let ((x nil) (y (vector 0 1 1)))
    (merge 'bit-vector y x #'<))
  #*011)

539
(deftest merge-bit-vector.15
540 541 542 543
  (let ((x (copy-seq #*)) (y (list 0 1 1)))
    (merge 'bit-vector y x #'<))
  #*011)

544
(deftest merge-bit-vector.16
545
  (let* ((x (make-array '(10) :initial-contents #*0001101010
sds's avatar
sds committed
546 547
                        :fill-pointer 5 :element-type 'bit))
         (y (copy-seq #*001)))
548 549 550 551
    (merge 'bit-vector x y #'<))
  #*00000111)

(deftest merge-bit-vector.17
552
  (let* ((x (make-array '(10) :initial-contents #*0001101010
sds's avatar
sds committed
553 554
                        :fill-pointer 5 :element-type 'bit))
         (y (copy-seq #*001)))
555 556 557 558
    (merge 'bit-vector y x #'<))
  #*00000111)

(deftest merge-bit-vector.18
559
  (let* ((x (make-array '(10) :initial-contents #*0001101010
sds's avatar
sds committed
560
                        :fill-pointer 5 :element-type 'bit)))
561 562 563 564
    (merge 'bit-vector nil x #'<))
  #*00011)

(deftest merge-bit-vector.19
565
  (let* ((x (make-array '(10) :initial-contents #*0001101010
sds's avatar
sds committed
566
                        :fill-pointer 5 :element-type 'bit)))
567 568 569 570
    (merge 'bit-vector x nil #'<))
  #*00011)


571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587
;;; Cons (which is a recognizable subtype of list)

(deftest merge-cons.1
  (merge 'cons (list 1 2 3) (list 4 5 6) #'<)
  (1 2 3 4 5 6))

;;; Null, which is a recognizable subtype of list

(deftest merge-null.1
  (merge 'null nil nil #'<)
  nil)

;;; Vectors with length

(deftest merge-vector-length.1
  (merge '(vector * 6) (list 1 2 3) (list 4 5 6) #'<)
  #(1 2 3 4 5 6))
sds's avatar
sds committed
588

589 590 591
(deftest merge-bit-vector-length.1
  (merge '(bit-vector  6) (list 0 1 1) (list 0 0 1) #'<)
  #*000111)
592 593 594 595 596 597 598

;;; Order of evaluation

(deftest merge.order.1
  (let ((i 0) a b c d)
    (values
     (merge (progn (setf a (incf i)) 'list)
sds's avatar
sds committed
599 600 601
            (progn (setf b (incf i)) (list 2 5 6))
            (progn (setf c (incf i)) (list 1 3 4))
            (progn (setf d (incf i)) #'<))
602 603
     i a b c d))
  (1 2 3 4 5 6) 4 1 2 3 4)
sds's avatar
sds committed
604

605 606
;;; Tests of error situations

607
(deftest merge.error.1
608
  (handler-case (eval
sds's avatar
sds committed
609 610 611
                 '(locally (declare (optimize safety))
                           (merge 'symbol (list 1 2 3) (list 4 5 6) #'<)))
                (error () :caught))
612 613
  :caught)

614
(deftest merge.error.2
615
  (signals-error (merge '(vector * 3) (list 1 2 3) (list 4 5 6) #'<)
sds's avatar
sds committed
616
                 type-error)
617
  t)
618

619
(deftest merge.error.3
620
  (signals-error (merge '(bit-vector 3) (list 0 0 0) (list 1 1 1) #'<)
sds's avatar
sds committed
621
                 type-error)
622
  t)
623

624
(deftest merge.error.4
625
  (signals-error (merge '(vector * 7) (list 1 2 3) (list 4 5 6) #'<)
sds's avatar
sds committed
626
                 type-error)
627
  t)
628

629
(deftest merge.error.5
630
  (signals-error (merge '(bit-vector 7) (list 0 0 0) (list 1 1 1) #'<)
sds's avatar
sds committed
631
                 type-error)
632
  t)
633

634
(deftest merge.error.6
635
  (signals-error (merge 'null (list 1 2 3) (list 4 5 6) #'<)
sds's avatar
sds committed
636
                 type-error)
637
  t)
638

639
(deftest merge.error.7
640 641
  (signals-error (merge) program-error)
  t)
642 643

(deftest merge.error.8
644 645
  (signals-error (merge 'list) program-error)
  t)
646 647

(deftest merge.error.9
648 649
  (signals-error (merge 'list (list 2 4 6)) program-error)
  t)
650 651

(deftest merge.error.10
652
  (signals-error (merge 'list (list 2 4 6) (list 1 3 5))
sds's avatar
sds committed
653
                 program-error)
654
  t)
655 656

(deftest merge.error.11
657
  (signals-error (merge 'list (list 2 4 6) (list 1 3 5) #'< :bad t)
sds's avatar
sds committed
658
                 program-error)
659
  t)
660 661

(deftest merge.error.12
662
  (signals-error (merge 'list (list 2 4 6) (list 1 3 5) #'< :key)
sds's avatar
sds committed
663
                 program-error)
664
  t)
665 666

(deftest merge.error.13
667
  (signals-error (merge 'list (list 2 4 6) (list 1 3 5) #'< :bad t
sds's avatar
sds committed
668 669
                         :allow-other-keys nil)
                 program-error)
670
  t)
671 672

(deftest merge.error.14
673
  (signals-error (merge 'list (list 2 4 6) (list 1 3 5) #'< 1 2)
sds's avatar
sds committed
674
                 program-error)
675
  t)
676

677
(deftest merge.error.15
678
  (signals-error (locally (merge '(vector * 3) (list 1 2 3)
sds's avatar
sds committed
679 680 681 682
                                  (list 4 5 6) #'<)
                           t)
                 type-error)
  t)
683

684
(deftest merge.error.16
685
  (signals-error (merge 'list (list 1 2) (list 3 4) #'car)
sds's avatar
sds committed
686
                 program-error)
687
  t)
688

689
(deftest merge.error.17
690
  (signals-error (merge 'list (list 'a 'b) (list 3 4) #'max)
sds's avatar
sds committed
691
                 type-error)
692
  t)