X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=tests%2Fhash.pure.lisp;h=f4458968777bc5f12070ef404ab0ff031b20f439;hb=9c9d6dbdc28a8bfe70be09f35263e9ec02411d0e;hp=0d2dabde4a709236af2921392e49e15d892237ee;hpb=76b11c97e7721b25ca9f47f2019c2dd0b6ee15b8;p=sbcl.git diff --git a/tests/hash.pure.lisp b/tests/hash.pure.lisp index 0d2dabd..f445896 100644 --- a/tests/hash.pure.lisp +++ b/tests/hash.pure.lisp @@ -16,3 +16,22 @@ ;;; of SXHASH. The range of SXHASH is the non-negative fixnums. (assert (not (typep sb-impl::+magic-hash-vector-value+ '(and fixnum unsigned-byte)))) + +;;; 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)))