1 | ;-*- Mode: Lisp -*- |
---|

2 | ;;;; Author: Paul Dietz |
---|

3 | ;;;; Created: Wed Feb 11 19:19:02 2004 |
---|

4 | ;;;; Contains: Tests of ASINH |
---|

5 | |
---|

6 | (in-package :cl-test) |
---|

7 | |
---|

8 | (deftest asinh.1 |
---|

9 | (let ((result (asinh 0))) |
---|

10 | (or (eqlt result 0) |
---|

11 | (eqlt result 0.0))) |
---|

12 | t) |
---|

13 | |
---|

14 | (deftest asinh.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 (asinh zero)) |
---|

18 | (list zero)) |
---|

19 | collect type) |
---|

20 | nil) |
---|

21 | |
---|

22 | (deftest asinh.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 (asinh zero)) |
---|

26 | (list zero)) |
---|

27 | collect type) |
---|

28 | nil) |
---|

29 | |
---|

30 | (deftest asinh.4 |
---|

31 | (loop for den = (1+ (random 10000)) |
---|

32 | for num = (random (* 10 den)) |
---|

33 | for x = (/ num den) |
---|

34 | for rlist = (multiple-value-list (asinh 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 asinh.5 |
---|

43 | (loop for type in '(short-float single-float double-float long-float) |
---|

44 | nconc |
---|

45 | (loop |
---|

46 | for x = (- (random (coerce 20 type)) 10) |
---|

47 | for rlist = (multiple-value-list (asinh x)) |
---|

48 | for y = (car rlist) |
---|

49 | repeat 1000 |
---|

50 | unless (and (null (cdr rlist)) |
---|

51 | (typep y type)) |
---|

52 | collect (list x rlist))) |
---|

53 | nil) |
---|

54 | |
---|

55 | (deftest asinh.6 |
---|

56 | (loop for type in '(short-float single-float double-float long-float) |
---|

57 | nconc |
---|

58 | (loop |
---|

59 | for x1 = (- (random (coerce 20 type)) 10) |
---|

60 | for x2 = (- (random (coerce 20 type)) 10) |
---|

61 | for rlist = (multiple-value-list (asinh (complex x1 x2))) |
---|

62 | for y = (car rlist) |
---|

63 | repeat 1000 |
---|

64 | unless (and (null (cdr rlist)) |
---|

65 | (typep y `(complex ,type))) |
---|

66 | collect (list x1 x2 rlist))) |
---|

67 | nil) |
---|

68 | |
---|

69 | (deftest asinh.7 |
---|

70 | (macrolet ((%m (z) z)) (asinh (expand-in-current-env (%m 0.0)))) |
---|

71 | 0.0) |
---|

72 | |
---|

73 | ;;; FIXME |
---|

74 | ;;; Add accuracy tests here |
---|

75 | |
---|

76 | ;;; Error tests |
---|

77 | |
---|

78 | (deftest asinh.error.1 |
---|

79 | (signals-error (asinh) program-error) |
---|

80 | t) |
---|

81 | |
---|

82 | (deftest asinh.error.2 |
---|

83 | (signals-error (asinh 1.0 1.0) program-error) |
---|

84 | t) |
---|

85 | |
---|

86 | (deftest asinh.error.3 |
---|

87 | (check-type-error #'asinh #'numberp) |
---|

88 | nil) |
---|

89 | |
---|

90 | |
---|

91 | |
---|

92 | |
---|

93 | |
---|

94 | |
---|

95 | |
---|

96 | |
---|

97 | |
---|