|
From: Raymond T. <rt...@us...> - 2012-03-09 06:24:26
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "matlisp".
The branch, master has been updated
via 035339c307401f593732418ecdba8fa6785b678d (commit)
from 068408a227df4427520decc0f10fe0a253a5cdbb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 035339c307401f593732418ecdba8fa6785b678d
Author: Raymond Toy <toy...@gm...>
Date: Thu Mar 8 22:24:08 2012 -0800
Add support for test-op. Requires RT.
Usage: (asdf:oos 'asdf:test-op :matlisp)
matlisp.asd:
o Add defsystem for running the tests and support infrastructure to
compile and run the tests.
tests/blas.lisp:
o Some simple tests for blas functions.
diff --git a/matlisp.asd b/matlisp.asd
index d9b4389..dc270d0 100644
--- a/matlisp.asd
+++ b/matlisp.asd
@@ -28,6 +28,11 @@
(in-package #:common-lisp-user)
+(defpackage #:matlisp-system
+ (:use #:cl :asdf))
+
+(in-package #:matlisp-system)
+
(asdf:defsystem matlisp-packages
:pathname #.(translate-logical-pathname "matlisp:srcdir;")
:components
@@ -294,3 +299,18 @@
:components
((:file "dlsode")))))
+(defmethod perform ((op asdf:test-op) (c (eql (asdf:find-system :matlisp))))
+ (oos 'asdf:test-op 'matlisp-tests))
+
+(asdf:defsystem matlisp-tests
+ :depends-on (matlisp)
+ :in-order-to ((compile-op (load-op :rt))
+ (test-op (load-op :rt :matlisp)))
+ :components
+ ((:module "tests"
+ :components
+ ((:file "blas")))))
+
+(defmethod perform ((op test-op) (c (eql (asdf:find-system :matlisp-tests))))
+ (or (funcall (intern "DO-TESTS" (find-package "RT")))
+ (error "TEST-OP failed for MATLISP-TESTS")))
diff --git a/tests/blas.lisp b/tests/blas.lisp
new file mode 100644
index 0000000..5995f24
--- /dev/null
+++ b/tests/blas.lisp
@@ -0,0 +1,39 @@
+(in-package #:matlisp-user)
+
+(asdf:oos 'asdf:load-op :rt)
+
+(defmethod max-matrix-diff ((actual standard-matrix) (expected standard-matrix) &key (allowed-error 0d0))
+ (let ((max-error (reduce #'max
+ (map 'list
+ #'(lambda (x y)
+ (abs (- x y)))
+ (matlisp::store actual)
+ (matlisp::store expected)))))
+ (if (<= max-error allowed-error)
+ t
+ (list max-error actual expected))))
+
+(rt:deftest blas.zdotu.1.1
+ (let ((x (make-array 3 :element-type '(complex double-float) :initial-contents '(#c(1d0 0) #c(2d0 0) #c(3d0 0)))))
+ (blas:zdotu 2 x 1 x 1))
+ #c(5d0 0d0))
+
+(rt:deftest blas.zdotu.1.2
+ (let ((x (make-array 3 :element-type '(complex double-float) :initial-contents '(#c(1d0 1d0) #c(2d0 2d0) #c(3d0 3d0)))))
+ (blas:zdotu 2 x 1 x 1))
+ #c(0d0 10d0))
+
+(rt:deftest blas.zdotc.1.1
+ (let ((x (make-array 3 :element-type '(complex double-float) :initial-contents '(#c(1d0 0) #c(2d0 0) #c(3d0 0)))))
+ (blas:zdotc 2 x 1 x 1))
+ #c(5d0 0d0))
+
+(rt:deftest blas.zdotc.1.2
+ (let ((x (make-array 3 :element-type '(complex double-float) :initial-contents '(#c(1d0 1d0) #c(2d0 2d0) #c(3d0 3d0)))))
+ (blas:zdotc 2 x 1 x 1))
+ #c(10d0 0d0))
+
+(rt:deftest blas.axpy.1
+ (let ((x [1 2 3]))
+ (max-matrix-diff (axpy 2 x x) [3 6 9]))
+ t)
-----------------------------------------------------------------------
Summary of changes:
matlisp.asd | 20 ++++++++++++++++++++
tests/blas.lisp | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 0 deletions(-)
create mode 100644 tests/blas.lisp
hooks/post-receive
--
matlisp
|