subtypep-real.lsp 5.47 KB
Newer Older
1 2 3 4 5 6 7
;-*- Mode:     Lisp -*-
;;;; Author:   Paul Dietz
;;;; Created:  Tue Feb 18 18:38:55 2003
;;;; Contains: Tests of SUBTYPEP on REAL types.

(in-package :cl-test)

8 9
(compile-and-load "types-aux.lsp")

10 11 12 13
;;; SUBTYPEP on real types

(deftest subtypep.real.1
  (loop for tp1 in '((real 10) (real 10 *)
sds's avatar
sds committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
                     (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)))
31 32 33 34
  nil)

(deftest subtypep.real.2
  (loop for tp1 in '((real * 10)
sds's avatar
sds committed
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
                     (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)))
51 52 53 54
  nil)

(deftest subtypep.real.3
  (loop for tp1 in '((real 10) (real 10 *)
sds's avatar
sds committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
                     (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)))
74 75 76 77
  nil)

(deftest subtypep.real.4
  (loop for tp1 in '((real * 10)
sds's avatar
sds committed
78 79 80 81 82 83 84 85 86 87 88 89 90
                     (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)))
91 92 93 94
  nil)

(deftest subtypep.real.5
  (check-equivalence
95
   '(or (real 0 0) (real (0)))
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
   '(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
137
   '(and integer (real 0 10) (not (real (0) (10))))
138 139 140 141 142
   '(member 0 10))
  nil)

(deftest subtypep.real.13
  (check-equivalence '(and integer (real -1/2 1/2))
sds's avatar
sds committed
143
                     '(integer 0 0))
144 145 146 147
  nil)

(deftest subtypep.real.14
  (check-equivalence '(and integer (real -1/2 1/2))
sds's avatar
sds committed
148
                     '(eql 0))
149 150 151 152
  nil)

(deftest subtypep.real.15
  (check-equivalence '(and integer (real (-1/2) 1/2))
sds's avatar
sds committed
153
                     '(integer 0 0))
154 155 156 157
  nil)

(deftest subtypep.real.16
  (check-equivalence '(and integer (real (-1/2) (1/2)))
sds's avatar
sds committed
158
                     '(integer 0 0))
159 160 161 162 163 164 165 166
  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))
sds's avatar
sds committed
167
                     '(rational 0 10))
168 169 170 171
  nil)

(deftest subtypep.real.19
  (check-equivalence '(and rational (real 0 (10)))
sds's avatar
sds committed
172
                     '(rational 0 (10)))
173 174 175 176
  nil)

(deftest subtypep.real.20
  (check-equivalence '(and rational (real (0) (10)))
sds's avatar
sds committed
177
                     '(rational (0) (10)))
178 179 180 181
  nil)

(deftest subtypep.real.21
  (check-equivalence '(and rational (real 1/2 7/3))
sds's avatar
sds committed
182
                     '(rational 1/2 7/3))
183 184 185 186
  nil)

(deftest subtypep.real.22
  (check-equivalence '(and rational (real (1/11) (8/37)))
sds's avatar
sds committed
187
                     '(rational (1/11) (8/37)))
188 189
  nil)

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

194 195 196
(deftest subtypep.real.24
  (check-all-subtypep '(not (real -1/2 1/2)) '(not (eql 0)))
  nil)
197 198 199 200 201

(deftest subtypep.real.25
  (check-all-subtypep t '(or (not (real 0 10)) (not (real -100 -50))))
  nil)