diff options
author | Tom Tromey <tom@tromey.com> | 2018-07-07 23:42:10 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-07-12 22:12:28 -0600 |
commit | 3dea8f8f53f81a1d15a55c9e3c87a7eade7ca273 (patch) | |
tree | 1f543cc1ccfe3552011f899d8f8e132ee9c7c276 /test/src/data-tests.el | |
parent | d0fac17abdf6883bbf82b1752988db38d05282e6 (diff) | |
download | emacs-3dea8f8f53f81a1d15a55c9e3c87a7eade7ca273.tar.gz |
Make % and mod handle bignums
* src/data.c (Frem, Fmod): Handle bignums.
* src/lisp.h (CHECK_INTEGER_COERCE_MARKER): New macro.
* test/src/data-tests.el (data-tests-check-sign)
(data-tests-%-mod): New tests.
Diffstat (limited to 'test/src/data-tests.el')
-rw-r--r-- | test/src/data-tests.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 4565cfb3877..2423d7a7098 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -597,4 +597,21 @@ comparing the subr with a much slower lisp implementation." (should (= (min a b c) a)) (should (= (max a b c) b)))) +(defun data-tests-check-sign (x y) + (should (eq (cl-signum x) (cl-signum y)))) + +(ert-deftest data-tests-%-mod () + (let* ((b1 (+ most-positive-fixnum 1)) + (nb1 (- b1)) + (b3 (+ most-positive-fixnum 3)) + (nb3 (- b3))) + (data-tests-check-sign (% 1 3) (% b1 b3)) + (data-tests-check-sign (mod 1 3) (mod b1 b3)) + (data-tests-check-sign (% 1 -3) (% b1 nb3)) + (data-tests-check-sign (mod 1 -3) (mod b1 nb3)) + (data-tests-check-sign (% -1 3) (% nb1 b3)) + (data-tests-check-sign (mod -1 3) (mod nb1 b3)) + (data-tests-check-sign (% -1 -3) (% nb1 nb3)) + (data-tests-check-sign (mod -1 -3) (mod nb1 nb3)))) + ;;; data-tests.el ends here |