Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
ansi-test
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michał Herda
ansi-test
Commits
94ef088b
Commit
94ef088b
authored
21 years ago
by
pfdietz
Browse files
Options
Downloads
Patches
Plain Diff
Added tests for asin, acos, atan.
parent
1b4c3c8e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ansi-tests/acos.lsp
+103
-0
103 additions, 0 deletions
ansi-tests/acos.lsp
ansi-tests/asin.lsp
+104
-0
104 additions, 0 deletions
ansi-tests/asin.lsp
ansi-tests/atan.lsp
+154
-0
154 additions, 0 deletions
ansi-tests/atan.lsp
ansi-tests/load-numbers.lsp
+3
-0
3 additions, 0 deletions
ansi-tests/load-numbers.lsp
with
364 additions
and
0 deletions
ansi-tests/acos.lsp
0 → 100644
+
103
−
0
View file @
94ef088b
;-*- 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)
This diff is collapsed.
Click to expand it.
ansi-tests/asin.lsp
0 → 100644
+
104
−
0
View file @
94ef088b
;-*- 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)
This diff is collapsed.
Click to expand it.
ansi-tests/atan.lsp
0 → 100644
+
154
−
0
View file @
94ef088b
;-*- 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)
This diff is collapsed.
Click to expand it.
ansi-tests/load-numbers.lsp
+
3
−
0
View file @
94ef088b
...
@@ -27,6 +27,9 @@
...
@@ -27,6 +27,9 @@
(load "sin.lsp")
(load "sin.lsp")
(load "cos.lsp")
(load "cos.lsp")
(load "tan.lsp")
(load "tan.lsp")
(load "asin.lsp")
(load "acos.lsp")
(load "atan.lsp")
(load "times.lsp")
(load "times.lsp")
(load "plus.lsp")
(load "plus.lsp")
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment