Commit 00dfdb9f authored by pfdietz's avatar pfdietz

Test behavior of printer around powers of the base (and negatives thereof).

parent c611882f
......@@ -264,7 +264,59 @@
(concatenate 'string "#36r-" (make-string 200 :initial-element #\Z))
(*print-radix* t) (*print-base* 36))
(deftest print.integers.random
(deftest print.integers.base.various.1
(with-standard-io-syntax
(loop for b from 2 to 36
nconc
(let ((*print-base* b) (*read-base* b))
(loop for i from 1 to 100
for n = (expt b i)
for str = (with-output-to-string (s) (prin1 n s))
for result = (read-from-string str)
unless (= n result)
collect (list b i n str result)))))
nil)
(deftest print.integers.base.various.2
(with-standard-io-syntax
(loop for b from 2 to 36
nconc
(let ((*print-base* b) (*read-base* b))
(loop for i from 1 to 100
for n = (- (expt b i))
for str = (with-output-to-string (s) (prin1 n s))
for result = (read-from-string str)
unless (= n result)
collect (list b i n str result)))))
nil)
(deftest print.integers.base.various.3
(with-standard-io-syntax
(loop for b from 2 to 36
nconc
(let ((*print-base* b) (*read-base* b) (*print-radix* t))
(loop for i from 1 to 100
for n = (expt b i)
for str = (with-output-to-string (s) (prin1 n s))
for result = (read-from-string str)
unless (= n result)
collect (list b i n str result)))))
nil)
(deftest print.integers.base.various.4
(with-standard-io-syntax
(loop for b from 2 to 36
nconc
(let ((*print-base* b) (*read-base* b) (*print-radix* t))
(loop for i from 1 to 100
for n = (- (expt b i))
for str = (with-output-to-string (s) (prin1 n s))
for result = (read-from-string str)
unless (= n result)
collect (list b i n str result)))))
nil)
(deftest print.integers.random.1
(loop for i from 1 to 10000
for numbits = (random 40)
for bound = (ash 1 numbits)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment