diff options
| author | Tom Tromey | 2018-07-07 15:32:34 -0600 |
|---|---|---|
| committer | Tom Tromey | 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 emacs-6d4bf2cedab365411f0aedb373b63291086658e9.zip | |
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." | |||
| 515 | (bound-and-true-p data-tests-foo2) | 515 | (bound-and-true-p data-tests-foo2) |
| 516 | (bound-and-true-p data-tests-foo3))))))) | 516 | (bound-and-true-p data-tests-foo3))))))) |
| 517 | 517 | ||
| 518 | (ert-deftest data-tests-bignum () | ||
| 519 | (should (bignump (+ most-positive-fixnum 1))) | ||
| 520 | (let ((f0 (+ (float most-positive-fixnum) 1)) | ||
| 521 | (f-1 (- (float most-negative-fixnum) 1)) | ||
| 522 | (b0 (+ most-positive-fixnum 1)) | ||
| 523 | (b-1 (- most-negative-fixnum 1))) | ||
| 524 | (should (> b0 -1)) | ||
| 525 | (should (> b0 f-1)) | ||
| 526 | (should (> b0 b-1)) | ||
| 527 | (should (>= b0 -1)) | ||
| 528 | (should (>= b0 f-1)) | ||
| 529 | (should (>= b0 b-1)) | ||
| 530 | (should (>= b-1 b-1)) | ||
| 531 | |||
| 532 | (should (< -1 b0)) | ||
| 533 | (should (< f-1 b0)) | ||
| 534 | (should (< b-1 b0)) | ||
| 535 | (should (<= -1 b0)) | ||
| 536 | (should (<= f-1 b0)) | ||
| 537 | (should (<= b-1 b0)) | ||
| 538 | (should (<= b-1 b-1)) | ||
| 539 | |||
| 540 | (should (= b0 f0)) | ||
| 541 | (should (= b0 b0)) | ||
| 542 | |||
| 543 | (should (/= b0 f-1)) | ||
| 544 | (should (/= b0 b-1)))) | ||
| 545 | |||
| 546 | (ert-deftest data-tests-+ () | ||
| 547 | (should-not (fixnump (+ most-positive-fixnum most-positive-fixnum))) | ||
| 548 | (should (> (+ most-positive-fixnum most-positive-fixnum) most-positive-fixnum)) | ||
| 549 | (should (eq (- (+ most-positive-fixnum most-positive-fixnum) | ||
| 550 | (+ most-positive-fixnum most-positive-fixnum)) | ||
| 551 | 0))) | ||
| 552 | |||
| 553 | (ert-deftest data-tests-/ () | ||
| 554 | (let* ((x (* most-positive-fixnum 8)) | ||
| 555 | (y (* most-negative-fixnum 8)) | ||
| 556 | (z (- y))) | ||
| 557 | (should (= most-positive-fixnum (/ x 8))) | ||
| 558 | (should (= most-negative-fixnum (/ y 8))) | ||
| 559 | (should (= -1 (/ y z))) | ||
| 560 | (should (= -1 (/ z y))) | ||
| 561 | (should (= 0 (/ x (* 2 x)))) | ||
| 562 | (should (= 0 (/ y (* 2 y)))) | ||
| 563 | (should (= 0 (/ z (* 2 z)))))) | ||
| 564 | |||
| 565 | (ert-deftest data-tests-number-predicates () | ||
| 566 | (should (fixnump 0)) | ||
| 567 | (should (fixnump most-negative-fixnum)) | ||
| 568 | (should (fixnump most-positive-fixnum)) | ||
| 569 | (should (integerp (+ most-positive-fixnum 1))) | ||
| 570 | (should (integer-or-marker-p (+ most-positive-fixnum 1))) | ||
| 571 | (should (numberp (+ most-positive-fixnum 1))) | ||
| 572 | (should (number-or-marker-p (+ most-positive-fixnum 1))) | ||
| 573 | (should (natnump (+ most-positive-fixnum 1))) | ||
| 574 | (should-not (fixnump (+ most-positive-fixnum 1))) | ||
| 575 | (should (bignump (+ most-positive-fixnum 1)))) | ||
| 576 | |||
| 518 | ;;; data-tests.el ends here | 577 | ;;; data-tests.el ends here |