char-compare.lsp 16.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Sat Oct  5 19:36:00 2002
;;;; Contains: Tests of character comparison functions

(in-package :cl-test)

;;; The character comparisons should throw a PROGRAM-ERROR when
;;; safe-called with no arguments
(deftest char-compare-no-args
  (loop for f in '(char= char/= char< char> char<= char>=
sds's avatar
sds committed
12 13 14
                   char-lessp char-greaterp char-equal
                   char-not-lessp char-not-greaterp char-not-equal)
        collect (eval `(signals-error (funcall ',f) program-error)))
15
  (t t t t t t t t t t t t))
16 17 18 19 20 21 22

(deftest char=.1
  (is-ordered-by +code-chars+ #'(lambda (c1 c2) (not (char= c1 c2))))
  t)

(deftest char=.2
  (loop for c across +code-chars+
sds's avatar
sds committed
23
        always (char= c c))
24 25 26 27 28 29 30 31
  t)

(deftest char=.3
  (every #'char= +code-chars+)
  t)

(deftest char=.4
  (is-ordered-by +rev-code-chars+
sds's avatar
sds committed
32
                 #'(lambda (c1 c2) (not (char= c1 c2))))
33 34
  t)

35 36 37 38
(deftest char=.order.1
  (let ((i 0))
    (values (not (char= (progn (incf i) #\a))) i))
  nil 1)
sds's avatar
sds committed
39

40 41 42
(deftest char=.order.2
  (let ((i 0) a b)
    (values (char= (progn (setf a (incf i)) #\a)
sds's avatar
sds committed
43 44
                   (progn (setf b (incf i)) #\b))
            i a b))
45 46 47
  nil 2 1 2)

(deftest char=.order.3
48 49 50
  (let ((i 0) a b c)
    (values
     (char= (progn (setq a (incf i)) #\a)
sds's avatar
sds committed
51 52
            (progn (setq b (incf i)) #\a)
            (progn (setq c (incf i)) #\b))
53 54 55
     i a b c))
  nil 3 1 2 3)

56 57
;;;

58 59 60 61 62 63
(deftest char/=.1
  (is-ordered-by +code-chars+ #'char/=)
  t)

(deftest char/=.2
  (loop for c across +code-chars+
sds's avatar
sds committed
64
        never (char/= c c))
65 66 67 68 69 70 71 72 73 74
  t)

(deftest char/=.3
  (every #'char/= +code-chars+)
  t)

(deftest char/=.4
  (is-ordered-by +rev-code-chars+ #'char/=)
  t)

75 76 77 78
(deftest char/=.order.1
  (let ((i 0))
    (values (not (char/= (progn (incf i) #\a))) i))
  nil 1)
sds's avatar
sds committed
79

80 81 82
(deftest char/=.order.2
  (let ((i 0) a b)
    (values (not (char/= (progn (setf a (incf i)) #\a)
sds's avatar
sds committed
83 84
                         (progn (setf b (incf i)) #\b)))
            i a b))
85 86 87
  nil 2 1 2)

(deftest char/=.order.3
88 89 90
  (let ((i 0) a b c)
    (values
     (char/= (progn (setq a (incf i)) #\a)
sds's avatar
sds committed
91 92
             (progn (setq b (incf i)) #\b)
             (progn (setq c (incf i)) #\b))
93 94 95
     i a b c))
  nil 3 1 2 3)

96
;;;
sds's avatar
sds committed
97

98 99
(deftest char<=.1
  (loop for c across +code-chars+
sds's avatar
sds committed
100
        always (char<= c c))
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
  t)

(deftest char<=.2
  (every #'char<= +code-chars+)
  t)

(deftest char<=.3
  (is-antisymmetrically-ordered-by +code-chars+ #'char<=)
  t)

(deftest char<=.4
  (is-antisymmetrically-ordered-by +lower-case-chars+ #'char<=)
  t)

(deftest char<=.5
  (is-antisymmetrically-ordered-by +upper-case-chars+ #'char<=)
  t)

(deftest char<=.6
  (is-antisymmetrically-ordered-by +digit-chars+ #'char<=)
  t)

(deftest char<=.7
124
  (notnot-mv (or (char<= #\9 #\A) (char<= #\Z #\0)))
125
  t)
sds's avatar
sds committed
126

127
(deftest char<=.8
128
  (notnot-mv (or (char<= #\9 #\a) (char<= #\z #\0)))
129 130
  t)

131 132 133 134
(deftest char<=.order.1
  (let ((i 0))
    (values (not (char<= (progn (incf i) #\a))) i))
  nil 1)
sds's avatar
sds committed
135

136 137 138
(deftest char<=.order.2
  (let ((i 0) a b)
    (values (not (char<= (progn (setf a (incf i)) #\a)
sds's avatar
sds committed
139 140
                         (progn (setf b (incf i)) #\b)))
            i a b))
141 142 143
  nil 2 1 2)

(deftest char<=.order.3
144 145 146
  (let ((i 0) a b c)
    (values
     (char<= (progn (setq a (incf i)) #\a)
sds's avatar
sds committed
147 148
             (progn (setq b (incf i)) #\b)
             (progn (setq c (incf i)) #\a))
149 150 151
     i a b c))
  nil 3 1 2 3)

152 153
;;;

154 155
(deftest char<.1
  (loop for c across +code-chars+
sds's avatar
sds committed
156
        never (char< c c))
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
  t)

(deftest char<.2
  (every #'char< +code-chars+)
  t)

(deftest char<.3
  (is-antisymmetrically-ordered-by +code-chars+ #'char<)
  t)

(deftest char<.4
  (is-antisymmetrically-ordered-by +lower-case-chars+ #'char<)
  t)

(deftest char<.5
  (is-antisymmetrically-ordered-by +upper-case-chars+ #'char<)
  t)

(deftest char<.6
  (is-antisymmetrically-ordered-by +digit-chars+ #'char<)
  t)

(deftest char<.7
180
  (notnot-mv (or (char< #\9 #\A) (char< #\Z #\0)))
181
  t)
sds's avatar
sds committed
182

183
(deftest char<.8
184
  (notnot-mv (or (char< #\9 #\a) (char< #\z #\0)))
185
  t)
sds's avatar
sds committed
186

187 188 189 190
(deftest char<.order.1
  (let ((i 0))
    (values (not (char< (progn (incf i) #\a))) i))
  nil 1)
sds's avatar
sds committed
191

192 193 194
(deftest char<.order.2
  (let ((i 0) a b)
    (values (not (char< (progn (setf a (incf i)) #\a)
sds's avatar
sds committed
195 196
                        (progn (setf b (incf i)) #\b)))
            i a b))
197 198 199
  nil 2 1 2)

(deftest char<.order.3
200 201 202
  (let ((i 0) a b c)
    (values
     (char< (progn (setq a (incf i)) #\a)
sds's avatar
sds committed
203 204
            (progn (setq b (incf i)) #\b)
            (progn (setq c (incf i)) #\a))
205 206
     i a b c))
  nil 3 1 2 3)
207

208 209 210 211
(deftest char<.order.4
  (let ((i 0) a b c)
    (values
     (char< (progn (setq a (incf i)) #\b)
sds's avatar
sds committed
212 213
            (progn (setq b (incf i)) #\a)
            (progn (setq c (incf i)) #\b))
214 215 216 217 218
     i a b c))
  nil 3 1 2 3)

;;;

219 220
(deftest char>=.1
  (loop for c across +code-chars+
sds's avatar
sds committed
221
        always (char>= c c))
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
  t)

(deftest char>=.2
  (every #'char>= +code-chars+)
  t)

(deftest char>=.3
  (is-antisymmetrically-ordered-by +rev-code-chars+ #'char>=)
  t)

(deftest char>=.4
  (is-antisymmetrically-ordered-by (reverse +lower-case-chars+) #'char>=)
  t)

(deftest char>=.5
  (is-antisymmetrically-ordered-by (reverse +upper-case-chars+) #'char>=)
  t)

(deftest char>=.6
  (is-antisymmetrically-ordered-by (reverse +digit-chars+) #'char>=)
  t)

(deftest char>=.7
245
  (notnot-mv (or (char>= #\A #\9) (char>= #\0 #\Z)))
246
  t)
sds's avatar
sds committed
247

248
(deftest char>=.8
249
  (notnot-mv (or (char>= #\a #\9) (char>= #\0 #\z)))
250 251
  t)

252 253 254 255
(deftest char>=.order.1
  (let ((i 0))
    (values (not (char>= (progn (incf i) #\a))) i))
  nil 1)
sds's avatar
sds committed
256

257 258 259
(deftest char>=.order.2
  (let ((i 0) a b)
    (values (not (char>= (progn (setf a (incf i)) #\b)
sds's avatar
sds committed
260 261
                         (progn (setf b (incf i)) #\a)))
            i a b))
262 263 264
  nil 2 1 2)

(deftest char>=.order.3
265 266 267
  (let ((i 0) a b c)
    (values
     (char>= (progn (setq a (incf i)) #\b)
sds's avatar
sds committed
268 269
             (progn (setq b (incf i)) #\a)
             (progn (setq c (incf i)) #\b))
270 271 272
     i a b c))
  nil 3 1 2 3)

273 274 275 276
(deftest char>=.order.4
  (let ((i 0) a b c)
    (values
     (char>= (progn (setq a (incf i)) #\a)
sds's avatar
sds committed
277 278
             (progn (setq b (incf i)) #\b)
             (progn (setq c (incf i)) #\a))
279 280 281 282 283
     i a b c))
  nil 3 1 2 3)

;;;

284 285
(deftest char>.1
  (loop for c across +code-chars+
sds's avatar
sds committed
286
        never (char> c c))
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309
  t)

(deftest char>.2
  (every #'char> +code-chars+)
  t)

(deftest char>.3
  (is-antisymmetrically-ordered-by +rev-code-chars+ #'char>)
  t)

(deftest char>.4
  (is-antisymmetrically-ordered-by (reverse +lower-case-chars+) #'char>)
  t)

(deftest char>.5
  (is-antisymmetrically-ordered-by (reverse +upper-case-chars+) #'char>)
  t)

(deftest char>.6
  (is-antisymmetrically-ordered-by (reverse +digit-chars+) #'char>)
  t)

(deftest char>.7
310
  (notnot-mv (or (char> #\A #\9) (char> #\0 #\Z)))
311
  t)
sds's avatar
sds committed
312

313
(deftest char>.8
314
  (notnot-mv (or (char> #\a #\9) (char> #\0 #\z)))
315 316
  t)

317 318 319 320
(deftest char>.order.1
  (let ((i 0))
    (values (not (char> (progn (incf i) #\a))) i))
  nil 1)
sds's avatar
sds committed
321

322 323 324
(deftest char>.order.2
  (let ((i 0) a b)
    (values (not (char> (progn (setf a (incf i)) #\b)
sds's avatar
sds committed
325 326
                        (progn (setf b (incf i)) #\a)))
            i a b))
327 328 329
  nil 2 1 2)

(deftest char>.order.3
330 331 332
  (let ((i 0) a b c)
    (values
     (char> (progn (setq a (incf i)) #\b)
sds's avatar
sds committed
333 334
            (progn (setq b (incf i)) #\a)
            (progn (setq c (incf i)) #\b))
335 336 337
     i a b c))
  nil 3 1 2 3)

338 339 340 341
(deftest char>.order.4
  (let ((i 0) a b c)
    (values
     (char> (progn (setq a (incf i)) #\a)
sds's avatar
sds committed
342 343
            (progn (setq b (incf i)) #\b)
            (progn (setq c (incf i)) #\a))
344 345 346
     i a b c))
  nil 3 1 2 3)

347 348 349 350
;;; Case-insensitive comparisons

(deftest char-equal.1
  (is-ordered-by +code-chars+
sds's avatar
sds committed
351 352 353 354
                #'(lambda (c1 c2)
                    (or (char= (char-downcase c1)
                               (char-downcase c2))
                        (not (char-equal c1 c2)))))
355 356 357 358
  t)

(deftest char-equal.2
  (loop for c across +code-chars+
sds's avatar
sds committed
359
        always (char-equal c c))
360 361 362 363
  t)

(deftest char-equal.3
  (loop for c across +code-chars+
sds's avatar
sds committed
364
        always (char-equal c))
365 366 367 368
  t)

(deftest char-equal.4
  (is-ordered-by +rev-code-chars+
sds's avatar
sds committed
369 370 371 372
                 #'(lambda (c1 c2)
                     (or (char= (char-downcase c1)
                                (char-downcase c2))
                         (not (char-equal c1 c2)))))
373 374
  t)

375 376 377 378
(deftest char-equal.order.1
  (let ((i 0))
    (values (not (char-equal (progn (incf i) #\a))) i))
  nil 1)
sds's avatar
sds committed
379

380 381 382
(deftest char-equal.order.2
  (let ((i 0) a b)
    (values (char-equal (progn (setf a (incf i)) #\b)
sds's avatar
sds committed
383 384
                        (progn (setf b (incf i)) #\a))
            i a b))
385 386 387
  nil 2 1 2)

(deftest char-equal.order.3
388 389 390
  (let ((i 0) a b c)
    (values
     (char-equal (progn (setq a (incf i)) #\a)
sds's avatar
sds committed
391 392
                 (progn (setq b (incf i)) #\a)
                 (progn (setq c (incf i)) #\b))
393 394 395
     i a b c))
  nil 3 1 2 3)

396 397 398 399
(deftest char-equal.order.4
  (let ((i 0) a b c)
    (values
     (char-equal (progn (setq a (incf i)) #\a)
sds's avatar
sds committed
400 401
                 (progn (setq b (incf i)) #\b)
                 (progn (setq c (incf i)) #\a))
402 403 404 405 406
     i a b c))
  nil 3 1 2 3)

;;;

407 408
(deftest char-not-equal.1
  (is-ordered-by +code-chars+ #'(lambda (c1 c2)
sds's avatar
sds committed
409 410 411
                                  (or (char= (char-downcase c1)
                                             (char-downcase c2))
                                      (char-not-equal c1 c2))))
412 413 414 415
  t)

(deftest char-not-equal.2
  (loop for c across +code-chars+
sds's avatar
sds committed
416
        never (char-not-equal c c))
417 418 419 420 421 422 423 424
  t)

(deftest char-not-equal.3
  (every #'char-not-equal +code-chars+)
  t)

(deftest char-not-equal.4
  (is-ordered-by +rev-code-chars+ #'(lambda (c1 c2)
sds's avatar
sds committed
425 426 427
                                      (or (char= (char-downcase c1)
                                                 (char-downcase c2))
                                          (char-not-equal c1 c2))))
428 429
  t)

430 431 432 433
(deftest char-not-equal.order.1
  (let ((i 0))
    (values (not (char-not-equal (progn (incf i) #\a))) i))
  nil 1)
sds's avatar
sds committed
434

435 436 437
(deftest char-not-equal.order.2
  (let ((i 0) a b)
    (values (not (char-not-equal (progn (setf a (incf i)) #\b)
sds's avatar
sds committed
438 439
                                 (progn (setf b (incf i)) #\a)))
            i a b))
440 441 442
  nil 2 1 2)

(deftest char-not-equal.order.3
443 444 445
  (let ((i 0) a b c)
    (values
     (char-not-equal (progn (setq a (incf i)) #\a)
sds's avatar
sds committed
446 447
                     (progn (setq b (incf i)) #\b)
                     (progn (setq c (incf i)) #\b))
448 449 450
     i a b c))
  nil 3 1 2 3)

451 452 453 454
(deftest char-not-equal.order.4
  (let ((i 0) a b c)
    (values
     (char-not-equal (progn (setq a (incf i)) #\a)
sds's avatar
sds committed
455 456
                     (progn (setq b (incf i)) #\a)
                     (progn (setq c (incf i)) #\b))
457 458 459 460 461
     i a b c))
  nil 3 1 2 3)

;;;

462 463
(deftest char-not-greaterp.1
  (loop for c across +code-chars+
sds's avatar
sds committed
464
        always (char-not-greaterp c c))
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487
  t)

(deftest char-not-greaterp.2
  (every #'char-not-greaterp +code-chars+)
  t)

(deftest char-not-greaterp.3
  (is-case-insensitive #'char-not-greaterp)
  t)

(deftest char-not-greaterp.4
  (is-antisymmetrically-ordered-by +lower-case-chars+ #'char-not-greaterp)
  t)

(deftest char-not-greaterp.5
  (is-antisymmetrically-ordered-by +upper-case-chars+ #'char-not-greaterp)
  t)

(deftest char-not-greaterp.6
  (is-antisymmetrically-ordered-by +digit-chars+ #'char-not-greaterp)
  t)

(deftest char-not-greaterp.7
488
  (notnot-mv (or (char-not-greaterp #\9 #\A) (char-not-greaterp #\Z #\0)))
489
  t)
sds's avatar
sds committed
490

491
(deftest char-not-greaterp.8
492
  (notnot-mv (or (char-not-greaterp #\9 #\a) (char-not-greaterp #\z #\0)))
493 494
  t)

495 496 497 498
(deftest char-not-greaterp.order.1
  (let ((i 0))
    (values (not (char-not-greaterp (progn (incf i) #\a))) i))
  nil 1)
sds's avatar
sds committed
499

500 501 502
(deftest char-not-greaterp.order.2
  (let ((i 0) a b)
    (values (not (char-not-greaterp (progn (setf a (incf i)) #\a)
sds's avatar
sds committed
503 504
                                    (progn (setf b (incf i)) #\b)))
            i a b))
505 506 507
  nil 2 1 2)

(deftest char-not-greaterp.order.3
508 509 510
  (let ((i 0) a b c)
    (values
     (char-not-greaterp (progn (setq a (incf i)) #\a)
sds's avatar
sds committed
511 512
                        (progn (setq b (incf i)) #\b)
                        (progn (setq c (incf i)) #\a))
513 514 515
     i a b c))
  nil 3 1 2 3)

516 517 518 519
(deftest char-not-greaterp.order.4
  (let ((i 0) a b c)
    (values
     (char-not-greaterp (progn (setq a (incf i)) #\b)
sds's avatar
sds committed
520 521
                        (progn (setq b (incf i)) #\a)
                        (progn (setq c (incf i)) #\a))
522 523 524 525 526
     i a b c))
  nil 3 1 2 3)

;;;

527 528
(deftest char-lessp.1
  (loop for c across +code-chars+
sds's avatar
sds committed
529
        never (char-lessp c c))
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552
  t)

(deftest char-lessp.2
  (every #'char-lessp +code-chars+)
  t)

(deftest char-lessp.3
  (is-case-insensitive #'char-lessp)
  t)

(deftest char-lessp.4
  (is-antisymmetrically-ordered-by +lower-case-chars+ #'char-lessp)
  t)

(deftest char-lessp.5
  (is-antisymmetrically-ordered-by +upper-case-chars+ #'char-lessp)
  t)

(deftest char-lessp.6
  (is-antisymmetrically-ordered-by +digit-chars+ #'char-lessp)
  t)

(deftest char-lessp.7
553
  (notnot-mv (or (char-lessp #\9 #\A) (char-lessp #\Z #\0)))
554
  t)
sds's avatar
sds committed
555

556
(deftest char-lessp.8
557
  (notnot-mv (or (char-lessp #\9 #\a) (char-lessp #\z #\0)))
558 559
  t)

560 561 562 563
(deftest char-lessp.order.1
  (let ((i 0))
    (values (not (char-lessp (progn (incf i) #\a))) i))
  nil 1)
sds's avatar
sds committed
564

565 566 567
(deftest char-lessp.order.2
  (let ((i 0) a b)
    (values (not (char-lessp (progn (setf a (incf i)) #\a)
sds's avatar
sds committed
568 569
                             (progn (setf b (incf i)) #\b)))
            i a b))
570 571 572
  nil 2 1 2)

(deftest char-lessp.order.3
573 574 575
  (let ((i 0) a b c)
    (values
     (char-lessp (progn (setq a (incf i)) #\a)
sds's avatar
sds committed
576 577
                 (progn (setq b (incf i)) #\b)
                 (progn (setq c (incf i)) #\a))
578 579 580
     i a b c))
  nil 3 1 2 3)

581 582 583 584
(deftest char-lessp.order.4
  (let ((i 0) a b c)
    (values
     (char-lessp (progn (setq a (incf i)) #\b)
sds's avatar
sds committed
585 586
                 (progn (setq b (incf i)) #\a)
                 (progn (setq c (incf i)) #\a))
587 588 589 590 591
     i a b c))
  nil 3 1 2 3)

;;;

592 593
(deftest char-not-lessp.1
  (loop for c across +code-chars+
sds's avatar
sds committed
594
        always (char-not-lessp c c))
595 596 597 598 599 600 601 602 603 604 605 606
  t)

(deftest char-not-lessp.2
  (every #'char-not-lessp +code-chars+)
  t)

(deftest char-not-lessp.3
  (is-case-insensitive #'char-not-lessp)
  t)

(deftest char-not-lessp.4
  (is-antisymmetrically-ordered-by (reverse +lower-case-chars+)
sds's avatar
sds committed
607
                                   #'char-not-lessp)
608 609 610 611 612 613 614 615 616 617 618
  t)

(deftest char-not-lessp.5
  (is-antisymmetrically-ordered-by (reverse +upper-case-chars+) #'char-not-lessp)
  t)

(deftest char-not-lessp.6
  (is-antisymmetrically-ordered-by (reverse +digit-chars+) #'char-not-lessp)
  t)

(deftest char-not-lessp.7
619
  (notnot-mv (or (char-not-lessp #\A #\9) (char-not-lessp #\0 #\Z)))
620
  t)
sds's avatar
sds committed
621

622
(deftest char-not-lessp.8
623
  (notnot-mv (or (char-not-lessp #\a #\9) (char-not-lessp #\0 #\z)))
624 625
  t)

626 627 628 629
(deftest char-not-lessp.order.1
  (let ((i 0))
    (values (not (char-not-lessp (progn (incf i) #\a))) i))
  nil 1)
sds's avatar
sds committed
630

631 632 633
(deftest char-not-lessp.order.2
  (let ((i 0) a b)
    (values (not (char-not-lessp (progn (setf a (incf i)) #\b)
sds's avatar
sds committed
634 635
                                 (progn (setf b (incf i)) #\a)))
            i a b))
636 637 638
  nil 2 1 2)

(deftest char-not-lessp.order.3
639 640 641
  (let ((i 0) a b c)
    (values
     (char-not-lessp (progn (setq a (incf i)) #\b)
sds's avatar
sds committed
642 643
                     (progn (setq b (incf i)) #\a)
                     (progn (setq c (incf i)) #\b))
644 645 646
     i a b c))
  nil 3 1 2 3)

647 648 649 650
(deftest char-not-lessp.order.4
  (let ((i 0) a b c)
    (values
     (char-not-lessp (progn (setq a (incf i)) #\a)
sds's avatar
sds committed
651 652
                     (progn (setq b (incf i)) #\b)
                     (progn (setq c (incf i)) #\b))
653 654 655 656 657
     i a b c))
  nil 3 1 2 3)

;;;

658 659
(deftest char-greaterp.1
  (loop for c across +code-chars+
sds's avatar
sds committed
660
        never (char-greaterp c c))
661 662 663 664 665 666 667 668 669 670 671 672
  t)

(deftest char-greaterp.2
  (every #'char-greaterp +code-chars+)
  t)

(deftest char-greaterp.3
  (is-case-insensitive #'char-greaterp)
  t)

(deftest char-greaterp.4
  (is-antisymmetrically-ordered-by (reverse +lower-case-chars+)
sds's avatar
sds committed
673
                                   #'char-greaterp)
674 675 676 677 678 679 680 681 682 683 684
  t)

(deftest char-greaterp.5
  (is-antisymmetrically-ordered-by (reverse +upper-case-chars+) #'char-greaterp)
  t)

(deftest char-greaterp.6
  (is-antisymmetrically-ordered-by (reverse +digit-chars+) #'char-greaterp)
  t)

(deftest char-greaterp.7
685
  (notnot-mv (or (char-greaterp #\A #\9) (char-greaterp #\0 #\Z)))
686
  t)
sds's avatar
sds committed
687

688
(deftest char-greaterp.8
689
  (notnot-mv (or (char-greaterp #\a #\9) (char-greaterp #\0 #\z)))
690
  t)
691

692 693 694 695
(deftest char-greaterp.order.1
  (let ((i 0))
    (values (not (char-greaterp (progn (incf i) #\a))) i))
  nil 1)
sds's avatar
sds committed
696

697 698 699
(deftest char-greaterp.order.2
  (let ((i 0) a b)
    (values (not (char-greaterp (progn (setf a (incf i)) #\b)
sds's avatar
sds committed
700 701
                                (progn (setf b (incf i)) #\a)))
            i a b))
702 703 704
  nil 2 1 2)

(deftest char-greaterp.order.3
705 706 707
  (let ((i 0) a b c)
    (values
     (char-greaterp (progn (setq a (incf i)) #\b)
sds's avatar
sds committed
708 709
                    (progn (setq b (incf i)) #\a)
                    (progn (setq c (incf i)) #\b))
710 711
     i a b c))
  nil 3 1 2 3)
712 713 714 715 716

(deftest char-greaterp.order.4
  (let ((i 0) a b c)
    (values
     (char-greaterp (progn (setq a (incf i)) #\a)
sds's avatar
sds committed
717 718
                    (progn (setq b (incf i)) #\b)
                    (progn (setq c (incf i)) #\a))
719 720
     i a b c))
  nil 3 1 2 3)