X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fhash.pure.lisp;h=f4458968777bc5f12070ef404ab0ff031b20f439;hb=6c1e23b7535e86697e518125f60550ecac82439d;hp=afbf22767199a8c71ebf13121ec074663212c413;hpb=d2054d96f0c8200decf8b6b8560d754d3c541cd7;p=sbcl.git diff --git a/tests/hash.pure.lisp b/tests/hash.pure.lisp index afbf227..f445896 100644 --- a/tests/hash.pure.lisp +++ b/tests/hash.pure.lisp @@ -17,5 +17,21 @@ (assert (not (typep sb-impl::+magic-hash-vector-value+ '(and fixnum unsigned-byte)))) -;;; success -(quit :unix-status 104) +;;; The return value of SXHASH on non-string/bitvector arrays should not +;;; change when the contents of the array change. +(let* ((a (make-array '(1) :initial-element 1)) + (sxhash (sxhash a)) + (hash (make-hash-table :test 'equal))) + (setf (gethash a hash) t) + (setf (aref a 0) 0) + (assert (= sxhash (sxhash a))) + ;; Need to make another access to the hash to disable the last-seen-element + ;; cache. + (setf (gethash 'y hash) t) + (assert (gethash a hash))) + +;;; Minimum quality checks +(assert (/= (sxhash "foo") (sxhash "bar"))) +(assert (/= (sxhash (pathname "foo.txt")) (sxhash (pathname "bar.txt")))) +(assert (/= (sxhash (list 1 2 3)) (sxhash (list 3 2 1)))) +(assert (/= (sxhash #*1010) (sxhash #*0101)))