diff --git a/gsll.asd b/gsll.asd index 13c0a37c0fa37aa93d3acd6e9d2cfe6379da8d03..c0ec10fd3581e64ca9c3ad2fa2915708e9c8954f 100644 --- a/gsll.asd +++ b/gsll.asd @@ -1,6 +1,6 @@ ;; Definition of GSLL system ;; Liam Healy -;; Time-stamp: <2010-04-17 18:47:14EDT gsll.asd> +;; Time-stamp: <2010-05-25 11:54:09EDT gsll.asd> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -160,7 +160,7 @@ ((:file "rng-types") (:file "generators" :depends-on ("rng-types")) (:file "quasi" :depends-on ("rng-types" "generators")) - (:file "tests") + (:file "tests" :depends-on ("rng-types")) (:file "gaussian" :depends-on ("rng-types")) (:file "gaussian-tail" :depends-on ("rng-types")) (:file "gaussian-bivariate" :depends-on ("rng-types")) diff --git a/test-unit/convert.lisp b/test-unit/convert.lisp index c71a0bb630e6fbd7c0dd234878b8a5b10056f8e8..3f2715db49f227eb3b7424b7bf1458ed358d6588 100644 --- a/test-unit/convert.lisp +++ b/test-unit/convert.lisp @@ -1,6 +1,6 @@ ;; Convert the GSL tests ;; Liam Healy 2010-05-22 13:03:53EDT convert.lisp -;; Time-stamp: <2010-05-25 23:15:21EDT convert.lisp> +;; Time-stamp: <2010-05-26 10:05:26EDT convert.lisp> ;;; This file is not normally loaded; it is only used to convert the ;;; GSL tests in C to CL tests. It requires cl-ppcre, lisp-util, and iterate. @@ -59,25 +59,21 @@ (second registers))) :simple-calls t)) +(defvar *float-parse-regex* + ;; Based on advice given in + ;; http://www.regular-expressions.info/floatingpoint.html + (cl-ppcre:parse-string "([-+]?[0-9]*\\.?[0-9]+)([eE][-+]?[0-9]+)?") + "A ppcre regular expression that matches a C floating point number.") + (defun translate-c-numbers (string) "Translate the literal numbers in the string to CL double-float." - (cl-ppcre:regex-replace-all ; Floats without exponents become double-floats - ;;"(\\.\\d*)\\s*(,|\\))" - "(\\+|\\-*\\d*\\.\\d*)($|[^0-9de.])" - (cl-ppcre:regex-replace-all ; Floats with "e" exponent become double-floats - "(\\+|\\-*\\d*\\.*\\d*)e(\\d*(\\+|\\-)*\\d*)" - string - "\"\\{1}d\\{2}\"") - "\"\\{1}d0\"\\{2}")) - -#| -;; http://www.regular-expressions.info/floatingpoint.html -;; need to exempt d from the first case -(cl-ppcre:regex-replace-all "([-+]?[0-9]*\\.?[0-9]+)" "-4.2134" "\\{1}d0") -(cl-ppcre:regex-replace-all "([-+]?[0-9]*\\.?[0-9]+)[eE](([-+]?[0-9]+)?)" - "1.213e4" - "\\{1}d\\{2}") -|# + (cl-ppcre:regex-replace-all + *float-parse-regex* + string + (lambda (match mant expon) + (declare (ignore match)) + (format nil "~ad~:[0~;~a~]" mant expon (when expon (subseq expon 1)))) + :simple-calls t)) (defun replace-tolerance (string) (cl-ppcre:regex-replace "TEST_(\\w*)" string "+TEST-\\{1}+"))