mirror of
git://git.code.sf.net/p/sbcl/sbcl
synced 2026-09-10 07:26:40 -04:00
Most build systems distinguish a failed build from a failed test run, but make.sh has a hard time doing that because of the conflation of the two. The whole regression suite should be run if you want to ensure a good build, so that would be a good time to test contribs. Not only that, with ASDF we obscured a ton of style-warnings, we lost sandboxing of input files, the ability to use --evaluator-mode, automatic generation and cleanup of scratch pathnames, and automatic sb-sprof profiling. So convert contrib tests to use WITH-TEST except some that gave me trouble. This makes the output a ton more readable, and makes bisection on seldom-used configurations quicker, not to mention that SB-RT is very lame anyway. And there is quite literally less code to maintain now. Go figure.
57 lines
1.7 KiB
Common Lisp
57 lines
1.7 KiB
Common Lisp
;;; FIXME: how are these testing anything???
|
|
|
|
(defun sample ()
|
|
(let ((sb-mpfr:*mpfr-rnd* :MPFR_RNDD))
|
|
(sb-mpfr:with-precision 200
|
|
(let ((u (sb-mpfr:coerce 1.0d0 'sb-mpfr:mpfr-float)))
|
|
(loop for i from 1 to 100
|
|
for v = u then (sb-mpfr:mul v i :MPFR_RNDU)
|
|
collect (sb-mpfr:div u v)
|
|
into vals
|
|
finally (return (sb-mpfr:sum (cons u vals))))))))
|
|
|
|
(defun sample2 ()
|
|
(let ((sb-mpfr:*mpfr-rnd* :MPFR_RNDD))
|
|
(sb-mpfr:with-precision 200
|
|
(let* ((u (sb-mpfr:coerce 1.0d0 'sb-mpfr:mpfr-float))
|
|
(s u))
|
|
(loop for i from 1 to 100
|
|
for v = u then (sb-mpfr:mul v i :MPFR_RNDU)
|
|
do (setf s (sb-mpfr:add s (sb-mpfr:div u v)))
|
|
finally (return s))))))
|
|
|
|
(defun sample-pi ()
|
|
(sb-mpfr:set-precision 400)
|
|
(sb-mpfr:const-pi))
|
|
|
|
|
|
;;; Test that (sb-mpfr:coerce * 'rational) works
|
|
|
|
(defvar *roundtrip-precision* 100)
|
|
|
|
(defun rational-roundtrip (rat)
|
|
(sb-mpfr:with-precision *roundtrip-precision*
|
|
(let* ((f (sb-mpfr:coerce rat 'sb-mpfr:mpfr-float))
|
|
(frat (sb-mpfr:coerce f 'rational)))
|
|
frat)))
|
|
|
|
(macrolet ((%write-out-idempotence-tests (&rest rationals)
|
|
`(progn
|
|
,@(loop :for rat :in rationals
|
|
:collect
|
|
`(test-util:with-test
|
|
(:name ,(sb-int:keywordicate (format nil "TEST-RATIONALIZE-~A" rat)))
|
|
(assert (<= (abs (- ,rat (rational-roundtrip ,rat)))
|
|
(expt 2 (- *roundtrip-precision*)))))))))
|
|
|
|
(%write-out-idempotence-tests
|
|
1/2
|
|
1/4
|
|
1/8
|
|
1/16
|
|
(+ 1/2 1/4 1/8)
|
|
355/113
|
|
pi
|
|
(exp 1)
|
|
(sqrt 2)))
|