diff --git a/ansi-tests/acos.lsp b/ansi-tests/acos.lsp new file mode 100644 index 0000000000000000000000000000000000000000..06751884ad9ec79a0fd6fc4f0dccaad9ca6b0d77 --- /dev/null +++ b/ansi-tests/acos.lsp @@ -0,0 +1,103 @@ +;-*- Mode: Lisp -*- +;;;; Author: Paul Dietz +;;;; Created: Tue Feb 10 05:39:24 2004 +;;;; Contains: Tess of ACOS + +(in-package :cl-test) + +(deftest acos.1 + (loop for i from -1000 to 1000 + for rlist = (multiple-value-list (acos i)) + for y = (car rlist) + always (and (null (cdr rlist)) + (numberp y))) + t) + +(deftest acos.2 + (loop for type in '(short-float single-float double-float long-float) + collect + (let ((a (coerce 2000 type)) + (b (coerce -1000 type))) + (loop for x = (- (random a) b) + for rlist = (multiple-value-list (acos x)) + for y = (car rlist) + repeat 1000 + always (and (null (cdr rlist)) + (numberp y))))) + (t t t t)) + +(deftest acos.3 + (loop for type in '(integer short-float single-float double-float long-float) + collect + (let ((a (coerce 2000 type)) + (b (coerce -1000 type))) + (loop for x = (- (random a) b) + for rlist = (multiple-value-list (acos (complex 0 x))) + for y = (car rlist) + repeat 1000 + always (and (null (cdr rlist)) + (numberp y))))) + (t t t t t)) + +(deftest acos.4 + (loop for type in '(integer short-float single-float double-float long-float) + collect + (let ((a (coerce 2000 type)) + (b (coerce -1000 type))) + (loop for x1 = (- (random a) b) + for x2 = (- (random a) b) + for rlist = (multiple-value-list (acos (complex x1 x2))) + for y = (car rlist) + repeat 1000 + always (and (null (cdr rlist)) + (numberp y))))) + (t t t t t)) + +(deftest acos.5 + (approx= (acos 0) (coerce (/ pi 2) 'single-float)) + t) + +(deftest acos.6 + (loop for type in '(single-float short-float double-float long-float) + unless (approx= (acos (coerce 0 type)) + (coerce (/ pi 2) type)) + collect type) + nil) + +(deftest acos.7 + (loop for type in '(single-float short-float double-float long-float) + unless (approx= (acos (coerce 1 type)) + (coerce 0 type)) + collect type) + nil) + +(deftest acos.8 + (loop for type in '(single-float short-float double-float long-float) + unless (approx= (acos (coerce -1 type)) + (coerce pi type)) + collect type) + nil) + +;;; FIXME +;;; Add accuracy tests + +;;; Error tests + +(deftest acos.error.1 + (signals-error (acos) program-error) + t) + +(deftest acos.error.2 + (signals-error (acos 0.0 0.0) program-error) + t) + +(deftest acos.error.3 + (loop for x in *mini-universe* + unless (or (numberp x) + (eval `(signals-error (acos ',x) type-error))) + collect x) + nil) + + + + diff --git a/ansi-tests/asin.lsp b/ansi-tests/asin.lsp new file mode 100644 index 0000000000000000000000000000000000000000..d81400ce9ce5086868271ff16125a3213fffc252 --- /dev/null +++ b/ansi-tests/asin.lsp @@ -0,0 +1,104 @@ +;-*- Mode: Lisp -*- +;;;; Author: Paul Dietz +;;;; Created: Wed Feb 11 05:59:43 2004 +;;;; Contains: Tests for ASIN + +(in-package :cl-test) + +(deftest asin.1 + (loop for i from -1000 to 1000 + for rlist = (multiple-value-list (asin i)) + for y = (car rlist) + always (and (null (cdr rlist)) + (numberp y))) + t) + +(deftest asin.2 + (loop for type in '(short-float single-float double-float long-float) + collect + (let ((a (coerce 2000 type)) + (b (coerce -1000 type))) + (loop for x = (- (random a) b) + for rlist = (multiple-value-list (asin x)) + for y = (car rlist) + repeat 1000 + always (and (null (cdr rlist)) + (numberp y))))) + (t t t t)) + +(deftest asin.3 + (loop for type in '(integer short-float single-float double-float long-float) + collect + (let ((a (coerce 2000 type)) + (b (coerce -1000 type))) + (loop for x = (- (random a) b) + for rlist = (multiple-value-list (asin (complex 0 x))) + for y = (car rlist) + repeat 1000 + always (and (null (cdr rlist)) + (numberp y))))) + (t t t t t)) + +(deftest asin.4 + (loop for type in '(integer short-float single-float double-float long-float) + collect + (let ((a (coerce 2000 type)) + (b (coerce -1000 type))) + (loop for x1 = (- (random a) b) + for x2 = (- (random a) b) + for rlist = (multiple-value-list (asin (complex x1 x2))) + for y = (car rlist) + repeat 1000 + always (and (null (cdr rlist)) + (numberp y))))) + (t t t t t)) + +(deftest asin.5 + (approx= (asin 1) (coerce (/ pi 2) 'single-float)) + t) + +(deftest asin.6 + (loop for type in '(single-float short-float double-float long-float) + unless (approx= (asin (coerce 1 type)) + (coerce (/ pi 2) type)) + collect type) + nil) + +(deftest asin.7 + (loop for type in '(single-float short-float double-float long-float) + unless (approx= (asin (coerce 0 type)) + (coerce 0 type)) + collect type) + nil) + +(deftest asin.8 + (loop for type in '(single-float short-float double-float long-float) + unless (approx= (asin (coerce -1 type)) + (coerce (/ pi -2) type)) + collect type) + nil) + +;;; FIXME +;;; Add accuracy tests + +;;; Error tests + +(deftest asin.error.1 + (signals-error (asin) program-error) + t) + +(deftest asin.error.2 + (signals-error (asin 0.0 0.0) program-error) + t) + +(deftest asin.error.3 + (loop for x in *mini-universe* + unless (or (numberp x) + (eval `(signals-error (asin ',x) type-error))) + collect x) + nil) + + + + + diff --git a/ansi-tests/atan.lsp b/ansi-tests/atan.lsp new file mode 100644 index 0000000000000000000000000000000000000000..a76edd7205e817544b8eca397ed02065e71a4da5 --- /dev/null +++ b/ansi-tests/atan.lsp @@ -0,0 +1,154 @@ +;-*- Mode: Lisp -*- +;;;; Author: Paul Dietz +;;;; Created: Wed Feb 11 06:01:55 2004 +;;;; Contains: Tests of ATAN + +(in-package :cl-test) + +(deftest atan.1 + (atan 0) + 0.0) + +(deftest atan.2 + (loop for type in '(short-float single-float double-float long-float) + for zero = (coerce 0 type) + unless (eql (atan zero) zero) + collect type) + nil) + +(deftest atan.3 + (loop for type in '(short-float single-float double-float long-float) + for zero = (coerce 0 type) + unless (eql (atan zero 0) zero) + collect type) + nil) + +(deftest atan.4 + (loop for type in '(short-float single-float double-float long-float) + for zero = (coerce 0 type) + unless (eql (atan 0 zero) zero) + collect type) + nil) + +(deftest atan.5 + (loop for type in '(short-float single-float double-float long-float) + for zero = (coerce 0 type) + unless (eql (atan zero zero) zero) + collect type) + nil) + +(deftest atan.6 + (loop for type in '(short-float single-float double-float long-float) + for a = (coerce 2000 type) + for b = (coerce -1000 type) + collect + (loop for x = (- (random a) b) + for rlist = (multiple-value-list (atan x)) + for y = (car rlist) + repeat 1000 + unless (and (null (cdr rlist)) + (typep y type)) + collect (list x rlist))) + (nil nil nil nil)) + +(deftest atan.7 + (loop for type in '(short-float single-float double-float long-float) + for a = (coerce 2000 type) + for b = (coerce -1000 type) + for zero = (coerce 0 type) + collect + (loop for x = (- (random a) b) + for rlist = (multiple-value-list (atan (complex x zero))) + for y = (car rlist) + repeat 1000 + unless (and (null (cdr rlist)) + (typep y `(complex ,type))) + collect (list x rlist))) + (nil nil nil nil)) + +(deftest atan.8 + (loop for type in '(short-float single-float double-float long-float) + for a = (coerce 2000 type) + for b = (coerce -1000 type) + for zero = (coerce 0 type) + collect + (loop for x = (- (random a) b) + for rlist = (multiple-value-list (atan (complex zero x))) + for y = (car rlist) + repeat 1000 + unless (and (null (cdr rlist)) + (typep y `(complex ,type))) + collect (list x rlist))) + (nil nil nil nil)) + +(deftest atan.9 + (loop for type in '(short-float single-float double-float long-float) + for a = (coerce 2000 type) + for b = (coerce -1000 type) + for zero = (coerce 0 type) + collect + (loop for x1 = (- (random a) b) + for x2 = (- (random a) b) + for rlist = (multiple-value-list (atan (complex x1 x2))) + for y = (car rlist) + repeat 1000 + unless (and (null (cdr rlist)) + (typep y `(complex ,type))) + collect (list x1 x2 rlist))) + (nil nil nil nil)) + +(deftest atan.10 + (approx= (atan 1) (coerce (/ pi 4) 'single-float)) + t) + +(deftest atan.11 + (loop for type in '(short-float single-float double-float long-float) + collect (approx= (atan (coerce 1 type)) (coerce (/ pi 4) type))) + (t t t t)) + +(deftest atan.12 + (approx= (atan -1) (coerce (/ pi -4) 'single-float)) + t) + +(deftest atan.13 + (loop for type in '(short-float single-float double-float long-float) + collect (approx= (atan (coerce -1 type)) (coerce (/ pi -4) type))) + (t t t t)) + +;;; FIXME +;;; More accuracy tests here + +;;; Error tests + +(deftest atan.error.1 + (signals-error (atan) program-error) + t) + +(deftest atan.error.2 + (signals-error (atan 1 1 1) program-error) + t) + +(deftest atan.error.3 + (loop for x in *mini-universe* + unless (or (numberp x) + (eval `(signals-error (atan ',x) type-error))) + collect x) + nil) + +(deftest atan.error.4 + (loop for x in *mini-universe* + unless (or (realp x) + (eval `(signals-error (atan ',x 1) type-error))) + collect x) + nil) + +(deftest atan.error.5 + (loop for x in *mini-universe* + unless (or (realp x) + (eval `(signals-error (atan 1 ',x) type-error))) + collect x) + nil) + + + + diff --git a/ansi-tests/load-numbers.lsp b/ansi-tests/load-numbers.lsp index b57b26da6de1185828bf0941bf37f3d5fe90ba5b..5bd109ab395ac943fd92759c980bad85038910c0 100644 --- a/ansi-tests/load-numbers.lsp +++ b/ansi-tests/load-numbers.lsp @@ -27,6 +27,9 @@ (load "sin.lsp") (load "cos.lsp") (load "tan.lsp") +(load "asin.lsp") +(load "acos.lsp") +(load "atan.lsp") (load "times.lsp") (load "plus.lsp")