X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fseq.pure.lisp;h=fe5fe86efc1169ebe01e7136af8b7735d4911b0b;hb=911a74c40f7bc0ce13dfd5fa96ce83188d356fc3;hp=ab1c8ba5fad089d912e52a65904c19ca9348159e;hpb=41c307979e17a33e8700c1ca92ed8b3400a301b3;p=sbcl.git diff --git a/tests/seq.pure.lisp b/tests/seq.pure.lisp index ab1c8ba..fe5fe86 100644 --- a/tests/seq.pure.lisp +++ b/tests/seq.pure.lisp @@ -336,3 +336,48 @@ (t #'shuffle)) size type) #'<)))))))) + +(with-test (:name :stable-sort-smoke-test) + (flet ((iota (n type &aux (i 0)) + (map-into (make-sequence type n) + (lambda () + (cons 0 (incf i))))) + (shuffle (n type) + (let ((max (truncate (expt n 1/4))) + (i 0)) + (map-into (make-sequence type n) + (lambda () + (cons (random max) (incf i)))))) + (sortedp (x) + (let* ((nonce (list nil)) + (prev nonce)) + (every (lambda (x) + (prog1 (or (eql prev nonce) + (< (car prev) (car x)) + (and (= (car prev) (car x)) + (< (cdr prev) (cdr x)))) + (setf prev x))) + x)))) + (dolist (type '(simple-vector list)) + (dolist (size '(0 1 2 3 4 5 6 7 8 + 9 10 11 12 13 14 15 16 17 + 1023 1024 1025 1536)) + (loop for repeat below 5 do + (assert + (sortedp + (stable-sort (funcall (case repeat + (0 #'iota) + (t #'shuffle)) + size type) + #'< :key #'car)))))))) + +(with-test (:name :&more-elt-index-too-large) + (assert (raises-error? (funcall + (compile nil '(lambda (&rest args) + (declare (optimize safety)) + (elt args 0)))) + sb-kernel:index-too-large-error))) + +(with-test (:name :do-sequence-on-literals) + (assert (= (sequence:dosequence (e #(1 2 3)) (return e)) + 1)))