1 | ;-*- Mode: Lisp -*- |
---|
2 | ;;;; Author: Paul Dietz |
---|
3 | ;;;; Contains: Random type prop tests, part 10 (sequences, cont.) |
---|
4 | |
---|
5 | (in-package :cl-test) |
---|
6 | |
---|
7 | ;;; SEARCH |
---|
8 | |
---|
9 | (def-type-prop-test search.1 'search |
---|
10 | (list 'sequence 'sequence) |
---|
11 | 2) |
---|
12 | |
---|
13 | (def-type-prop-test search.2 'search |
---|
14 | (list 'bit-vector 'bit-vector) |
---|
15 | 2) |
---|
16 | |
---|
17 | (def-type-prop-test search.3 'search |
---|
18 | (list '(vector * 1) 'sequence) |
---|
19 | 2) |
---|
20 | |
---|
21 | (def-type-prop-test search.4 'search |
---|
22 | (list '(vector * 2) 'sequence '(eql :from-end) '(or null t)) |
---|
23 | 4) |
---|
24 | |
---|
25 | (def-type-prop-test search.5 'search |
---|
26 | (list 'sequence 'sequence '(eql :key) |
---|
27 | (list 'member 'identity nil #'identity 'not #'not)) |
---|
28 | 4) |
---|
29 | |
---|
30 | (def-type-prop-test search.6 'search |
---|
31 | (list #'(lambda () (make-sequence-type |
---|
32 | (random 10) |
---|
33 | (let ((i1 (make-random-integer)) |
---|
34 | (i2 (make-random-integer))) |
---|
35 | `(integer ,(min i1 i2) ,(max i1 i2))))) |
---|
36 | #'(lambda (s) |
---|
37 | (declare (ignore s)) |
---|
38 | (make-sequence-type |
---|
39 | (random 10) |
---|
40 | (let ((i1 (make-random-integer)) |
---|
41 | (i2 (make-random-integer))) |
---|
42 | `(integer ,(min i1 i2) ,(max i1 i2)))))) |
---|
43 | 2) |
---|
44 | |
---|
45 | (def-type-prop-test search.7 'search |
---|
46 | (list #'(lambda () (make-sequence-type |
---|
47 | (random 10) |
---|
48 | (let ((i1 (make-random-integer)) |
---|
49 | (i2 (make-random-integer))) |
---|
50 | `(integer ,(min i1 i2) ,(max i1 i2))))) |
---|
51 | #'(lambda (s) |
---|
52 | (declare (ignore s)) |
---|
53 | (make-sequence-type |
---|
54 | (random 10) |
---|
55 | (let ((i1 (make-random-integer)) |
---|
56 | (i2 (make-random-integer))) |
---|
57 | `(integer ,(min i1 i2) ,(max i1 i2))))) |
---|
58 | '(eql :test) |
---|
59 | (list 'member 'eql #'eql 'equal #'equal '= #'= |
---|
60 | '/= #'/= #'(lambda (x y) (= (logand x 1) (logand y 1))))) |
---|
61 | 4) |
---|
62 | |
---|
63 | (def-type-prop-test search.8 'search |
---|
64 | (labels ((%random-char-type () (random-from-seq #(base-char standard-char character))) |
---|
65 | (%random-char-sequence-type (&rest ignored) |
---|
66 | (declare (ignore ignored)) |
---|
67 | (make-sequence-type (random 10) (%random-char-type)))) |
---|
68 | |
---|
69 | (list #'%random-char-sequence-type |
---|
70 | #'%random-char-sequence-type |
---|
71 | '(member :test :test-not) |
---|
72 | (let ((char-compare-funs |
---|
73 | '(char= char/= char< char> char<= char>= |
---|
74 | char-equal char-not-equal char-lessp char-greaterp |
---|
75 | char-not-lessp char-not-greaterp))) |
---|
76 | `(member ,@char-compare-funs |
---|
77 | ,@(mapcar #'symbol-function char-compare-funs))))) |
---|
78 | 4) |
---|
79 | |
---|
80 | (def-type-prop-test search.9 'search |
---|
81 | (list 'sequence 'sequence |
---|
82 | '(eql :start1) |
---|
83 | #'(lambda (s1 s2 k) |
---|
84 | (declare (ignore s2 k)) |
---|
85 | (let ((len (length s1))) |
---|
86 | `(integer 0 ,len)))) |
---|
87 | 4) |
---|
88 | |
---|
89 | (def-type-prop-test search.10 'search |
---|
90 | (list 'sequence 'sequence |
---|
91 | '(eql :end1) |
---|
92 | #'(lambda (s1 s2 k) |
---|
93 | (declare (ignore s2 k)) |
---|
94 | (let ((len (length s1))) |
---|
95 | `(integer 0 ,len)))) |
---|
96 | 4) |
---|
97 | |
---|
98 | (def-type-prop-test search.11 'search |
---|
99 | (list 'sequence 'sequence |
---|
100 | '(eql :start2) |
---|
101 | #'(lambda (s1 s2 k) |
---|
102 | (declare (ignore s1 k)) |
---|
103 | (let ((len (length s2))) |
---|
104 | `(integer 0 ,len)))) |
---|
105 | 4) |
---|
106 | |
---|
107 | (def-type-prop-test search.12 'search |
---|
108 | (list 'sequence 'sequence |
---|
109 | '(eql :end2) |
---|
110 | #'(lambda (s1 s2 k) |
---|
111 | (declare (ignore s1 k)) |
---|
112 | (let ((len (length s2))) |
---|
113 | `(integer 0 ,len)))) |
---|
114 | 4) |
---|