Commit 26bb00af authored by pfdietz's avatar pfdietz

Updated the random torture tester. There is now a PRUNE-RESULTS function that...

Updated the random torture tester.  There is now a PRUNE-RESULTS function that reduces the size of the forms that fail testing.  Also, added more lisp forms to the random form generator.
parent 31097618
......@@ -2148,6 +2148,9 @@
*cl-standard-generic-function-symbols*
'(declare)))))
(defparameter *cl-function-or-accessor-symbols*
(append *cl-function-symbols* *cl-accessor-symbols*))
(defparameter *cl-non-variable-constant-symbols*
(set-difference
*cl-symbols*
......
......@@ -18,6 +18,24 @@
,@(loop for i from 0 for e in cases collect `(,i ,e))
(t (error "Can't happen?! (in random-case)~%")))))
(defmacro rcase (&body cases)
"Usage: (RCASE (<weight> <form>+)+), where <weight> is a positive real
indicating the relative probability of executing the associated implicit
progn."
(assert cases)
(let* ((weights (mapcar #'car cases))
(cumulative-weights (let ((sum 0))
(loop for w in weights collect (incf sum w))))
(total (car (last cumulative-weights)))
(r (gensym)))
(assert (every #'plusp weights))
`(let ((,r (random ,total)))
(cond
,@(loop for case in (butlast cases)
for cw in cumulative-weights
collect `((< ,r ,cw) ,@(cdr case)))
(t ,@(cdar (last cases)))))))
(defun random-nonnegative-real ()
(if (coin 3)
(random-case
......
This diff is collapsed.
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