;;;; unif.test --- tests guile's uniform arrays -*- scheme -*- ;;;; ;;;; Copyright 2003 Free Software Foundation, Inc. ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public ;;;; License as published by the Free Software Foundation; either ;;;; version 2.1 of the License, or (at your option) any later version. ;;;; ;;;; This library is distributed in the hope that it will be useful, ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;;;; Lesser General Public License for more details. ;;;; ;;;; You should have received a copy of the GNU Lesser General Public ;;;; License along with this library; if not, write to the Free Software ;;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (define-module (test-suite test-unif) #:use-module (test-suite lib) #:use-module (ice-9 documentation)) ;;; ;;; prototypes ;;; (with-test-prefix "prototypes" (with-test-prefix "make-uniform-vector" (pass-if "bool" (eq? #t (array-prototype (make-uniform-vector 1 #t)))) (pass-if "char" (char=? #\a (array-prototype (make-uniform-vector 1 #\a)))) (pass-if "byte" (char=? #\nul (array-prototype (make-uniform-vector 1 #\nul)))) (pass-if "short" (eq? 's (array-prototype (make-uniform-vector 1 's)))) (pass-if "ulong" (= 1 (array-prototype (make-uniform-vector 1 1)))) (pass-if "long" (= -1 (array-prototype (make-uniform-vector 1 -1)))) ;; FIXME: What's a good way to tell if long long is available? ;; (pass-if "long long" ;; (eq? 'l (array-prototype (make-uniform-vector 1 'l)))) (pass-if "float" (= 1.0 (array-prototype (make-uniform-vector 1 1.0)))) (with-test-prefix "double" (pass-if "no fill" (= 1/3 (array-prototype (make-uniform-vector 1 1/3)))) (pass-if "fill 1.0" (= 1/3 (array-prototype (make-uniform-vector 1 1/3 1.0))))) (pass-if "complex" (= 0+i (array-prototype (make-uniform-vector 1 0+i)))) (pass-if "scm" (eq? '() (array-prototype (make-uniform-vector 1 '()))))) (with-test-prefix "make-uniform-vector" (pass-if "bool" (eq? #t (array-prototype (make-uniform-array #t '(5 6))))) (pass-if "char" (char=? #\a (array-prototype (make-uniform-array #\a '(5 6))))) (pass-if "byte" (char=? #\nul (array-prototype (make-uniform-array #\nul '(5 6))))) (pass-if "short" (eq? 's (array-prototype (make-uniform-array 's '(5 6))))) (pass-if "ulong" (= 1 (array-prototype (make-uniform-array 1 '(5 6))))) (pass-if "long" (= -1 (array-prototype (make-uniform-array -1 '(5 6))))) ;; FIXME: What's a good way to tell if long long is available? ;; (pass-if "long long" ;; (eq? 'l (array-prototype (make-uniform-array 'l '(5 6))))) (pass-if "float" (= 1.0 (array-prototype (make-uniform-array 1.0 '(5 6))))) (pass-if "double" (= 1/3 (array-prototype (make-uniform-array 1/3 '(5 6))))) (pass-if "complex" (= 0+i (array-prototype (make-uniform-array 0+i '(5 6))))) (pass-if "scm" (eq? '() (array-prototype (make-uniform-array '( '(5 6))))))))