-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbit-vector.lsp
121 lines (91 loc) · 2.2 KB
/
bit-vector.lsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
;-*- Mode: Lisp -*-
;;;; Author: Paul Dietz
;;;; Created: Sun Jan 26 13:03:22 2003
;;;; Contains: Tests of type BIT-VECTOR
(in-package :cl-test)
(deftest bit-vector.1
(notnot-mv (find-class 'bit-vector))
t)
(deftest bit-vector.2
(notnot-mv (typep #* 'bit-vector))
t)
(deftest bit-vector.3
(notnot-mv (typep #*00101 'bit-vector))
t)
(deftest bit-vector.4
(typep #(0 1 1 1 0 0) 'bit-vector)
nil)
(deftest bit-vector.5
(typep "011100" 'bit-vector)
nil)
(deftest bit-vector.6
(typep 0 'bit-vector)
nil)
(deftest bit-vector.7
(typep 1 'bit-vector)
nil)
(deftest bit-vector.8
(typep nil 'bit-vector)
nil)
(deftest bit-vector.9
(typep 'x 'bit-vector)
nil)
(deftest bit-vector.10
(typep '(0 1 1 0) 'bit-vector)
nil)
(deftest bit-vector.11
(typep (make-array '(2 2) :element-type 'bit
:initial-element 0)
'bit-vector)
nil)
(deftest bit-vector.12
(notnot-mv (typep #* '(bit-vector *)))
t)
(deftest bit-vector.13
(notnot-mv (typep #*01101 '(bit-vector *)))
t)
(deftest bit-vector.14
(notnot-mv (typep #* '(bit-vector 0)))
t)
(deftest bit-vector.15
(typep #*01101 '(bit-vector 0))
nil)
(deftest bit-vector.16
(typep #* '(bit-vector 5))
nil)
(deftest bit-vector.17
(notnot-mv (typep #*01101 '(bit-vector 5)))
t)
;;; Tests of typep on the class named bit-vector
(deftest bit-vector.class.2
(notnot-mv (typep #* (find-class 'bit-vector)))
t)
(deftest bit-vector.class.3
(notnot-mv (typep #*00101 (find-class 'bit-vector)))
t)
(deftest bit-vector.class.4
(typep #(0 1 1 1 0 0) (find-class 'bit-vector))
nil)
(deftest bit-vector.class.5
(typep "011100" (find-class 'bit-vector))
nil)
(deftest bit-vector.class.6
(typep 0 (find-class 'bit-vector))
nil)
(deftest bit-vector.class.7
(typep 1 (find-class 'bit-vector))
nil)
(deftest bit-vector.class.8
(typep nil (find-class 'bit-vector))
nil)
(deftest bit-vector.class.9
(typep 'x (find-class 'bit-vector))
nil)
(deftest bit-vector.class.10
(typep '(0 1 1 0) (find-class 'bit-vector))
nil)
(deftest bit-vector.class.11
(typep (make-array '(2 2) :element-type 'bit
:initial-element 0)
(find-class 'bit-vector))
nil)