source: trunk/source/tests/ansi-tests/asin.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:  Wed Feb 11 05:59:43 2004
4;;;; Contains: Tests for ASIN
5
6(in-package :cl-test)
7
8(deftest asin.1
9  (loop for i from -1000 to 1000
10        for rlist = (multiple-value-list (asin i))
11        for y = (car rlist)
12        always (and (null (cdr rlist))
13                    (numberp y)))
14  t)
15
16(deftest asin.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 (asin 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 asin.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 (asin (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 asin.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 (asin (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 asin.5
57  (approx= (asin 1) (coerce (/ pi 2) 'single-float))
58  t)
59
60(deftest asin.6
61  (loop for type in '(single-float short-float double-float long-float)
62        unless (approx= (asin (coerce 1 type))
63                        (coerce (/ pi 2) type))
64        collect type)
65  nil)
66
67(deftest asin.7
68  (loop for type in '(single-float short-float double-float long-float)
69        unless (approx= (asin (coerce 0 type))
70                        (coerce 0 type))
71        collect type)
72  nil)
73
74(deftest asin.8
75  (loop for type in '(single-float short-float double-float long-float)
76        unless (approx= (asin (coerce -1 type))
77                        (coerce (/ pi -2) type))
78        collect type)
79  nil)
80
81(deftest asin.9
82  (macrolet ((%m (z) z)) (asin (expand-in-current-env (%m 0.0))))
83  0.0)
84
85;;; FIXME
86;;; Add accuracy tests
87
88;;; Error tests
89
90(deftest asin.error.1
91  (signals-error (asin) program-error)
92  t)
93
94(deftest asin.error.2
95  (signals-error (asin 0.0 0.0) program-error)
96  t)
97
98(deftest asin.error.3
99  (check-type-error #'asin #'numberp)
100  nil)
101
102
103
104
105
Note: See TracBrowser for help on using the repository browser.