subtypep-real.lsp 4.2 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Tue Feb 18 18:38:55 2003
;;;; Contains: Tests of SUBTYPEP on REAL types.

(in-package :cl-test)

;;; SUBTYPEP on real types

(deftest subtypep.real.1
  (loop for tp1 in '((real 10) (real 10 *)
		     (real 10 20)
		     (real (10) 20)
		     (real 10 (20))
		     (real (10) (20))
		     (real 10 1000000000000000)
		     (real (10)) (real (10) *))
	append
	(loop for tp2 in '(real (real) (real *)
			   (real * *) (real 10) (real 10 *)
			   (real 0) (real 0 *)
			   (real 19/2) (real 19/2 *)
			   (real 9.5) (real 9.5 *)
			   (real -1000000000000000))
	      unless (equal (multiple-value-list
			     (subtypep* tp1 tp2))
			    '(t t))
	      collect (list tp1 tp2)))
  nil)

(deftest subtypep.real.2
  (loop for tp1 in '((real * 10)
		     (real 0 10)
		     (real 0 (10))
		     (real (0) 10)
		     (real (0) (10))
		     (real -1000000000000000 10)
		     (real * (10)))
	append
	(loop for tp2 in '(real (real) (real *)
			   (real * *) (real * 10)
			   (real * 21/2)
			   (real * 10.5)
			   (real * 1000000000000000))
	      unless (equal (multiple-value-list
			     (subtypep* tp1 tp2))
			    '(t t))
	      collect (list tp1 tp2)))
  nil)

(deftest subtypep.real.3
  (loop for tp1 in '((real 10) (real 10 *)
		     (real 10 20)
		     (real 10 (21))
		     (real 10 1000000000000000))
	append
	(loop for tp2 in '((real 11) (real 11 *)
			   (real (10)) (real (10) *)
			   (integer 10) (integer 10 *)
			   (real 11)
			   (real (10))
			   (real 11 *)
			   (real (10) *)
			   (real * (20))
			   (real * 19)
			   (real * (20))
			   (real * 19))
	      unless (equal (multiple-value-list
			     (subtypep* tp1 tp2))
			    '(nil t))
	      collect (list tp1 tp2)))
  nil)

(deftest subtypep.real.4
  (loop for tp1 in '((real * 10)
		     (real 0 10)
		     (real (0) 10)
		     (real -1000000000000000 10))
	append
	(loop for tp2 in '((real * 9)
			   (real * (10))
			   (integer * 10)
			   (real * 9)
			   (real * (10)))
	      unless (equal (multiple-value-list
			     (subtypep* tp1 tp2))
			    '(nil t))
	      collect (list tp1 tp2)))
  nil)

(deftest subtypep.real.5
  (check-equivalence
   '(or (eql 0) (real (0)))
   '(real 0))
  nil)

(deftest subtypep.real.6
  (check-equivalence
   '(and (real 0 10) (real 5 15))
   '(real 5 10))
  nil)

(deftest subtypep.real.7
  (check-equivalence
   '(and (real (0) 10) (real 5 15))
   '(real 5 10))
  nil)

(deftest subtypep.real.8
  (check-equivalence
   '(and (real 0 (10)) (real 5 15))
   '(real 5 (10)))
  nil)

(deftest subtypep.real.9
  (check-equivalence
   '(and (real (0) (10)) (real 5 15))
   '(real 5 (10)))
  nil)

(deftest subtypep.real.10
  (check-equivalence
   '(and (real 0 10) (real (5) 15))
   '(real (5) 10))
  nil)

(deftest subtypep.real.11
  (check-equivalence
   '(and (real 0 (10)) (real (5) 15))
   '(real (5) (10)))
  nil)

(deftest subtypep.real.12
  (check-equivalence
   '(and (real 0 10) (not (real (0) (10))))
   '(member 0 10))
  nil)

(deftest subtypep.real.13
  (check-equivalence '(and integer (real -1/2 1/2))
		     '(integer 0 0))
  nil)

(deftest subtypep.real.14
  (check-equivalence '(and integer (real -1/2 1/2))
		     '(eql 0))
  nil)

(deftest subtypep.real.15
  (check-equivalence '(and integer (real (-1/2) 1/2))
		     '(integer 0 0))
  nil)

(deftest subtypep.real.16
  (check-equivalence '(and integer (real (-1/2) (1/2)))
		     '(integer 0 0))
  nil)

(deftest subtypep.real.17
  (check-equivalence '(real 0 10) '(real 0.0 10.0))
  nil)

(deftest subtypep.real.18
  (check-equivalence '(and rational (real 0 10))
		     '(rational 0 10))
  nil)

(deftest subtypep.real.19
  (check-equivalence '(and rational (real 0 (10)))
		     '(rational 0 (10)))
  nil)

(deftest subtypep.real.20
  (check-equivalence '(and rational (real (0) (10)))
		     '(rational (0) (10)))
  nil)

(deftest subtypep.real.21
  (check-equivalence '(and rational (real 1/2 7/3))
		     '(rational 1/2 7/3))
  nil)

(deftest subtypep.real.22
  (check-equivalence '(and rational (real (1/11) (8/37)))
		     '(rational (1/11) (8/37)))
  nil)

188
189
190
(deftest subtypep.real.23
  (check-all-subtypep '(not (real -1/2 1/2)) '(not (integer 0 0)))
  nil)
191

192
193
194
(deftest subtypep.real.24
  (check-all-subtypep '(not (real -1/2 1/2)) '(not (eql 0)))
  nil)