source: trunk/source/tests/ansi-tests/atanh.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.7 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Wed Feb 11 19:26:25 2004
4;;;; Contains: Tests of ATANH
5
6(in-package :cl-test)
7
8(deftest atanh.1
9  (let ((result (atanh 0)))
10    (or (eqlt result 0)
11        (eqlt result 0.0)))
12  t)
13
14(deftest atanh.2
15  (loop for type in '(short-float single-float double-float long-float)
16        for zero = (coerce 0 type)
17        unless (equal (multiple-value-list (atanh zero))
18                      (list zero))
19        collect type)
20  nil)
21
22(deftest atanh.3
23  (loop for type in '(short-float single-float double-float long-float)
24        for zero = (coerce 0 `(complex ,type))
25        unless (equal (multiple-value-list (atanh zero))
26                      (list zero))
27        collect type)
28  nil)
29
30(deftest atanh.4
31  (loop for den = (1+ (random 10000))
32        for num = (random den)
33        for x = (/ num den)
34        for rlist = (multiple-value-list (atanh x))
35        for y = (car rlist)
36        repeat 1000
37        unless (and (null (cdr rlist))
38                    (numberp y))
39        collect (list x rlist))
40  nil)
41
42(deftest atanh.5
43  (loop for type in '(short-float single-float double-float long-float)
44        nconc
45        (loop
46         for x = (if (eql (random 2) 0)
47                     (+ 2 (random (coerce 1000 type)))
48                   (- -2 (random (coerce 1000 type))))
49         for rlist = (multiple-value-list (atanh x))
50         for y = (car rlist)
51         repeat 1000
52         unless (and (null (cdr rlist))
53                     (typep y `(complex ,type)))
54         collect (list x rlist)))
55  nil)
56
57(deftest atanh.5a
58  (loop for type in '(short-float single-float double-float long-float)
59        nconc
60        (loop
61         for x = (- (random (coerce 1.9998s0 type)) 0.9999s0)
62         for rlist = (multiple-value-list (atanh x))
63         for y = (car rlist)
64         repeat 1000
65         unless (and (null (cdr rlist))
66                     (typep y type))
67         collect (list x rlist)))
68  nil)
69
70(deftest atanh.6
71  (loop for type in '(short-float single-float double-float long-float)
72        nconc
73        (loop
74         for x1 = (- (random (coerce 1.9998s0 type)) 0.9999s0)
75         for rlist = (multiple-value-list (atanh (complex x1 0.0s0)))
76         for y = (car rlist)
77         repeat 1000
78         unless (and (null (cdr rlist))
79                     (typep y `(complex ,type)))
80         collect (list x1 rlist)))
81  nil)
82
83(deftest atanh.7
84  (loop for type in '(short-float single-float double-float long-float)
85        nconc
86        (loop
87         for x1 = (- (random (coerce 1.9998s0 type)) 0.9999s0)
88         for rlist = (multiple-value-list (atanh (complex 0.0s0 x1)))
89         for y = (car rlist)
90         repeat 1000
91         unless (and (null (cdr rlist))
92                     (typep y `(complex ,type)))
93         collect (list x1 rlist)))
94  nil)
95
96(deftest atanh.8
97  (macrolet ((%m (z) z)) (atanh (expand-in-current-env (%m 0.0))))
98  0.0)
99
100
101;;; FIXME
102;;; Add accuracy tests here
103
104;;; Error tests
105
106(deftest atanh.error.1
107  (signals-error (atanh) program-error)
108  t)
109
110(deftest atanh.error.2
111  (signals-error (atanh 1.0 1.0) program-error)
112  t)
113
114(deftest atanh.error.3
115  (check-type-error #'atanh #'numberp)
116  nil)
Note: See TracBrowser for help on using the repository browser.