Fix make-array transforms.
[sbcl.git] / tests / hash.pure.lisp
index afbf227..f445896 100644 (file)
 (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)))