X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Ftype.impure.lisp;h=31b42e9cc047dd0d405183d338150321bf978466;hb=cb7837b769ce190baec60a2159c33099816ea6e3;hp=2e52965b419d3e3e10d3095ac57b6cdae5a85690;hpb=854b904d18932d85fa3255a22e4872a7de97092a;p=sbcl.git diff --git a/tests/type.impure.lisp b/tests/type.impure.lisp index 2e52965..31b42e9 100644 --- a/tests/type.impure.lisp +++ b/tests/type.impure.lisp @@ -13,7 +13,13 @@ integer fixnum (integer 0 10) single-float (single-float -1.0 1.0) (single-float 0.1) (real 4 8) (real -1 7) (real 2 11) - (member #\a #\b #\c) (member 1 #\a) (member 3.0 3.3)))) + (member #\a #\b #\c) (member 1 #\a) (member 3.0 3.3) + ;; FIXME: When bug 91 is fixed, add these to the list: + ;; (INTEGER -1 1) + ;; UNSIGNED-BYTE + ;; (RATIONAL -1 7) (RATIONAL -2 4) + ;; RATIO + ))) (dolist (i types) (format t "type I=~S~%" i) (dolist (j types) @@ -25,13 +31,10 @@ (dolist (k types) (format t " type K=~S~%" k) (assert (subtypep `(or ,i ,j) `(or ,i ,j ,k))) - ;; FIXME: The old code (including original CMU CL code) - ;; fails this test. When this is fixed, we can re-enable it. - #+nil (assert (subtypep `(or ,i ,j) `(or ,k ,j ,i))))))) + (assert (subtypep `(or ,i ,j) `(or ,k ,j ,i))))))) ;;; gotchas that can come up in handling subtypeness as "X is a ;;; subtype of Y if each of the elements of X is a subtype of Y" -#+nil ; FIXME: suppressed until we can fix old CMU CL big (let ((subtypep-values (multiple-value-list (subtypep '(single-float -1.0 1.0) '(or (real -100.0 0.0) @@ -43,7 +46,8 @@ ;; But if it does, that'd be neat. (t t) ;; (And any other return would be wrong.) - )))) + ) + :test #'equal))) (defun type-evidently-= (x y) (and (subtypep x y) @@ -76,5 +80,22 @@ (assert-nil-nil (subtypep '(vector utype-1) '(vector t))) (assert-nil-nil (subtypep '(vector t) '(vector utype-2))) +;;; ANSI specifically disallows bare AND and OR symbols as type specs. +#| ; Alas, this is part of bug 10, still unfixed as of sbcl-0.6.11.10. +(assert (raises-error? (typep 11 'and))) +(assert (raises-error? (typep 11 'or))) +|# +;;; Of course empty lists of subtypes are still OK. +(assert (typep 11 '(and))) +(assert (not (typep 11 '(or)))) + +;;; bug 12: type system didn't grok nontrivial intersections +(assert (subtypep '(and symbol (satisfies keywordp)) 'symbol)) +(assert (not (subtypep '(and symbol (satisfies keywordp)) 'null))) +(assert (subtypep 'keyword 'symbol)) +(assert (not (subtypep 'symbol 'keyword))) +(assert (subtypep 'ratio 'real)) +(assert (subtypep 'ratio 'number)) + ;;; success (quit :unix-status 104)