aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorTom Tromey2018-08-04 11:08:31 -0600
committerTom Tromey2018-08-04 11:08:31 -0600
commit1303f8a4806fb170c14375c53b0f79d03e288eb3 (patch)
treee840c741418d06d6546f5dc90f387b3680990d49 /test/src
parent91d505d8e2cd8a5736f4ed76bb5aabfbc4410e89 (diff)
downloademacs-1303f8a4806fb170c14375c53b0f79d03e288eb3.tar.gz
emacs-1303f8a4806fb170c14375c53b0f79d03e288eb3.zip
Fix hash functions for bignums
* src/fns.c (cmpfn_eql, hashfn_eql): Handle bignums. (sxhash_bignum): New function. (sxhash): Use it. * test/src/fns-tests.el (test-bignum-hash): New test.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/fns-tests.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index d440cfabda4..d560f0bb0d9 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -602,4 +602,15 @@
602 (should (equal x y)) 602 (should (equal x y))
603 (should-not (eql x 0.0e+NaN)))) 603 (should-not (eql x 0.0e+NaN))))
604 604
605(ert-deftest test-bignum-hash ()
606 "Test that hash tables work for bignums."
607 ;; Make two bignums that are eql but not eq.
608 (let ((b1 (1+ most-positive-fixnum))
609 (b2 (1+ most-positive-fixnum)))
610 (dolist (test '(eq eql equal))
611 (let ((hash (make-hash-table :test test)))
612 (puthash b1 t hash)
613 (should (eq (gethash b2 hash)
614 (funcall test b1 b2)))))))
615
605(provide 'fns-tests) 616(provide 'fns-tests)