Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
antik
gsll
Commits
efcc519c
Commit
efcc519c
authored
Feb 10, 2014
by
Liam M. Healy
Browse files
Start GSL test conversion change to mimic GSL's test functions
parent
75b6667f
Changes
2
Hide whitespace changes
Inline
Side-by-side
test-unit/convert.lisp
View file @
efcc519c
;; Convert the GSL tests
;; Liam Healy 2010-05-22 13:03:53EDT convert.lisp
;; Time-stamp: <2014-0
1-21
1
6
:1
6:59
EST convert.lisp>
;; Time-stamp: <2014-0
2-09
1
7
:1
8:12
EST convert.lisp>
;; Copyright 2010, 2014 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
...
...
@@ -32,6 +32,34 @@
(
in-package
:gsl
)
(
defun
replace-function-name
(
string
)
"Replace the names of GSL functions with their GSLL equivalents."
(
cl-ppcre:regex-replace
;;"\\((\\w*)\\W*\\((.*\\))"
"(gsl_\\w*)\\W*\\((.*)\\)"
string
(
lambda
(
match
&rest
registers
)
(
declare
(
ignore
match
))
(
format
nil
"(~a ~a)"
(
symbol-name
(
gsl-lookup
(
first
registers
)))
(
second
registers
)))
:simple-calls
t
))
(
defun
convert-gsl-form
(
string
&optional
map-args
)
"Read the GSL form as a string and generate an equivalent CL form. The argument 'map-args is a list of numbers giving a permutation."
;; Future: could be lambdas to map the functions.
(
let
((
sexp
(
read-from-string
(
substitute
#\space
#\,
(
replace-function-name
string
)))))
(
if
permute-args
(
cons
(
first
sexp
)
(
mapcar
(
lambda
(
n
)
(
nth
n
(
rest
sexp
)))
map-args
))
sexp
)))
;;;;****************************************************************************
;;; [2014-02-09 Sun 13:07] OLD
;;; (princ (convert-gsl-test "(gsl_cdf_tdist_P, (0.001, 1.0), 5.00318309780080559e-1, TEST_TOL6)"))
;;; (ASSERT-TO-TOLERANCE (TDIST-P 0.001d0 1.0d0) 5.00318309780080559d-1 +TEST-TOL6+)
;;; (princ (convert-gsl-test "(s, gsl_sf_lngamma_e, (-0.1, &r), 2.368961332728788655 , TEST_TOL0, GSL_SUCCESS)" *sf-select*))
...
...
@@ -61,21 +89,6 @@
when
d
collect
(
nth
i
list
))
list
))
(
defun
replace-function-name
(
string
)
"Replace the names of GSL functions with their GSLL equivalents."
(
cl-ppcre:regex-replace
;;"\\((\\w*)\\W*\\((.*\\))"
"(gsl_\\w*)\\W*\\((.*)\\)"
string
(
lambda
(
match
&rest
registers
)
(
declare
(
ignore
match
))
(
format
nil
"(~a ~a)"
(
symbol-name
(
gsl-lookup
(
first
registers
)))
(
second
registers
)))
:simple-calls
t
))
(
defparameter
*float-parse-regex*
;; Based on advice given in
;; http://www.regular-expressions.info/floatingpoint.html
...
...
test-unit/gsl-tests.lisp
View file @
efcc519c
;; GSL defined tests
;; Liam Healy 2014-01-21 10:42:48EST gsl-tests.lisp
;; Time-stamp: <2014-0
1-21 16:14:55
EST gsl-tests.lisp>
;; Time-stamp: <2014-0
2-09 17:47:37
EST gsl-tests.lisp>
;; Copyright 2014 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
...
...
@@ -50,7 +50,8 @@
status
test-description
result
expected
)))))
;; TEST(gsl_cdf_beta_P, (0.0000000000000000e+00,1.3,2.7), 0.000000000000e+00, TEST_TOL6);
;;; TEST(gsl_cdf_beta_P, (0.0000000000000000e+00,1.3,2.7), 0.000000000000e+00, TEST_TOL6);
;;; (convert-gsl-form )
;; gsl-lookup("gsl_cdf_beta_P")
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment