source: trunk/source/tests/ansi-tests/acos.lsp @ 8991

Last change on this file since 8991 was 8991, checked in by gz, 12 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size: 2.3 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Tue Feb 10 05:39:24 2004
4;;;; Contains: Tess of ACOS
5
6(in-package :cl-test)
7
8(deftest acos.1
9  (loop for i from -1000 to 1000
10        for rlist = (multiple-value-list (acos i))
11        for y = (car rlist)
12        always (and (null (cdr rlist))
13                    (numberp y)))
14  t)
15
16(deftest acos.2
17  (loop for type in '(short-float single-float double-float long-float)
18        collect
19        (let ((a (coerce 2000 type))
20              (b (coerce -1000 type)))
21          (loop for x = (- (random a) b)
22                for rlist = (multiple-value-list (acos x))
23                for y = (car rlist)
24                repeat 1000
25                always (and (null (cdr rlist))
26                            (numberp y)))))
27  (t t t t))
28
29(deftest acos.3
30  (loop for type in '(integer short-float single-float double-float long-float)
31        collect
32        (let ((a (coerce 2000 type))
33              (b (coerce -1000 type)))
34          (loop for x = (- (random a) b)
35                for rlist = (multiple-value-list (acos (complex 0 x)))
36                for y = (car rlist)
37                repeat 1000
38                always (and (null (cdr rlist))
39                            (numberp y)))))
40  (t t t t t))
41
42(deftest acos.4
43  (loop for type in '(integer short-float single-float double-float long-float)
44        collect
45        (let ((a (coerce 2000 type))
46              (b (coerce -1000 type)))
47          (loop for x1 = (- (random a) b)
48                for x2 = (- (random a) b)
49                for rlist = (multiple-value-list (acos (complex x1 x2)))
50                for y = (car rlist)
51                repeat 1000
52                always (and (null (cdr rlist))
53                            (numberp y)))))
54  (t t t t t))
55
56(deftest acos.5
57  (approx= (acos 0) (coerce (/ pi 2) 'single-float))
58  t)
59
60(deftest acos.6
61  (loop for type in '(single-float short-float double-float long-float)
62        unless (approx= (acos (coerce 0 type))
63                        (coerce (/ pi 2) type))
64        collect type)
65  nil)
66
67(deftest acos.7
68  (loop for type in '(single-float short-float double-float long-float)
69        unless (approx= (acos (coerce 1 type))
70                        (coerce 0 type))
71        collect type)
72  nil)
73
74(deftest acos.8
75  (loop for type in '(single-float short-float double-float long-float)
76        unless (approx= (acos (coerce -1 type))
77                        (coerce pi type))
78        collect type)
79  nil)
80
81(deftest acos.9
82  (macrolet ((%m (z) z)) (not (not (> (acos (expand-in-current-env (%m 0))) 0))))
83  t)
84
85;;; FIXME
86;;; Add accuracy tests
87
88;;; Error tests
89
90(deftest acos.error.1
91  (signals-error (acos) program-error)
92  t)
93
94(deftest acos.error.2
95  (signals-error (acos 0.0 0.0) program-error)
96  t)
97
98(deftest acos.error.3
99  (check-type-error #'acos #'numberp)
100  nil)
Note: See TracBrowser for help on using the repository browser.