diff options
author | Tom Tromey <tom@tromey.com> | 2018-07-07 15:32:34 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-07-12 22:12:27 -0600 |
commit | 6d4bf2cedab365411f0aedb373b63291086658e9 (patch) | |
tree | f88607e4c8b2e21fe2024cbf14014d9bc6396350 /test/src/data-tests.el | |
parent | 5875fbaa2dfd919a2ba22db1d20ffa6c4c6e13bd (diff) | |
download | emacs-6d4bf2cedab365411f0aedb373b63291086658e9.tar.gz |
Add some bignum tests
* test/src/data-tests.el (data-tests-bignum, data-tests-+)
(data-tests-/, data-tests-number-predicates): New tests.
* test/src/fns-tests (test-bignum-eql): New test.
* test/src/lread-tests (lread-long-hex-integer): Expect bignum.
* test/src/print-tests (print-bignum): New test.
Diffstat (limited to 'test/src/data-tests.el')
-rw-r--r-- | test/src/data-tests.el | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 3cd537859fd..543bb90f73f 100644 --- a/test/src/data-tests.el +++ b/test/src/data-tests.el @@ -515,4 +515,63 @@ comparing the subr with a much slower lisp implementation." (bound-and-true-p data-tests-foo2) (bound-and-true-p data-tests-foo3))))))) +(ert-deftest data-tests-bignum () + (should (bignump (+ most-positive-fixnum 1))) + (let ((f0 (+ (float most-positive-fixnum) 1)) + (f-1 (- (float most-negative-fixnum) 1)) + (b0 (+ most-positive-fixnum 1)) + (b-1 (- most-negative-fixnum 1))) + (should (> b0 -1)) + (should (> b0 f-1)) + (should (> b0 b-1)) + (should (>= b0 -1)) + (should (>= b0 f-1)) + (should (>= b0 b-1)) + (should (>= b-1 b-1)) + + (should (< -1 b0)) + (should (< f-1 b0)) + (should (< b-1 b0)) + (should (<= -1 b0)) + (should (<= f-1 b0)) + (should (<= b-1 b0)) + (should (<= b-1 b-1)) + + (should (= b0 f0)) + (should (= b0 b0)) + + (should (/= b0 f-1)) + (should (/= b0 b-1)))) + +(ert-deftest data-tests-+ () + (should-not (fixnump (+ most-positive-fixnum most-positive-fixnum))) + (should (> (+ most-positive-fixnum most-positive-fixnum) most-positive-fixnum)) + (should (eq (- (+ most-positive-fixnum most-positive-fixnum) + (+ most-positive-fixnum most-positive-fixnum)) + 0))) + +(ert-deftest data-tests-/ () + (let* ((x (* most-positive-fixnum 8)) + (y (* most-negative-fixnum 8)) + (z (- y))) + (should (= most-positive-fixnum (/ x 8))) + (should (= most-negative-fixnum (/ y 8))) + (should (= -1 (/ y z))) + (should (= -1 (/ z y))) + (should (= 0 (/ x (* 2 x)))) + (should (= 0 (/ y (* 2 y)))) + (should (= 0 (/ z (* 2 z)))))) + +(ert-deftest data-tests-number-predicates () + (should (fixnump 0)) + (should (fixnump most-negative-fixnum)) + (should (fixnump most-positive-fixnum)) + (should (integerp (+ most-positive-fixnum 1))) + (should (integer-or-marker-p (+ most-positive-fixnum 1))) + (should (numberp (+ most-positive-fixnum 1))) + (should (number-or-marker-p (+ most-positive-fixnum 1))) + (should (natnump (+ most-positive-fixnum 1))) + (should-not (fixnump (+ most-positive-fixnum 1))) + (should (bignump (+ most-positive-fixnum 1)))) + ;;; data-tests.el ends here |