aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorTom Tromey2018-08-11 13:34:17 -0600
committerTom Tromey2018-08-11 13:34:17 -0600
commit78ec68e18f07a90a9ad400683b973ff51baa80e1 (patch)
tree638c986bf753e3ddab9992ba1ef0a10a3d4891f0 /test
parentba1c4f63e3d2adbe9b590a3c51c2a0808c84723f (diff)
parent79f59d41a3d2ef3b4a9a87265bf517206a5837ad (diff)
downloademacs-78ec68e18f07a90a9ad400683b973ff51baa80e1.tar.gz
emacs-78ec68e18f07a90a9ad400683b973ff51baa80e1.zip
Merge branch 'feature/bignum'
Diffstat (limited to 'test')
-rw-r--r--test/lisp/international/ccl-tests.el219
-rw-r--r--test/src/data-tests.el109
-rw-r--r--test/src/editfns-tests.el31
-rw-r--r--test/src/emacs-module-tests.el8
-rw-r--r--test/src/floatfns-tests.el12
-rw-r--r--test/src/fns-tests.el20
-rw-r--r--test/src/lread-tests.el4
-rw-r--r--test/src/print-tests.el6
8 files changed, 392 insertions, 17 deletions
diff --git a/test/lisp/international/ccl-tests.el b/test/lisp/international/ccl-tests.el
new file mode 100644
index 00000000000..ba6d2040e8c
--- /dev/null
+++ b/test/lisp/international/ccl-tests.el
@@ -0,0 +1,219 @@
1(require 'ert)
2(require 'ccl)
3(require 'seq)
4
5
6(ert-deftest shift ()
7 ;; shift left +ve 5628 #x00000000000015fc
8 (should (= (ash 5628 8) 1440768)) ; #x000000000015fc00
9 (should (= (lsh 5628 8) 1440768)) ; #x000000000015fc00
10
11 ;; shift left -ve -5628 #x3fffffffffffea04
12 (should (= (ash -5628 8) -1440768)) ; #x3fffffffffea0400
13 (should (= (lsh -5628 8) -1440768)) ; #x3fffffffffea0400
14
15 ;; shift right +ve 5628 #x00000000000015fc
16 (should (= (ash 5628 -8) 21)) ; #x0000000000000015
17 (should (= (lsh 5628 -8) 21)) ; #x0000000000000015
18
19 ;; shift right -ve -5628 #x3fffffffffffea04
20 (should (= (ash -5628 -8) -22)) ; #x3fffffffffffffea
21
22 ;; shift right -5628 #x3fffffffffffea04
23 (cond
24 ((fboundp 'bignump)
25 (should (= (lsh -5628 -8) -22))) ; #x3fffffffffffffea bignum
26 ((= (logb most-negative-fixnum) 61)
27 (should (= (lsh -5628 -8)
28 (string-to-number
29 "18014398509481962")))) ; #x003fffffffffffea master (64bit)
30 ((= (logb most-negative-fixnum) 29)
31 (should (= (lsh -5628 -8) 4194282))) ; #x003fffea master (32bit)
32 ))
33
34;; CCl program from `pgg-parse-crc24' in lisp/obsolete/pgg-parse.el
35(defconst prog-pgg-source
36 '(1
37 ((loop
38 (read r0) (r1 ^= r0) (r2 ^= 0)
39 (r5 = 0)
40 (loop
41 (r1 <<= 1)
42 (r1 += ((r2 >> 15) & 1))
43 (r2 <<= 1)
44 (if (r1 & 256)
45 ((r1 ^= 390) (r2 ^= 19707)))
46 (if (r5 < 7)
47 ((r5 += 1)
48 (repeat))))
49 (repeat)))))
50
51(defconst prog-pgg-code
52 [1 30 14 114744 114775 0 161 131127 1 148217 15 82167
53 1 1848 131159 1 1595 5 256 114743 390 114775 19707
54 1467 16 7 183 1 -5628 -7164 22])
55
56(defconst prog-pgg-dump
57"Out-buffer must be as large as in-buffer.
58Main-body:
59 2:[read-register] read r0 (0 remaining)
60 3:[set-assign-expr-register] r1 ^= r0
61 4:[set-assign-expr-const] r2 ^= 0
62 6:[set-short-const] r5 = 0
63 7:[set-assign-expr-const] r1 <<= 1
64 9:[set-expr-const] r7 = r2 >> 15
65 11:[set-assign-expr-const] r7 &= 1
66 13:[set-assign-expr-register] r1 += r7
67 14:[set-assign-expr-const] r2 <<= 1
68 16:[jump-cond-expr-const] if !(r1 & 256), jump to 23(+7)
69 19:[set-assign-expr-const] r1 ^= 390
70 21:[set-assign-expr-const] r2 ^= 19707
71 23:[jump-cond-expr-const] if !(r5 < 7), jump to 29(+6)
72 26:[set-assign-expr-const] r5 += 1
73 28:[jump] jump to 7(-21)
74 29:[jump] jump to 2(-27)
75At EOF:
76 30:[end] end
77")
78
79(ert-deftest ccl-compile-pgg ()
80 (should (equal (ccl-compile prog-pgg-source) prog-pgg-code)))
81
82(ert-deftest ccl-dump-pgg ()
83 (with-temp-buffer
84 (ccl-dump prog-pgg-code)
85 (should (equal (buffer-string) prog-pgg-dump))))
86
87(ert-deftest pgg-parse-crc24 ()
88 ;; Compiler
89 (require 'pgg)
90 (should (equal pgg-parse-crc24 prog-pgg-code))
91 ;; Interpreter
92 (should (equal (pgg-parse-crc24-string "foo") (concat [#x4f #xc2 #x55])))
93 (should (equal (pgg-parse-crc24-string "bar") (concat [#x51 #xd9 #x53])))
94 (should (equal (pgg-parse-crc24-string "baz") (concat [#xf0 #x58 #x6a]))))
95
96(ert-deftest pgg-parse-crc24-dump ()
97 ;; Disassembler
98 (require 'pgg)
99 (with-temp-buffer
100 (ccl-dump pgg-parse-crc24)
101 (should (equal (buffer-string) prog-pgg-dump))))
102
103;;----------------------------------------------------------------------------
104;; Program from 'midikbd-decoder in midi-kbd-0.2.el GNU ELPA package
105(defconst prog-midi-source
106 '(2
107 (loop
108 (loop
109 ;; central message receiver loop here.
110 ;; When it exits, the command to deal with is in r0
111 ;; Any arguments are in r1 and r2
112 ;; r3 contains: 0 if no arguments are accepted
113 ;; 1 if 1 argument can be accepted
114 ;; 2 if 2 arguments can be accepted
115 ;; 3 if the first of two arguments has been accepted
116 ;; Arguments are read into r1 and r2.
117 ;; r4 contains the current running status byte if any.
118 (read-if (r0 < #x80)
119 (branch r3
120 (repeat)
121 ((r1 = r0) (r0 = r4) (break))
122 ((r1 = r0) (r3 = 3) (repeat))
123 ((r2 = r0) (r3 = 2) (r0 = r4) (break))))
124 (if (r0 >= #xf8) ; real time message
125 (break))
126 (if (r0 < #xf0) ; channel command
127 ((r4 = r0)
128 (if ((r0 & #xe0) == #xc0)
129 ;; program change and channel pressure take only 1 argument
130 (r3 = 1)
131 (r3 = 2))
132 (repeat)))
133 ;; system common message, we swallow those for now
134 (r3 = 0)
135 (repeat))
136 (if ((r0 & #xf0) == #x90)
137 (if (r2 == 0) ; Some Midi devices use velocity 0
138 ; for switching notes off,
139 ; so translate into note-off
140 ; and fall through
141 (r0 -= #x10)
142 ((r0 &= #xf)
143 (write 0)
144 (write r0 r1 r2)
145 (repeat))))
146 (if ((r0 & #xf0) == #x80)
147 ((r0 &= #xf)
148 (write 1)
149 (write r0 r1 r2)
150 (repeat)))
151 (repeat))))
152
153(defconst prog-midi-code
154 [2 72 4893 16 128 1133 5 6 9 12 16 -2556 32 1024 6660 32 865
155 -4092 64 609 1024 4868 795 20 248 3844 3099 16 240 128 82169
156 224 1275 18 192 353 260 609 -9468 97 -9980 82169 240 4091
157 18 144 1371 18 0 16407 16 1796 81943 15 20 529 305 81 -14588
158 82169 240 2555 18 128 81943 15 276 529 305 81 -17660 -17916 22])
159
160(defconst prog-midi-dump
161"Out-buffer must be 2 times bigger than in-buffer.
162Main-body:
163 2:[read-jump-cond-expr-const] read r0, if !(r0 < 128), jump to 22(+20)
164 5:[branch] jump to array[r3] of length 4
165 11 12 15 18 22
166 11:[jump] jump to 2(-9)
167 12:[set-register] r1 = r0
168 13:[set-register] r0 = r4
169 14:[jump] jump to 41(+27)
170 15:[set-register] r1 = r0
171 16:[set-short-const] r3 = 3
172 17:[jump] jump to 2(-15)
173 18:[set-register] r2 = r0
174 19:[set-short-const] r3 = 2
175 20:[set-register] r0 = r4
176 21:[jump] jump to 41(+20)
177 22:[jump-cond-expr-const] if !(r0 >= 248), jump to 26(+4)
178 25:[jump] jump to 41(+16)
179 26:[jump-cond-expr-const] if !(r0 < 240), jump to 39(+13)
180 29:[set-register] r4 = r0
181 30:[set-expr-const] r7 = r0 & 224
182 32:[jump-cond-expr-const] if !(r7 == 192), jump to 37(+5)
183 35:[set-short-const] r3 = 1
184 36:[jump] jump to 38(+2)
185 37:[set-short-const] r3 = 2
186 38:[jump] jump to 2(-36)
187 39:[set-short-const] r3 = 0
188 40:[jump] jump to 2(-38)
189 41:[set-expr-const] r7 = r0 & 240
190 43:[jump-cond-expr-const] if !(r7 == 144), jump to 59(+16)
191 46:[jump-cond-expr-const] if !(r2 == 0), jump to 52(+6)
192 49:[set-assign-expr-const] r0 -= 16
193 51:[jump] jump to 59(+8)
194 52:[set-assign-expr-const] r0 &= 15
195 54:[write-const-string] write char \"\x00\"
196 55:[write-register] write r0 (2 remaining)
197 56:[write-register] write r1 (1 remaining)
198 57:[write-register] write r2 (0 remaining)
199 58:[jump] jump to 2(-56)
200 59:[set-expr-const] r7 = r0 & 240
201 61:[jump-cond-expr-const] if !(r7 == 128), jump to 71(+10)
202 64:[set-assign-expr-const] r0 &= 15
203 66:[write-const-string] write char \"\x01\"
204 67:[write-register] write r0 (2 remaining)
205 68:[write-register] write r1 (1 remaining)
206 69:[write-register] write r2 (0 remaining)
207 70:[jump] jump to 2(-68)
208 71:[jump] jump to 2(-69)
209At EOF:
210 72:[end] end
211")
212
213(ert-deftest ccl-compile-midi ()
214 (should (equal (ccl-compile prog-midi-source) prog-midi-code)))
215
216(ert-deftest ccl-dump-midi ()
217 (with-temp-buffer
218 (ccl-dump prog-midi-code)
219 (should (equal (buffer-string) prog-midi-dump))))
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index 3cd537859fd..ee6a3eb9222 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -105,7 +105,9 @@
105 (should (isnan (min 0.0e+NaN))) 105 (should (isnan (min 0.0e+NaN)))
106 (should (isnan (min 0.0e+NaN 1 2))) 106 (should (isnan (min 0.0e+NaN 1 2)))
107 (should (isnan (min 1.0 0.0e+NaN))) 107 (should (isnan (min 1.0 0.0e+NaN)))
108 (should (isnan (min 1.0 0.0e+NaN 1.1)))) 108 (should (isnan (min 1.0 0.0e+NaN 1.1)))
109 (should (isnan (min 1.0 0.0e+NaN 1.1 (1+ most-positive-fixnum))))
110 (should (isnan (max 1.0 0.0e+NaN 1.1 (1+ most-positive-fixnum)))))
109 111
110(defun data-tests-popcnt (byte) 112(defun data-tests-popcnt (byte)
111 "Calculate the Hamming weight of BYTE." 113 "Calculate the Hamming weight of BYTE."
@@ -515,4 +517,109 @@ comparing the subr with a much slower lisp implementation."
515 (bound-and-true-p data-tests-foo2) 517 (bound-and-true-p data-tests-foo2)
516 (bound-and-true-p data-tests-foo3))))))) 518 (bound-and-true-p data-tests-foo3)))))))
517 519
520(ert-deftest data-tests-bignum ()
521 (should (bignump (+ most-positive-fixnum 1)))
522 (let ((f0 (+ (float most-positive-fixnum) 1))
523 (f-1 (- (float most-negative-fixnum) 1))
524 (b0 (+ most-positive-fixnum 1))
525 (b-1 (- most-negative-fixnum 1)))
526 (should (> b0 -1))
527 (should (> b0 f-1))
528 (should (> b0 b-1))
529 (should (>= b0 -1))
530 (should (>= b0 f-1))
531 (should (>= b0 b-1))
532 (should (>= b-1 b-1))
533
534 (should (< -1 b0))
535 (should (< f-1 b0))
536 (should (< b-1 b0))
537 (should (<= -1 b0))
538 (should (<= f-1 b0))
539 (should (<= b-1 b0))
540 (should (<= b-1 b-1))
541
542 (should (= b0 f0))
543 (should (= b0 b0))
544
545 (should (/= b0 f-1))
546 (should (/= b0 b-1))))
547
548(ert-deftest data-tests-+ ()
549 (should-not (fixnump (+ most-positive-fixnum most-positive-fixnum)))
550 (should (> (+ most-positive-fixnum most-positive-fixnum) most-positive-fixnum))
551 (should (eq (- (+ most-positive-fixnum most-positive-fixnum)
552 (+ most-positive-fixnum most-positive-fixnum))
553 0)))
554
555(ert-deftest data-tests-/ ()
556 (let* ((x (* most-positive-fixnum 8))
557 (y (* most-negative-fixnum 8))
558 (z (- y)))
559 (should (= most-positive-fixnum (/ x 8)))
560 (should (= most-negative-fixnum (/ y 8)))
561 (should (= -1 (/ y z)))
562 (should (= -1 (/ z y)))
563 (should (= 0 (/ x (* 2 x))))
564 (should (= 0 (/ y (* 2 y))))
565 (should (= 0 (/ z (* 2 z))))))
566
567(ert-deftest data-tests-number-predicates ()
568 (should (fixnump 0))
569 (should (fixnump most-negative-fixnum))
570 (should (fixnump most-positive-fixnum))
571 (should (integerp (+ most-positive-fixnum 1)))
572 (should (integer-or-marker-p (+ most-positive-fixnum 1)))
573 (should (numberp (+ most-positive-fixnum 1)))
574 (should (number-or-marker-p (+ most-positive-fixnum 1)))
575 (should (natnump (+ most-positive-fixnum 1)))
576 (should-not (fixnump (+ most-positive-fixnum 1)))
577 (should (bignump (+ most-positive-fixnum 1))))
578
579(ert-deftest data-tests-number-to-string ()
580 (let* ((s "99999999999999999999999999999")
581 (v (read s)))
582 (should (equal (number-to-string v) s))))
583
584(ert-deftest data-tests-1+ ()
585 (should (> (1+ most-positive-fixnum) most-positive-fixnum))
586 (should (fixnump (1+ (1- most-negative-fixnum)))))
587
588(ert-deftest data-tests-1- ()
589 (should (< (1- most-negative-fixnum) most-negative-fixnum))
590 (should (fixnump (1- (1+ most-positive-fixnum)))))
591
592(ert-deftest data-tests-logcount ()
593 (should (= (logcount (read "#xffffffffffffffffffffffffffffffff")) 128)))
594
595(ert-deftest data-tests-minmax ()
596 (let ((a (- most-negative-fixnum 1))
597 (b (+ most-positive-fixnum 1))
598 (c 0))
599 (should (= (min a b c) a))
600 (should (= (max a b c) b))))
601
602(defun data-tests-check-sign (x y)
603 (should (eq (cl-signum x) (cl-signum y))))
604
605(ert-deftest data-tests-%-mod ()
606 (let* ((b1 (+ most-positive-fixnum 1))
607 (nb1 (- b1))
608 (b3 (+ most-positive-fixnum 3))
609 (nb3 (- b3)))
610 (data-tests-check-sign (% 1 3) (% b1 b3))
611 (data-tests-check-sign (mod 1 3) (mod b1 b3))
612 (data-tests-check-sign (% 1 -3) (% b1 nb3))
613 (data-tests-check-sign (mod 1 -3) (mod b1 nb3))
614 (data-tests-check-sign (% -1 3) (% nb1 b3))
615 (data-tests-check-sign (mod -1 3) (mod nb1 b3))
616 (data-tests-check-sign (% -1 -3) (% nb1 nb3))
617 (data-tests-check-sign (mod -1 -3) (mod nb1 nb3))))
618
619(ert-deftest data-tests-ash-lsh ()
620 (should (= (ash most-negative-fixnum 1)
621 (* most-negative-fixnum 2)))
622 (should (= (lsh most-negative-fixnum 1)
623 (* most-negative-fixnum 2))))
624
518;;; data-tests.el ends here 625;;; data-tests.el ends here
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index aa896b06499..964ff088360 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -173,20 +173,23 @@
173 (should-error (format "%x" 18446744073709551616.0) 173 (should-error (format "%x" 18446744073709551616.0)
174 :type 'overflow-error)) 174 :type 'overflow-error))
175(ert-deftest read-large-integer () 175(ert-deftest read-large-integer ()
176 (should-error (read (format "%d0" most-negative-fixnum)) 176 (should (eq (type-of (read (format "%d0" most-negative-fixnum))) 'integer))
177 :type 'overflow-error) 177 (should (eq (type-of (read (format "%+d" (* -8.0 most-negative-fixnum))))
178 (should-error (read (format "%+d" (* -8.0 most-negative-fixnum))) 178 'integer))
179 :type 'overflow-error) 179 (should (eq (type-of (read (substring (format "%d" most-negative-fixnum) 1)))
180 (should-error (read (substring (format "%d" most-negative-fixnum) 1)) 180 'integer))
181 :type 'overflow-error) 181 (should (eq (type-of (read (format "#x%x" most-negative-fixnum)))
182 'integer))
183 (should (eq (type-of (read (format "#o%o" most-negative-fixnum)))
184 'integer))
185 (should (eq (type-of (read (format "#32rG%x" most-positive-fixnum)))
186 'integer))
182 (let ((binary-as-unsigned nil)) 187 (let ((binary-as-unsigned nil))
183 (dolist (fmt '("%d" "%s" "#o%o" "#x%x")) 188 (dolist (fmt '("%d" "%s" "#o%o" "#x%x"))
184 (dolist (val (list most-negative-fixnum (1+ most-negative-fixnum) 189 (dolist (val (list most-negative-fixnum (1+ most-negative-fixnum)
185 -1 0 1 190 -1 0 1
186 (1- most-positive-fixnum) most-positive-fixnum)) 191 (1- most-positive-fixnum) most-positive-fixnum))
187 (should (eq val (read (format fmt val))))))) 192 (should (eq val (read (format fmt val))))))))
188 (should-error (read (format "#32rG%x" most-positive-fixnum))
189 :type 'overflow-error))
190 193
191(ert-deftest format-%o-invalid-float () 194(ert-deftest format-%o-invalid-float ()
192 (should-error (format "%o" -1e-37) 195 (should-error (format "%o" -1e-37)
@@ -374,4 +377,14 @@
374 (should (eq (type-of (car (nth 4 buffer-undo-list))) 'marker)) 377 (should (eq (type-of (car (nth 4 buffer-undo-list))) 'marker))
375 (garbage-collect))) 378 (garbage-collect)))
376 379
380(ert-deftest format-bignum ()
381 (let* ((s1 "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")
382 (v1 (read (concat "#x" s1)))
383 (s2 "99999999999999999999999999999999")
384 (v2 (read s2)))
385 (should (> v1 most-positive-fixnum))
386 (should (equal (format "%X" v1) s1))
387 (should (> v2 most-positive-fixnum))
388 (should (equal (format "%d" v2) s2))))
389
377;;; editfns-tests.el ends here 390;;; editfns-tests.el ends here
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 9ef5a47b159..90cd37a98a5 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -68,10 +68,10 @@
68 (1+ #x1fffffff))) 68 (1+ #x1fffffff)))
69 (should (= (mod-test-sum -1 (1+ #x1fffffff)) 69 (should (= (mod-test-sum -1 (1+ #x1fffffff))
70 #x1fffffff))) 70 #x1fffffff)))
71 (should-error (mod-test-sum 1 most-positive-fixnum) 71 (should (= (mod-test-sum 1 most-positive-fixnum)
72 :type 'overflow-error) 72 (1+ most-positive-fixnum)))
73 (should-error (mod-test-sum -1 most-negative-fixnum) 73 (should (= (mod-test-sum -1 most-negative-fixnum)
74 :type 'overflow-error)) 74 (1- most-negative-fixnum))))
75 75
76(ert-deftest mod-test-sum-docstring () 76(ert-deftest mod-test-sum-docstring ()
77 (should (string= (documentation 'mod-test-sum) "Return A + B\n\n(fn a b)"))) 77 (should (string= (documentation 'mod-test-sum) "Return A + B\n\n(fn a b)")))
diff --git a/test/src/floatfns-tests.el b/test/src/floatfns-tests.el
index cb173eea76d..7714c05d60a 100644
--- a/test/src/floatfns-tests.el
+++ b/test/src/floatfns-tests.el
@@ -34,4 +34,16 @@
34 (should-error (ftruncate 0) :type 'wrong-type-argument) 34 (should-error (ftruncate 0) :type 'wrong-type-argument)
35 (should-error (fround 0) :type 'wrong-type-argument)) 35 (should-error (fround 0) :type 'wrong-type-argument))
36 36
37(ert-deftest bignum-to-float ()
38 (should (eql (float (+ most-positive-fixnum 1))
39 (+ (float most-positive-fixnum) 1))))
40
41(ert-deftest bignum-abs ()
42 (should (= most-positive-fixnum
43 (- (abs most-negative-fixnum) 1))))
44
45(ert-deftest bignum-logb ()
46 (should (= (+ (logb most-positive-fixnum) 1)
47 (logb (+ most-positive-fixnum 1)))))
48
37(provide 'floatfns-tests) 49(provide 'floatfns-tests)
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index e4b9cbe25a4..f722ed6333e 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -604,4 +604,24 @@
604 (should (equal 1 (string-distance "ab" "a我b"))) 604 (should (equal 1 (string-distance "ab" "a我b")))
605 (should (equal 1 (string-distance "我" "她")))) 605 (should (equal 1 (string-distance "我" "她"))))
606 606
607(ert-deftest test-bignum-eql ()
608 "Test that `eql' works for bignums."
609 (let ((x (+ most-positive-fixnum 1))
610 (y (+ most-positive-fixnum 1)))
611 (should (eq x x))
612 (should (eql x y))
613 (should (equal x y))
614 (should-not (eql x 0.0e+NaN))))
615
616(ert-deftest test-bignum-hash ()
617 "Test that hash tables work for bignums."
618 ;; Make two bignums that are eql but not eq.
619 (let ((b1 (1+ most-positive-fixnum))
620 (b2 (1+ most-positive-fixnum)))
621 (dolist (test '(eq eql equal))
622 (let ((hash (make-hash-table :test test)))
623 (puthash b1 t hash)
624 (should (eq (gethash b2 hash)
625 (funcall test b1 b2)))))))
626
607(provide 'fns-tests) 627(provide 'fns-tests)
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el
index 639a6da93ae..17381340c7b 100644
--- a/test/src/lread-tests.el
+++ b/test/src/lread-tests.el
@@ -195,9 +195,7 @@ literals (Bug#20852)."
195 (should (eq x (cdr x))))) 195 (should (eq x (cdr x)))))
196 196
197(ert-deftest lread-long-hex-integer () 197(ert-deftest lread-long-hex-integer ()
198 (should-error 198 (should (bignump (read "#xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"))))
199 (read "#xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
200 :type 'overflow-error))
201 199
202(ert-deftest lread-test-bug-31186 () 200(ert-deftest lread-test-bug-31186 ()
203 (with-temp-buffer 201 (with-temp-buffer
diff --git a/test/src/print-tests.el b/test/src/print-tests.el
index c96cb5d2b69..091f1aa1afb 100644
--- a/test/src/print-tests.el
+++ b/test/src/print-tests.el
@@ -98,5 +98,11 @@ otherwise, use a different charset."
98 (let ((sym '\’bar)) 98 (let ((sym '\’bar))
99 (should (eq (read (prin1-to-string sym)) sym)))) 99 (should (eq (read (prin1-to-string sym)) sym))))
100 100
101(ert-deftest print-bignum ()
102 (let* ((str "999999999999999999999999999999999")
103 (val (read str)))
104 (should (> val most-positive-fixnum))
105 (should (equal (prin1-to-string val) str))))
106
101(provide 'print-tests) 107(provide 'print-tests)
102;;; print-tests.el ends here 108;;; print-tests.el ends here