~tim/scheme-vm

ref: 11e2819bb80b0c33f7be66e7f29ec0d28788ef4c scheme-vm/spec/lib/char-spec.scm -rw-r--r-- 1.2 KiB View raw
11e2819bTim Morgan Add case insensitive char comparision functions 2 years ago
                                                                                
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
(import (scheme base)
        (assert))

(assert (= 48 (char->integer #\0)))

(assert (= #\0 (integer->char 48)))
(assert (not (= #\1 (integer->char 48))))

(assert (eq? #\a (char-downcase #\A)))
(assert (eq? #\a (char-downcase #\a)))

(assert (eq? #\A (char-upcase #\a)))
(assert (eq? #\A (char-upcase #\A)))

(assert (char=? #\a #\a))
(assert (not (char=? #\a #\b)))

(assert (char-ci=? #\a #\A))
(assert (not (char-ci=? #\a #\b)))

(assert (char<? #\a #\b))
(assert (not (char<? #\a #\a)))
(assert (not (char<? #\b #\a)))

(assert (char-ci<? #\a #\B))
(assert (not (char-ci<? #\a #\A)))
(assert (not (char-ci<? #\b #\A)))

(assert (char<=? #\a #\b))
(assert (char<=? #\a #\a))
(assert (not (char<=? #\b #\a)))

(assert (char-ci<=? #\a #\B))
(assert (char-ci<=? #\a #\A))
(assert (not (char-ci<=? #\b #\A)))

(assert (char>? #\b #\a))
(assert (not (char>? #\b #\b)))
(assert (not (char>? #\a #\b)))

(assert (char-ci>? #\b #\A))
(assert (not (char-ci>? #\b #\B)))
(assert (not (char-ci>? #\a #\B)))

(assert (char>=? #\b #\a))
(assert (char>=? #\b #\b))
(assert (not (char>=? #\a #\b)))

(assert (char-ci>=? #\b #\A))
(assert (char-ci>=? #\b #\B))
(assert (not (char-ci>=? #\a #\B)))