sbcl.sbcl/contrib/sb-posix/libc-tests.lisp
Douglas Katzman fbd46c52ea Run contrib tests with all other tests and not in make-target-contrib
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.
2022-09-01 21:17:47 -04:00

34 lines
1.2 KiB
Common Lisp

(in-package "SB-POSIX-TESTS")
(defparameter *tests* ; unicode strings (by default unless #-sb-unicode)
#("1.20203" "3.4400" "3240.2205" "10088.92" "12.3" "1000000000e-2"
"-323.5233243" "10001.993344e-8" "3985.1"))
(defparameter *decimal-point-character*
(loop for candidate in '(#\. #\,)
when (= (nth-value 1 (sb-posix:strtod "1.234")) 5)
return candidate))
(defun substitute-decimal-point (string)
(substitute *decimal-point-character* #\. string))
(deftest sb-libc.strtod.0
(or (not *decimal-point-character*)
(loop with *read-default-float-format* = 'double-float
for string across *tests*
do (assert (= (sb-posix:strtod (substitute-decimal-point string))
(read-from-string string)))
finally (return t)))
t)
(deftest sb-libc.strtod.1
(or (not *decimal-point-character*)
(loop with *read-default-float-format* = 'double-float
for string across *tests*
for simple-base-string = (coerce (substitute-decimal-point string)
'simple-base-string)
do (assert (= (sb-posix:strtod simple-base-string)
(read-from-string string)))
finally (return t)))
t)