@@ -86,4 +86,83 @@ Rebol [
86
86
87
87
===end-group===
88
88
89
+
90
+ ===start-group=== "union"
91
+
92
+ --test-- "u-1"
93
+ c1: charset "0123456789"
94
+ c2: charset [#"a" - #"z" ]
95
+ u: "make bitset! #{000000000000FFC0000000007FFFFFE0}"
96
+ --assert u = mold union c1 c2
97
+ --assert u = mold union c2 c1
98
+
99
+ --test-- "u-2"
100
+ nd: charset [not #"0" - #"9" ]
101
+ zero: charset #"0"
102
+ nd-zero: union nd zero
103
+ --assert not find nd #"0"
104
+ --assert not find nd #"1"
105
+ --assert find nd #"B"
106
+ --assert find nd #"}"
107
+
108
+ --test-- "u-3"
109
+ --assert find zero #"0"
110
+ --assert not find zero #"1"
111
+ --assert not find zero #"B"
112
+ --assert not find zero #"}"
113
+
114
+ --test-- "u-4"
115
+ --assert find nd-zero #"0"
116
+ --assert not find nd-zero #"1"
117
+ --assert find nd-zero #"B"
118
+ --assert find nd-zero #"}"
119
+
120
+ ===end-group===
121
+
122
+ ===start-group=== "and"
123
+
124
+ --test-- "and-1"
125
+ c1: charset "b"
126
+ c2: charset "1"
127
+ u: "make bitset! #{00000000000000}"
128
+ --assert u = mold c1 and c2
129
+ --assert u = mold c2 and c1
130
+
131
+ --test-- "and-2"
132
+ c1: charset "b"
133
+ c2: charset "1"
134
+ c3: complement c1
135
+ u: "make bitset! [not #{FFFFFFFFFFFFBF}]"
136
+ --assert u = mold c3 and c2
137
+ --assert u = mold c2 and c3
138
+ u: "make bitset! [not #{FFFFFFFFFFFFFFFFFFFFFFFFFF}]"
139
+ --assert u = mold c1 and c3
140
+ c4: complement c2
141
+ --assert "make bitset! #{FFFFFFFFFFFFBF}" = mold c3 and c4
142
+
143
+ ===end-group===
144
+
145
+ ===start-group=== "xor"
146
+
147
+ --test-- "xor-1"
148
+ c1: charset "b"
149
+ c2: charset "1"
150
+ u: "make bitset! #{00000000000040000000000020}"
151
+ --assert u = mold c1 xor c2
152
+ --assert u = mold c2 xor c1
153
+
154
+ --test-- "xor-2"
155
+ c1: charset "b"
156
+ c2: charset "1"
157
+ c3: complement c1
158
+ u: "make bitset! [not bits #{00000000000040000000000020}]"
159
+ --assert u = mold c3 xor c2
160
+ --assert u = mold c2 xor c3
161
+ u: "make bitset! [not bits #{00000000000000000000000000}]"
162
+ --assert u = mold c1 xor c3
163
+ c4: complement c2
164
+ --assert "make bitset! #{00000000000040FFFFFFFFFFDF}" = mold c3 xor c4
165
+
166
+ ===end-group===
167
+
89
168
~~~end-file~~~
0 commit comments