Debian Codegraph @

internal/lexer/items/disjunctrangeset_test.go

raw symbols SCIP
1 //Copyright 2013 Vastech SA (PTY) LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 package itemsscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/
16
17 import (
18 // "fmt"
19 "testingscip-go gomod github.com/golang/go/src go1.24 testing/"
20
21 "github.com/goccmack/gocc/internal/astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/"
22 // "unicode"
23 )
24
25 /*
26 ABCDEF GHIJKL MNOPQR STUVWX YZ
27 */
28 func TestDisjunctSets0scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets0().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
29 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
30 data := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
31 {'A', 'F'},
32 {'G', 'L'},
33 {'M', 'R'},
34 {'S', 'X'},
35 {'Y', 'Z'},
36 }
37
38 for _, i := range []int{2, 1, 0, 4, 3} {
39 set.AddRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#AddRange().(data[i].Fromscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#From., data[i].Toscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#To.)
40 }
41
42 if list := set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().(); len(list) != 5 {
43 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(list) == %d", len(list))
44 }
45 }
46
47 /*
48 ABCDEF GHIJKL MNOPQR STUVWX YZ
49 |===========|
50 |-------| |===========| 1
51 |-----------+---|-------+ 2
52 |-----------+-----------| 3
53 |-----------+-----------+---| 4
54 |---|-------+ 5
55 |===========| 6
56 |-----------+---| 7
57 +===========+ |----| 8
58 +---|----|--+ 9
59 +---|-------| 10
60 +---|-------+---| 11
61 */
62
63 /*
64 ABCDEF MNOPQR
65
66 |===========|
67
68 |-------| |===========| 1
69 */
70 func TestDisjunctSets1scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets1().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
71 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
72 data := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
73 {'A', 'F'},
74 {'M', 'R'},
75 }
76 set.addRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#addRange().(data[1], data[0])
77 rng := set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().()
78 if len(rng) != 2 {
79 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(rng) == %d", len(rng))
80 }
81 for i, rng := range set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().() {
82 if !data[i].Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#Equal().(rng) {
83 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("set[%d]==%s, expected %s", i, rng.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().(), data[i].Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().())
84 }
85 }
86 }
87
88 /*
89 ABCDEF MNOPQR
90
91 |===========|
92
93 |-----------+---|-------+ 2
94 */
95 func TestDisjunctSets2scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets2().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
96 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
97 input := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
98 {'M', 'R'},
99 {'A', 'O'},
100 }
101 check := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
102 {'A', 'L'},
103 {'M', 'O'},
104 {'P', 'R'},
105 }
106 set.addRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#addRange().(input...)
107 ranges := set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().()
108 if len(ranges) != len(check) {
109 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(rng) == %d", len(ranges))
110 }
111 for i, rng := range ranges {
112 if !check[i].Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#Equal().(rng) {
113 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("set[%d]==%s, expected %s", i, rng.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().(), check[i].Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().())
114 }
115 }
116 }
117
118 /*
119 ABCDEF GHIJKL
120
121 |===========|
122
123 |-----------+-----------| 3
124 */
125 func TestDisjunctSets3scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets3().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
126 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
127 input := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
128 {'G', 'L'},
129 {'A', 'F'},
130 }
131 check := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
132 {'A', 'F'},
133 {'G', 'L'},
134 }
135 set.addRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#addRange().(input...)
136 ranges := set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().()
137 if len(ranges) != len(check) {
138 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(rng) == %d", len(ranges))
139 }
140 for i, rng := range ranges {
141 if !check[i].Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#Equal().(rng) {
142 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("set[%d]==%s, expected %s", i, rng.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().(), check[i].Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().())
143 }
144 }
145 }
146
147 /*
148 ABCDEF GHIJKL MNOPQR STUVWX YZ
149
150 |===========|
151
152 |-----------+-----------+---| 4
153 */
154 func TestDisjunctSets4scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets4().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
155 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
156 input := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
157 {'G', 'L'},
158 {'A', 'R'},
159 }
160 check := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
161 {'A', 'F'},
162 {'G', 'L'},
163 {'M', 'R'},
164 }
165 set.addRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#addRange().(input...)
166 ranges := set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().()
167 if len(ranges) != len(check) {
168 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(rng) == %d", len(ranges))
169 }
170 for i, rng := range ranges {
171 if !check[i].Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#Equal().(rng) {
172 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("set[%d]==%s, expected %s", i, rng.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().(), check[i].Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().())
173 }
174 }
175 }
176
177 /*
178 ABCDEF GHIJKL MNOPQR STUVWX YZ
179
180 |===========|
181 |---|-------+ 5
182 */
183 func TestDisjunctSets5scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets5().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
184 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
185 input := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
186 {'G', 'L'},
187 {'G', 'I'},
188 }
189 check := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
190 {'G', 'I'},
191 {'J', 'L'},
192 }
193 set.addRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#addRange().(input...)
194 ranges := set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().()
195 if len(ranges) != len(check) {
196 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(rng) == %d", len(ranges))
197 }
198 for i, rng := range ranges {
199 if !check[i].Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#Equal().(rng) {
200 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("set[%d]==%s, expected %s", i, rng.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().(), check[i].Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().())
201 }
202 }
203 }
204
205 /*
206 ABCDEF GHIJKL MNOPQR STUVWX YZ
207
208 |===========|
209 |===========| 6
210 */
211 func TestDisjunctSets6scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets6().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
212 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
213 input := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
214 {'G', 'L'},
215 {'G', 'L'},
216 }
217 check := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
218 {'G', 'L'},
219 }
220 set.addRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#addRange().(input...)
221 ranges := set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().()
222 if len(ranges) != len(check) {
223 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(rng) == %d", len(ranges))
224 }
225 for i, rng := range ranges {
226 if !check[i].Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#Equal().(rng) {
227 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("set[%d]==%s, expected %s", i, rng.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().(), check[i].Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().())
228 }
229 }
230 }
231
232 /*
233 ABCDEF GHIJKL MNOPQR STUVWX YZ
234
235 |===========|
236 |-----------+---| 7
237 */
238 func TestDisjunctSets7scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets7().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
239 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
240 input := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
241 {'G', 'L'},
242 {'G', 'O'},
243 }
244 check := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
245 {'G', 'L'},
246 {'M', 'O'},
247 }
248 set.addRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#addRange().(input...)
249 ranges := set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().()
250 if len(ranges) != len(check) {
251 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(rng) == %d", len(ranges))
252 }
253 for i, rng := range ranges {
254 if !check[i].Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#Equal().(rng) {
255 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("set[%d]==%s, expected %s", i, rng.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().(), check[i].Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().())
256 }
257 }
258 }
259
260 /*
261 ABCDEF GHIJKL MNOPQR STUVWX YZ
262
263 |===========|
264 +===========+ |----| 8
265 */
266 func TestDisjunctSets8scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets8().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
267 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
268 input := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
269 {'G', 'L'},
270 {'S', 'X'},
271 }
272 check := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
273 {'G', 'L'},
274 {'S', 'X'},
275 }
276 set.addRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#addRange().(input...)
277 ranges := set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().()
278 if len(ranges) != len(check) {
279 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(rng) == %d", len(ranges))
280 }
281 for i, rng := range ranges {
282 if !check[i].Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#Equal().(rng) {
283 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("set[%d]==%s, expected %s", i, rng.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().(), check[i].Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().())
284 }
285 }
286 }
287
288 /*
289 ABCDEF GHIJKL MNOPQR STUVWX YZ
290
291 |===========|
292 +---|----|--+ 9
293 */
294 func TestDisjunctSets9scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets9().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
295 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
296 input := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
297 {'G', 'R'},
298 {'J', 'O'},
299 }
300 check := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
301 {'G', 'I'},
302 {'J', 'O'},
303 {'P', 'R'},
304 }
305 set.addRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#addRange().(input...)
306 ranges := set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().()
307 if len(ranges) != len(check) {
308 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(rng) == %d", len(ranges))
309 }
310 for i, rng := range ranges {
311 if !check[i].Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#Equal().(rng) {
312 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("set[%d]==%s, expected %s", i, rng.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().(), check[i].Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().())
313 }
314 }
315 }
316
317 /*
318 ABCDEF GHIJKL MNOPQR STUVWX YZ
319
320 |===========|
321 +---|-------| 10
322 */
323 func TestDisjunctSets10scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets10().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
324 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
325 input := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
326 {'G', 'R'},
327 {'M', 'R'},
328 }
329 check := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
330 {'G', 'L'},
331 {'M', 'R'},
332 }
333 set.addRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#addRange().(input...)
334 ranges := set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().()
335 if len(ranges) != len(check) {
336 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(rng) == %d", len(ranges))
337 }
338 for i, rng := range ranges {
339 if !check[i].Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#Equal().(rng) {
340 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("set[%d]==%s, expected %s", i, rng.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().(), check[i].Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().())
341 }
342 }
343 }
344
345 /*
346 ABCDEF GHIJKL MNOPQR STUVWX YZ
347
348 |===========|
349 +---|-------+---| 11
350 */
351 func TestDisjunctSets11scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets11().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
352 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
353 input := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
354 {'G', 'L'},
355 {'J', 'R'},
356 }
357 check := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
358 {'G', 'I'},
359 {'J', 'L'},
360 {'M', 'R'},
361 }
362 set.addRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#addRange().(input...)
363 ranges := set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().()
364 if len(ranges) != len(check) {
365 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(rng) == %d", len(ranges))
366 }
367 for i, rng := range ranges {
368 if !check[i].Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#Equal().(rng) {
369 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("set[%d]==%s, expected %s", i, rng.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().(), check[i].Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().())
370 }
371 }
372 }
373
374 /*
375 ABC DEF GHI JKL MNO PQR STUVWX YZ
376
377 |=======| |=======|
378
379 |---+-------+---+-----------+
380 */
381 func TestDisjunctSets12scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets12().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
382 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
383 input := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
384 {'D', 'F'},
385 {'J', 'L'},
386 {'A', 'O'},
387 }
388 check := []CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{
389 {'A', 'C'},
390 {'D', 'F'},
391 {'G', 'I'},
392 {'J', 'L'},
393 {'M', 'O'},
394 }
395 set.addRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#addRange().(input...)
396 ranges := set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().()
397 if len(ranges) != len(check) {
398 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(rng) == %d", len(ranges))
399 }
400 for i, rng := range ranges {
401 if !check[i].Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#Equal().(rng) {
402 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("set[%d]==%s, expected %s", i, rng.Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().(), check[i].Stringscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#String().())
403 }
404 }
405 }
406
407 func TestDisjunctSets13scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets13().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
408 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
409 sym := &astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexCharLitscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharLit#{
410 Valscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexCharLit#Val.: 'A',
411 }
412 set.AddLexTNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#AddLexTNode().(sym)
413 check := CharRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#{'A', 'A'}
414 ranges := set.Listscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#List().()
415 if len(ranges) != 1 {
416 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(rng) == %d", len(ranges))
417 }
418 if !ranges[0].Equalscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/CharRange#Equal().(check) {
419 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("range==%s, expected %s", ranges[0], check)
420 }
421 }
422
423 func TestDisjunctSets14scip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/TestDisjunctSets14().(t *testingscip-go gomod github.com/golang/go/src go1.24 testing/.Tscip-go gomod github.com/golang/go/src go1.24 testing/T#) {
424 set := NewDisjunctRangeSetscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/NewDisjunctRangeSet().()
425 set.AddRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#AddRange().('D', 'F')
426 set.AddRangescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#AddRange().('J', 'L')
427 set.AddLexTNodescip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#AddLexTNode().(astscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/.LexDOTscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/ast`/LexDOT.)
428 if len(set.setscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#set.) != 2 {
429 t.Fatalfscip-go gomod github.com/golang/go/src go1.24 testing/common#Fatalf().("len(set.set) == %d", len(set.setscip-go gomod github.com/goccmack/gocc . `github.com/goccmack/gocc/internal/lexer/items`/DisjunctRangeSet#set.))
430 }
431 }