File: equal.zuo

package info (click to toggle)
zuo 1.12-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,352 kB
  • sloc: ansic: 6,374; makefile: 39
file content (53 lines) | stat: -rw-r--r-- 1,471 bytes parent folder | download | duplicates (6)
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
52
53
#lang zuo

(require "harness.zuo")

;; We need certain things to work for checking even to work, but all
;; we can do is assume that things work...

(alert "equal") 

(check #t)
(check (not #f))
(check (eq? 'apple 'apple))
(check (not (eq? 'apple 'banana)))
(check (not (eq? 'apple "apple")))

(check (string=? "apple" "apple"))
(check (not (string=? "apple" "banana")))
(check (string-ci=? "apple" "aPPle"))
(check (not (string-ci=? "apple" "banana")))

(check (= 1 1))
(check (not (= 1 -1)))

(check (equal? 1 1))
(check (equal? "apple" "apple"))

(check (equal? "apple" "apple"))
(check (equal? '("apple") '("apple")))
(check (equal? '(0 "apple") '(0 "apple")))
(check (not (equal? '("apple") '("banana"))))
(check (not (equal? '(0 "apple") '(0 "banana"))))

(check (equal? (hash 'a 1) (hash 'a 1)))
(check (not (equal? (hash 'a 1) (hash 'b 1))))
(check (not (equal? (hash 'a 1) (hash 'a 2))))

(check (not (equal? "apple" 'other)))
(check (not (equal? 'other "apple")))
(check (not (equal? 1 'other)))
(check (not (equal? 'other 1)))
(check (not (equal? 1 (hash 'a 1))))
(check (not (equal? (hash 'a 1) 1)))

(check-fail (= 1 'apple) not-integer)
(check-fail (= 'apple 1) not-integer)
(check-arg-fail (string=? 1 "apple") not-string)
(check-arg-fail (string=? "apple" 1) not-string)
(check-arg-fail (string-ci=? 1 "apple") not-string)
(check-arg-fail (string-ci=? "apple" 1) not-string)

(check (eq? (void) (void)))
(check (void? (void)))
(check (not (void? 'void)))