diff options
| author | Tom Tromey | 2018-07-07 23:42:10 -0600 |
|---|---|---|
| committer | Tom Tromey | 2018-07-12 22:12:28 -0600 |
| commit | 3dea8f8f53f81a1d15a55c9e3c87a7eade7ca273 (patch) | |
| tree | 1f543cc1ccfe3552011f899d8f8e132ee9c7c276 /test/src | |
| parent | d0fac17abdf6883bbf82b1752988db38d05282e6 (diff) | |
| download | emacs-3dea8f8f53f81a1d15a55c9e3c87a7eade7ca273.tar.gz emacs-3dea8f8f53f81a1d15a55c9e3c87a7eade7ca273.zip | |
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')
| -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." | |||
| 597 | (should (= (min a b c) a)) | 597 | (should (= (min a b c) a)) |
| 598 | (should (= (max a b c) b)))) | 598 | (should (= (max a b c) b)))) |
| 599 | 599 | ||
| 600 | (defun data-tests-check-sign (x y) | ||
| 601 | (should (eq (cl-signum x) (cl-signum y)))) | ||
| 602 | |||
| 603 | (ert-deftest data-tests-%-mod () | ||
| 604 | (let* ((b1 (+ most-positive-fixnum 1)) | ||
| 605 | (nb1 (- b1)) | ||
| 606 | (b3 (+ most-positive-fixnum 3)) | ||
| 607 | (nb3 (- b3))) | ||
| 608 | (data-tests-check-sign (% 1 3) (% b1 b3)) | ||
| 609 | (data-tests-check-sign (mod 1 3) (mod b1 b3)) | ||
| 610 | (data-tests-check-sign (% 1 -3) (% b1 nb3)) | ||
| 611 | (data-tests-check-sign (mod 1 -3) (mod b1 nb3)) | ||
| 612 | (data-tests-check-sign (% -1 3) (% nb1 b3)) | ||
| 613 | (data-tests-check-sign (mod -1 3) (mod nb1 b3)) | ||
| 614 | (data-tests-check-sign (% -1 -3) (% nb1 nb3)) | ||
| 615 | (data-tests-check-sign (mod -1 -3) (mod nb1 nb3)))) | ||
| 616 | |||
| 600 | ;;; data-tests.el ends here | 617 | ;;; data-tests.el ends here |