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

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

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

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