X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Farith.impure.lisp;h=27948bd93f02e19e061df4fc684e062b4017e5ad;hb=1b650be8b800cf96e2c268ae317fb26d0bf36827;hp=6604a9fc1854be7dba80ff712fda5ec25cb85f78;hpb=6e73f7320651975ce7cd8e72e2334041b7e80df1;p=sbcl.git diff --git a/tests/arith.impure.lisp b/tests/arith.impure.lisp index 6604a9f..27948bd 100644 --- a/tests/arith.impure.lisp +++ b/tests/arith.impure.lisp @@ -12,6 +12,7 @@ ;;;; more information. (load "assertoid.lisp") +(use-package "ASSERTOID") (defmacro define-compiled-fun (fun name) `(progn @@ -65,4 +66,31 @@ (assert (null (ignore-errors (compiled-logxor #c(2 3))))) (assert (= (compiled-logxor -6) -6)) -(sb-ext:quit :unix-status 104) \ No newline at end of file +(assert (raises-error? (coerce (expt 10 1000) 'single-float) type-error)) + +(defun are-we-getting-ash-right (x y) + (declare (optimize speed) + (type (unsigned-byte 32) x) + (type (integer -40 0) y)) + (ash x y)) + +(defun what-about-with-constants (x) + (declare (optimize speed) (type (unsigned-byte 32) x)) + (ash x -32)) + +(dotimes (i 41) + (assert (= (are-we-getting-ash-right (1- (ash 1 32)) (- i)) + (if (< i 32) + (1- (ash 1 (- 32 i))) + 0)))) + +(assert (= (what-about-with-constants (1- (ash 1 32))) 0)) + +(defun one-more-test-case-to-catch-sparc (x y) + (declare (optimize speed (safety 0)) + (type (unsigned-byte 32) x) (type (integer -40 2) y)) + (the (unsigned-byte 32) (ash x y))) + +(assert (= (one-more-test-case-to-catch-sparc (1- (ash 1 32)) -40) 0)) + +(sb-ext:quit :unix-status 104)