Commit db745584 authored by pfdietz's avatar pfdietz

More cons printing tests (with circularity)

parent d8b91d3c
......@@ -59,6 +59,22 @@
10)
nil)
;; random circular cons graphs
(deftest print.cons.random.2
(loop repeat 50
nconc
(let* ((n 50)
(conses (apply #'vector
(loop repeat n collect (cons nil nil)))))
(loop for x across conses
for j = (random n)
for k = (random n)
do (setf (car x) (elt conses j)
(cdr x) (elt conses k)))
(randomly-check-readability (elt conses 0) :test #'is-similar
:circle t)))
nil)
;;; Printing with *print-length*
(deftest print.cons.length.1
......@@ -136,4 +152,6 @@
(write-to-string '(#(a) #*1101 "abc")
:case :downcase :level 1
:readably nil :pretty nil))
"(# #*1101 \"abc\")")
\ No newline at end of file
"(# #*1101 \"abc\")")
......@@ -26,6 +26,7 @@
(can-fail nil)
(test #'equal)
(readable t)
(circle nil circle-p)
(escape nil escape-p)
(gensym nil gensym-p))
(declare (type function test))
......@@ -35,7 +36,7 @@
(*print-base* (+ 2 (random 34)))
(*print-radix* (coin))
(*print-case* (random-from-seq #(:upcase :downcase :capitalize)))
(*print-circle* (coin))
(*print-circle* (if circle-p circle (coin)))
(*print-escape* (if escape-p escape (coin)))
(*print-gensym* (if gensym-p gensym (coin)))
(*print-level* (random 50))
......
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