source: trunk/source/tests/ansi-tests/random-type-prop-tests-03.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: 8.0 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sun Mar  6 20:39:10 2005
4;;;; Contains:  Tests that invoke the random type prop infrastructure, part 3
5
6(in-package :cl-test)
7
8;;; trig, hyperbolic functions here
9
10;;; WARNING -- these tests may cause floating point overflow/underflow
11;;; Ignore those failures
12(def-type-prop-test *.1 '* '(integer integer) 2)
13(def-type-prop-test *.2 '* nil 1 :rest-type 'integer :maxargs 4)
14(def-type-prop-test *.3 '* nil 2 :rest-type 'integer :maxargs 10)
15(def-type-prop-test *.4 '* '(real real) 2  :test #'approx=)
16(def-type-prop-test *.5 '* '(number number) 2 :test #'approx=)
17
18(def-type-prop-test \+.1 '+ '(integer integer) 2)
19(def-type-prop-test \+.2 '+ nil 1 :rest-type 'integer :maxargs 4)
20(def-type-prop-test \+.3 '+ nil 2 :rest-type 'integer :maxargs 10)
21(def-type-prop-test \+.4 '+ '(real real) 2 :test #'approx=)
22(def-type-prop-test \+.5 '+ '(number number) 2 :test #'approx=)
23
24(def-type-prop-test \-.1 '- '(integer integer) 2)
25(def-type-prop-test \-.2 '- nil 1 :rest-type 'integer :maxargs 4)
26(def-type-prop-test \-.3 '- nil 2 :rest-type 'integer :maxargs 10)
27(def-type-prop-test \-.4 '- '(real real) 2 :test #'approx=)
28(def-type-prop-test \-.5 '- '(number number) 2 :test #'approx=)
29(def-type-prop-test \-.6 '- '(number) 1)
30
31;;; WARNING -- these tests may cause floating point overflow/underflow
32;;; Ignore those failures
33(def-type-prop-test /.1 '/ '((and integer (not (satisfies zerop)))) 1)
34(def-type-prop-test /.2 '/ '((and rational (not (satisfies zerop)))) 1)
35(def-type-prop-test /.3 '/ '((and real (not (satisfies zerop)))) 1 :ignore 'arithmetic-error)
36(def-type-prop-test /.4 '/ '((and complex (not (satisfies zerop)))) 1 :ignore 'arithmetic-error)
37(def-type-prop-test /.5 '/ '(integer) 2 :maxargs 6 :rest-type '(and integer (not (satisfies zerop))))
38(def-type-prop-test /.6 '/ '(rational) 2 :maxargs 6 :rest-type '(and rational (not (satisfies zerop))))
39(def-type-prop-test /.7 '/ '(real) 2 :maxargs 6 :rest-type '(and real (not (satisfies zerop)))
40 :test #'approx= :ignore 'arithmetic-error)
41(def-type-prop-test /.8 '/ '(number) 2 :maxargs 6 :rest-type '(and number (not (satisfies zerop)))
42  :test #'approx= :ignore 'arithmetic-error)
43
44(def-type-prop-test 1+.1 '1+ '(integer) 1)
45(def-type-prop-test 1+.2 '1+ '(rational) 1)
46(def-type-prop-test 1+.3 '1+ '(real) 1)
47(def-type-prop-test 1+.4 '1+ '(number) 1)
48
49(def-type-prop-test 1-.1 '1- '(integer) 1)
50(def-type-prop-test 1-.2 '1- '(rational) 1)
51(def-type-prop-test 1-.3 '1- '(real) 1)
52(def-type-prop-test 1-.4 '1- '(number) 1)
53
54(def-type-prop-test abs.1 'abs '(integer) 1)
55(def-type-prop-test abs.2 'abs '(rational) 1)
56(def-type-prop-test abs.3 'abs '(real) 1)
57(def-type-prop-test abs.4 'abs '(number) 1)
58
59(def-type-prop-test evenp 'evenp '(integer) 1)
60(def-type-prop-test oddp 'oddp '(integer) 1)
61
62;;; exp, expt here
63
64(def-type-prop-test gcd 'gcd nil 1 :maxargs 6 :rest-type 'integer)
65(def-type-prop-test lcm 'lcm nil 1 :maxargs 6 :rest-type 'integer)
66
67(def-type-prop-test log.1 'log '((and real (not (satisfies zerop)))) 1 :test #'approx=)
68(def-type-prop-test log.2 'log '((and number (not (satisfies zerop)))) 1 :test #'approx=)
69
70(def-type-prop-test mod.1 'mod '(integer (and integer (not (satisfies zerop)))) 2)
71(def-type-prop-test mod.2 'mod '(real (and real (not (satisfies zerop)))) 2 :test #'approx=)
72(def-type-prop-test rem.1 'rem '(integer (and integer (not (satisfies zerop)))) 2)
73(def-type-prop-test rem.2 'rem '(real (and real (not (satisfies zerop)))) 2 :test #'approx=)
74
75(def-type-prop-test signum.1 'signum '(integer) 1)
76(def-type-prop-test signum.2 'signum '(rational) 1)
77(def-type-prop-test signum.3 'signum '(real) 1)
78(def-type-prop-test signum.4 'signum '(number) 1)
79
80(def-type-prop-test sqrt.1 'sqrt '(integer) 1 :test #'approx=)
81(def-type-prop-test sqrt.2 'sqrt '(rational) 1 :test #'approx=)
82(def-type-prop-test sqrt.3 'sqrt '(real) 1 :test #'approx=)
83(def-type-prop-test sqrt.4 'sqrt '(number) 1 :test #'approx=)
84
85(def-type-prop-test isqrt 'isqrt '((integer 0)) 1)
86
87(def-type-prop-test numberp 'numberp '(t) 1)
88
89(def-type-prop-test complex.1 'complex '(integer) 1)
90(def-type-prop-test complex.2 'complex '(rational) 1)
91(def-type-prop-test complex.3 'complex '(real) 1)
92(def-type-prop-test complex.4 'complex '(rational rational) 2)
93(def-type-prop-test complex.5 'complex '(real real) 2)
94
95(def-type-prop-test complexp 'complexp '(t) 1)
96
97(def-type-prop-test conjugate 'conjugate '(number) 1)
98
99(def-type-prop-test phase.1 'phase '(real) 1)
100(def-type-prop-test phase.2 'phase '(number) 1 :test #'approx=)
101
102(def-type-prop-test realpart.1 'realpart '(real) 1)
103(def-type-prop-test realpart.2 'realpart '(number) 1)
104(def-type-prop-test imagpart.1 'imagpart '(real) 1)
105(def-type-prop-test imagpart.2 'imagpart '(number) 1)
106
107(def-type-prop-test realp 'realp '(t) 1)
108
109(def-type-prop-test numerator 'numerator '(rational) 1)
110(def-type-prop-test denominator 'denominator '(rational) 1)
111
112(def-type-prop-test rational 'rational '(real) 1)
113(def-type-prop-test rationalize 'rationalize '(real) 1)
114
115(def-type-prop-test rationalp 'rationalp '(t) 1)
116
117(def-type-prop-test ash.1 'ash '(integer (integer -32 32)) 2)
118(def-type-prop-test ash.2 'ash '(integer (integer -100 100)) 2)
119
120(def-type-prop-test integer-length 'integer-length '(integer) 1)
121(def-type-prop-test integerp 'integerp '(t) 1)
122
123(def-type-prop-test logand.1 'logand '(integer integer) 2)
124(def-type-prop-test logand.2 'logand nil 2 :rest-type 'integer :maxargs 6)
125
126(def-type-prop-test logandc1 'logandc1 '(integer integer) 2)
127(def-type-prop-test logandc2 'logandc2 '(integer integer) 2)
128
129(def-type-prop-test lognand 'lognand '(integer integer) 2)
130(def-type-prop-test lognor 'lognor '(integer integer) 2)
131
132(def-type-prop-test logeqv.1 'logeqv '(integer integer) 2)
133(def-type-prop-test logeqv.2 'logeqv nil 2 :rest-type 'integer :maxargs 6)
134
135(def-type-prop-test logior.1 'logior '(integer integer) 2)
136(def-type-prop-test logior.2 'logior nil 2 :rest-type 'integer :maxargs 6)
137
138(def-type-prop-test logxor.1 'logxor '(integer integer) 2)
139(def-type-prop-test logxor.2 'logxor nil 2 :rest-type 'integer :maxargs 6)
140
141(def-type-prop-test logorc1 'logorc1 '(integer integer) 2)
142(def-type-prop-test logorc2 'logorc2 '(integer integer) 2)
143
144(def-type-prop-test lognot 'lognot '(integer) 1)
145
146(def-type-prop-test logbitp.1 'logbitp '((integer 0 32) integer) 2)
147(def-type-prop-test logbitp.2 'logbitp '((integer 0 100) integer) 2)
148; (def-type-prop-test logbitp.3 'logbitp '((integer 0) integer) 2)
149
150(def-type-prop-test logcount 'logcount '(integer) 1)
151(def-type-prop-test logtest 'logtest '(integer integer) 2)
152
153(def-type-prop-test decode-float.1 'decode-float '(float) 1)
154(def-type-prop-test decode-float.2 '(lambda (x) (nth-value 1 (decode-float x))) '(float) 1)
155(def-type-prop-test decode-float.3 '(lambda (x) (nth-value 2 (decode-float x))) '(float) 1)
156(def-type-prop-test float-radix 'float-radix '(float) 1)
157(def-type-prop-test scale-float 'scale-float '(float (integer -30 30)) 2 :ignore 'arithmetic-error :test #'approx=)
158(def-type-prop-test float-sign.1 'float-sign '(float) 1)
159(def-type-prop-test float-sign.2 'float-sign '(float float) 2)
160(def-type-prop-test float-digits 'float-digits '(float) 1)
161(def-type-prop-test float-precision 'float-precision '(float) 1)
162(def-type-prop-test integer-decode-float.1 'integer-decode-float '(float) 1)
163(def-type-prop-test integer-decode-float.2 '(lambda (x) (nth-value 1 (integer-decode-float x))) '(float) 1)
164(def-type-prop-test integer-decode-float.3 '(lambda (x) (nth-value 2 (integer-decode-float x))) '(float) 1)
165
166
167(def-type-prop-test float.1 'float '(real) 1)
168(def-type-prop-test float.2 'float '(real float) 2)
169(def-type-prop-test floatp 'floatp '(t) 1)
170
171(defun has-nonzero-length (x) (> (length x) 0))
172
173(def-type-prop-test parse-integer.1 'parse-integer
174  '((and (vector (member #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9))
175         (satisfies has-nonzero-length)))
176  1)
177
178(def-type-prop-test parse-integer.2 'parse-integer
179  `((and (vector (member #\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9))
180         (satisfies has-nonzero-length))
181    (eql :start)
182    ,#'(lambda (x &rest rest) (declare (ignore rest))
183         `(integer 0 (,(length x)))))
184  3)
185
186(def-type-prop-test sxhash 'sxhash '(t) 1)
Note: See TracBrowser for help on using the repository browser.