|
1 " |
|
2 stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE |
|
3 Copyright (C) 2013-2014 Jan Vrany |
|
4 |
|
5 This library is free software; you can redistribute it and/or |
|
6 modify it under the terms of the GNU Lesser General Public |
|
7 License as published by the Free Software Foundation; either |
|
8 version 2.1 of the License. |
|
9 |
|
10 This library is distributed in the hope that it will be useful, |
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
13 Lesser General Public License for more details. |
|
14 |
|
15 You should have received a copy of the GNU Lesser General Public |
|
16 License along with this library; if not, write to the Free Software |
|
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
18 " |
|
19 "{ Package: 'stx:goodies/smallsense' }" |
|
20 |
|
21 "{ NameSpace: SmallSense }" |
|
22 |
|
23 TestCase subclass:#RecognizerTests |
|
24 instanceVariableNames:'' |
|
25 classVariableNames:'' |
|
26 poolDictionaries:'' |
|
27 category:'SmallSense-Tests-Obsolete' |
|
28 ! |
|
29 |
|
30 !RecognizerTests class methodsFor:'documentation'! |
|
31 |
|
32 copyright |
|
33 " |
|
34 stx:goodies/smallsense - A productivity plugin for Smalltalk/X IDE |
|
35 Copyright (C) 2013-2014 Jan Vrany |
|
36 |
|
37 This library is free software; you can redistribute it and/or |
|
38 modify it under the terms of the GNU Lesser General Public |
|
39 License as published by the Free Software Foundation; either |
|
40 version 2.1 of the License. |
|
41 |
|
42 This library is distributed in the hope that it will be useful, |
|
43 but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
44 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
45 Lesser General Public License for more details. |
|
46 |
|
47 You should have received a copy of the GNU Lesser General Public |
|
48 License along with this library; if not, write to the Free Software |
|
49 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|
50 " |
|
51 ! ! |
|
52 |
|
53 !RecognizerTests methodsFor:'RecognizerTest'! |
|
54 |
|
55 testRecognizer1 |
|
56 |collector recognizer foundCollection| |
|
57 |
|
58 collector := self |
|
59 doForSource:' |
|
60 | ahoj| |
|
61 |
|
62 u := 3. |
|
63 b:=u. |
|
64 c:= u floor aa . |
|
65 d floor: u. |
|
66 d floor: 3 b:u. |
|
67 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
68 array := #(3 4 5 6 ). |
|
69 val := ConstantNode type:tokenType |
|
70 value:tokenValue. |
|
71 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
72 uu := 4. |
|
73 bb:=uu. |
|
74 cc:=uu floor. |
|
75 dd floor:uu. |
|
76 dd floor:3 b:uu. |
|
77 ]. |
|
78 dd do:[:w|w seduce. |
|
79 ] |
|
80 ^self. |
|
81 '. |
|
82 self assert:collector notNil. |
|
83 self assert:collector tree notNil. |
|
84 recognizer := SmallSenseRecognizer new. |
|
85 foundCollection := recognizer |
|
86 recognize:2 |
|
87 position:2 |
|
88 collector:collector. |
|
89 self assert:(foundCollection ~~ OrderedCollection). |
|
90 self assert:(foundCollection objectNameCollection size > 17). |
|
91 |
|
92 " self assert:(foundNode beforeNode). |
|
93 self assert:((foundNode line)=2). |
|
94 self assert:((foundNode position)=2). |
|
95 self assert:(foundNode statement isErrorNode). |
|
96 self assert:(foundNode statement errorToken =':='). |
|
97 self assert:(foundNode beforeStatement isNil)." |
|
98 |
|
99 "Created: / 04-03-2011 / 12:55:37 / Jakub <zelenja7@fel.cvut.cz>" |
|
100 "Modified: / 17-03-2011 / 18:45:41 / Jakub <zelenja7@fel.cvut.cz>" |
|
101 ! |
|
102 |
|
103 testRecognizer10 |
|
104 |collector recognizer foundCollection| |
|
105 |
|
106 collector := self |
|
107 doForSource:' |
|
108 | helper| |
|
109 c |
|
110 u := 3. |
|
111 b:=u. |
|
112 c:= u floor aa . |
|
113 d floor: u. |
|
114 d floor: 3 b:u. |
|
115 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
116 array := #(3 4 5 6 ). |
|
117 val := ConstantNode type:tokenType |
|
118 value:tokenValue. |
|
119 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
120 uu := 4. |
|
121 bb:=uu. |
|
122 cc:=uu floor. |
|
123 dd floor:uu. |
|
124 dd floor:3 b:uu. |
|
125 ]. |
|
126 dd do:[:w|w seduce. |
|
127 ] |
|
128 ^self. |
|
129 '. |
|
130 self assert:collector notNil. |
|
131 self assert:collector tree notNil. |
|
132 recognizer := SmallSenseRecognizer new. |
|
133 foundCollection := recognizer |
|
134 recognize:3 |
|
135 position:7 |
|
136 collector:collector. |
|
137 self assert:(foundCollection ~~ OrderedCollection). |
|
138 self assert:(foundCollection objectNameCollection size > 18). |
|
139 |
|
140 " self assert:(foundNode beforeNode). |
|
141 self assert:((foundNode line)=2). |
|
142 self assert:((foundNode position)=2). |
|
143 self assert:(foundNode statement isErrorNode). |
|
144 self assert:(foundNode statement errorToken =':='). |
|
145 self assert:(foundNode beforeStatement isNil)." |
|
146 |
|
147 "Created: / 07-03-2011 / 19:27:26 / Jakub <zelenja7@fel.cvut.cz>" |
|
148 "Modified: / 17-03-2011 / 18:49:13 / Jakub <zelenja7@fel.cvut.cz>" |
|
149 ! |
|
150 |
|
151 testRecognizer11 |
|
152 |collector recognizer foundCollection| |
|
153 |
|
154 collector := self |
|
155 doForSource:' |
|
156 | helper| |
|
157 c fl |
|
158 u := 3. |
|
159 b:=u. |
|
160 c:= u floor aa . |
|
161 d floor: u. |
|
162 d floor: 3 b:u. |
|
163 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
164 array := #(3 4 5 6 ). |
|
165 val := ConstantNode type:tokenType |
|
166 value:tokenValue. |
|
167 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
168 uu := 4. |
|
169 bb:=uu. |
|
170 cc:=uu floor. |
|
171 dd floor:uu. |
|
172 dd floor:3 b:uu. |
|
173 ]. |
|
174 dd do:[:w|w seduce. |
|
175 ] |
|
176 ^self. |
|
177 '. |
|
178 self assert:collector notNil. |
|
179 self assert:collector tree notNil. |
|
180 recognizer := SmallSenseRecognizer new. |
|
181 foundCollection := recognizer |
|
182 recognize:3 |
|
183 position:7 |
|
184 collector:collector. |
|
185 self assert:(foundCollection ~~ OrderedCollection). |
|
186 self assert:(foundCollection objectNameCollection size > 18). |
|
187 |
|
188 " self assert:(foundNode beforeNode). |
|
189 self assert:((foundNode line)=2). |
|
190 self assert:((foundNode position)=2). |
|
191 self assert:(foundNode statement isErrorNode). |
|
192 self assert:(foundNode statement errorToken =':='). |
|
193 self assert:(foundNode beforeStatement isNil)." |
|
194 |
|
195 "Created: / 07-03-2011 / 19:34:06 / Jakub <zelenja7@fel.cvut.cz>" |
|
196 "Modified: / 17-03-2011 / 18:50:27 / Jakub <zelenja7@fel.cvut.cz>" |
|
197 ! |
|
198 |
|
199 testRecognizer12 |
|
200 |collector recognizer foundCollection| |
|
201 |
|
202 collector := self |
|
203 doForSource:' |
|
204 | helper| |
|
205 c fl:[ |
|
206 u := 3. |
|
207 b:=u. |
|
208 c:= u floor aa . |
|
209 d floor: u. |
|
210 d floor: 3 b:u. |
|
211 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
212 array := #(3 4 5 6 ). |
|
213 val := ConstantNode type:tokenType |
|
214 value:tokenValue. |
|
215 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
216 uu := 4. |
|
217 bb:=uu. |
|
218 cc:=uu floor. |
|
219 dd floor:uu. |
|
220 dd floor:3 b:uu. |
|
221 ]. |
|
222 dd do:[:w|w seduce. |
|
223 ] |
|
224 ^self. |
|
225 '. |
|
226 self assert:collector notNil. |
|
227 self assert:collector tree notNil. |
|
228 recognizer := SmallSenseRecognizer new. |
|
229 foundCollection := recognizer |
|
230 recognize:3 |
|
231 position:12 |
|
232 collector:collector. |
|
233 self assert:(foundCollection ~~ OrderedCollection). |
|
234 self assert:(foundCollection objectNameCollection size > 48). |
|
235 |
|
236 " self assert:(foundNode beforeNode). |
|
237 self assert:((foundNode line)=2). |
|
238 self assert:((foundNode position)=2). |
|
239 self assert:(foundNode statement isErrorNode). |
|
240 self assert:(foundNode statement errorToken =':='). |
|
241 self assert:(foundNode beforeStatement isNil)." |
|
242 |
|
243 "Created: / 07-03-2011 / 19:39:40 / Jakub <zelenja7@fel.cvut.cz>" |
|
244 "Modified: / 06-04-2011 / 19:04:40 / Jakub <zelenja7@fel.cvut.cz>" |
|
245 ! |
|
246 |
|
247 testRecognizer13 |
|
248 |collector recognizer foundCollection| |
|
249 |
|
250 collector := self |
|
251 doForSource:' |
|
252 | helper| |
|
253 c fl:[# > |
|
254 u := 3. |
|
255 b:=u. |
|
256 c:= u floor aa . |
|
257 d floor: u. |
|
258 d floor: 3 b:u. |
|
259 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
260 array := #(3 4 5 6 ). |
|
261 val := ConstantNode type:tokenType |
|
262 value:tokenValue. |
|
263 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
264 uu := 4. |
|
265 bb:=uu. |
|
266 cc:=uu floor. |
|
267 dd floor:uu. |
|
268 dd floor:3 b:uu. |
|
269 ]. |
|
270 dd do:[:w|w seduce. |
|
271 ] |
|
272 ^self. |
|
273 '. |
|
274 self assert:collector notNil. |
|
275 self assert:collector tree notNil. |
|
276 recognizer := SmallSenseRecognizer new. |
|
277 foundCollection := recognizer |
|
278 recognize:3 |
|
279 position:14 |
|
280 collector:collector. |
|
281 self assert:(foundCollection ~~ OrderedCollection). |
|
282 self assert:(foundCollection objectNameCollection size > 48). |
|
283 |
|
284 " self assert:(foundNode beforeNode). |
|
285 self assert:((foundNode line)=2). |
|
286 self assert:((foundNode position)=2). |
|
287 self assert:(foundNode statement isErrorNode). |
|
288 self assert:(foundNode statement errorToken =':='). |
|
289 self assert:(foundNode beforeStatement isNil)." |
|
290 |
|
291 "Created: / 07-03-2011 / 19:40:28 / Jakub <zelenja7@fel.cvut.cz>" |
|
292 "Modified: / 06-04-2011 / 19:04:55 / Jakub <zelenja7@fel.cvut.cz>" |
|
293 ! |
|
294 |
|
295 testRecognizer14 |
|
296 |collector recognizer foundCollection| |
|
297 |
|
298 collector := self |
|
299 doForSource:' |
|
300 | helper| |
|
301 c fl:[# > he |
|
302 u := 3. |
|
303 b:=u. |
|
304 c:= u floor aa . |
|
305 d floor: u. |
|
306 d floor: 3 b:u. |
|
307 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
308 array := #(3 4 5 6 ). |
|
309 val := ConstantNode type:tokenType |
|
310 value:tokenValue. |
|
311 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
312 uu := 4. |
|
313 bb:=uu. |
|
314 cc:=uu floor. |
|
315 dd floor:uu. |
|
316 dd floor:3 b:uu. |
|
317 ]. |
|
318 dd do:[:w|w seduce. |
|
319 ] |
|
320 ^self. |
|
321 '. |
|
322 self assert:collector notNil. |
|
323 self assert:collector tree notNil. |
|
324 recognizer := SmallSenseRecognizer new. |
|
325 foundCollection := recognizer |
|
326 recognize:3 |
|
327 position:18 |
|
328 collector:collector. |
|
329 self assert:(foundCollection ~~ OrderedCollection). |
|
330 self assert:(foundCollection objectNameCollection size = 3). |
|
331 |
|
332 " self assert:(foundNode beforeNode). |
|
333 self assert:((foundNode line)=2). |
|
334 self assert:((foundNode position)=2). |
|
335 self assert:(foundNode statement isErrorNode). |
|
336 self assert:(foundNode statement errorToken =':='). |
|
337 self assert:(foundNode beforeStatement isNil)." |
|
338 |
|
339 "Created: / 07-03-2011 / 19:43:01 / Jakub <zelenja7@fel.cvut.cz>" |
|
340 "Modified: / 06-04-2011 / 19:05:34 / Jakub <zelenja7@fel.cvut.cz>" |
|
341 ! |
|
342 |
|
343 testRecognizer15 |
|
344 |collector recognizer foundCollection| |
|
345 |
|
346 collector := self |
|
347 doForSource:' |
|
348 | helper| |
|
349 c fl:[# > he ah |
|
350 u := 3. |
|
351 b:=u. |
|
352 c:= u floor aa . |
|
353 d floor: u. |
|
354 d floor: 3 b:u. |
|
355 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
356 array := #(3 4 5 6 ). |
|
357 val := ConstantNode type:tokenType |
|
358 value:tokenValue. |
|
359 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
360 uu := 4. |
|
361 bb:=uu. |
|
362 cc:=uu floor. |
|
363 dd floor:uu. |
|
364 dd floor:3 b:uu. |
|
365 ]. |
|
366 dd do:[:w|w seduce. |
|
367 ] |
|
368 ^self. |
|
369 '. |
|
370 self assert:collector notNil. |
|
371 self assert:collector tree notNil. |
|
372 recognizer := SmallSenseRecognizer new. |
|
373 foundCollection := recognizer |
|
374 recognize:3 |
|
375 position:23 |
|
376 collector:collector. |
|
377 self assert:(foundCollection ~~ OrderedCollection). |
|
378 self assert:(foundCollection objectNameCollection size > 48). |
|
379 |
|
380 " self assert:(foundNode beforeNode). |
|
381 self assert:((foundNode line)=2). |
|
382 self assert:((foundNode position)=2). |
|
383 self assert:(foundNode statement isErrorNode). |
|
384 self assert:(foundNode statement errorToken =':='). |
|
385 self assert:(foundNode beforeStatement isNil)." |
|
386 |
|
387 "Created: / 07-03-2011 / 19:55:35 / Jakub <zelenja7@fel.cvut.cz>" |
|
388 "Modified: / 06-04-2011 / 19:05:44 / Jakub <zelenja7@fel.cvut.cz>" |
|
389 ! |
|
390 |
|
391 testRecognizer16 |
|
392 |collector recognizer foundCollection| |
|
393 |
|
394 collector := self |
|
395 doForSource:' |
|
396 self |
|
397 |
|
398 '. |
|
399 self assert:collector notNil. |
|
400 self assert:collector tree notNil. |
|
401 recognizer := SmallSenseRecognizer new. |
|
402 foundCollection := recognizer |
|
403 recognize:2 |
|
404 position:6 |
|
405 collector:collector. |
|
406 self assert:(foundCollection ~~ OrderedCollection). |
|
407 self assert:(foundCollection objectNameCollection size >= self class selectors size). |
|
408 |
|
409 " self assert:(foundNode beforeNode). |
|
410 self assert:((foundNode line)=2). |
|
411 self assert:((foundNode position)=2). |
|
412 self assert:(foundNode statement isErrorNode). |
|
413 self assert:(foundNode statement errorToken =':='). |
|
414 self assert:(foundNode beforeStatement isNil)." |
|
415 |
|
416 "Created: / 04-04-2011 / 14:05:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
417 "Modified: / 06-04-2011 / 19:05:56 / Jakub <zelenja7@fel.cvut.cz>" |
|
418 ! |
|
419 |
|
420 testRecognizer2 |
|
421 |collector recognizer foundCollection| |
|
422 |
|
423 collector := self |
|
424 doForSource:' |
|
425 | ahoj| |
|
426 u |
|
427 u := 3. |
|
428 b:=u. |
|
429 c:= u floor aa . |
|
430 d floor: u. |
|
431 d floor: 3 b:u. |
|
432 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
433 array := #(3 4 5 6 ). |
|
434 val := ConstantNode type:tokenType |
|
435 value:tokenValue. |
|
436 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
437 uu := 4. |
|
438 bb:=uu. |
|
439 cc:=uu floor. |
|
440 dd floor:uu. |
|
441 dd floor:3 b:uu. |
|
442 ]. |
|
443 dd do:[:w|w seduce. |
|
444 ] |
|
445 ^self. |
|
446 '. |
|
447 self assert:collector notNil. |
|
448 self assert:collector tree notNil. |
|
449 recognizer := SmallSenseRecognizer new. |
|
450 foundCollection := recognizer |
|
451 recognize:3 |
|
452 position:7 |
|
453 collector:collector. |
|
454 self assert:(foundCollection ~~ OrderedCollection). |
|
455 self assert:(foundCollection objectNameCollection size > 92). |
|
456 |
|
457 " self assert:(foundNode beforeNode). |
|
458 self assert:((foundNode line)=2). |
|
459 self assert:((foundNode position)=2). |
|
460 self assert:(foundNode statement isErrorNode). |
|
461 self assert:(foundNode statement errorToken =':='). |
|
462 self assert:(foundNode beforeStatement isNil)." |
|
463 |
|
464 "Created: / 04-03-2011 / 16:23:04 / Jakub <zelenja7@fel.cvut.cz>" |
|
465 "Modified: / 17-03-2011 / 18:46:09 / Jakub <zelenja7@fel.cvut.cz>" |
|
466 ! |
|
467 |
|
468 testRecognizer3 |
|
469 |collector recognizer foundCollection| |
|
470 |
|
471 collector := self |
|
472 doForSource:' |
|
473 | helper| |
|
474 helper |
|
475 u := 3. |
|
476 b:=u. |
|
477 c:= u floor aa . |
|
478 d floor: u. |
|
479 d floor: 3 b:u. |
|
480 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
481 array := #(3 4 5 6 ). |
|
482 val := ConstantNode type:tokenType |
|
483 value:tokenValue. |
|
484 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
485 uu := 4. |
|
486 bb:=uu. |
|
487 cc:=uu floor. |
|
488 dd floor:uu. |
|
489 dd floor:3 b:uu. |
|
490 ]. |
|
491 dd do:[:w|w seduce. |
|
492 ] |
|
493 ^self. |
|
494 '. |
|
495 self assert:collector notNil. |
|
496 self assert:collector tree notNil. |
|
497 recognizer := SmallSenseRecognizer new. |
|
498 foundCollection := recognizer |
|
499 recognize:3 |
|
500 position:12 |
|
501 collector:collector. |
|
502 self assert:(foundCollection ~~ OrderedCollection). |
|
503 self assert:(foundCollection objectNameCollection size =1). |
|
504 |
|
505 " self assert:(foundNode beforeNode). |
|
506 self assert:((foundNode line)=2). |
|
507 self assert:((foundNode position)=2). |
|
508 self assert:(foundNode statement isErrorNode). |
|
509 self assert:(foundNode statement errorToken =':='). |
|
510 self assert:(foundNode beforeStatement isNil)." |
|
511 |
|
512 "Created: / 04-03-2011 / 17:40:05 / Jakub <zelenja7@fel.cvut.cz>" |
|
513 "Modified: / 17-03-2011 / 18:47:48 / Jakub <zelenja7@fel.cvut.cz>" |
|
514 ! |
|
515 |
|
516 testRecognizer4 |
|
517 |collector recognizer foundCollection| |
|
518 |
|
519 collector := self |
|
520 doForSource:' |
|
521 | helper| |
|
522 10 |
|
523 u := 3. |
|
524 b:=u. |
|
525 c:= u floor aa . |
|
526 d floor: u. |
|
527 d floor: 3 b:u. |
|
528 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
529 array := #(3 4 5 6 ). |
|
530 val := ConstantNode type:tokenType |
|
531 value:tokenValue. |
|
532 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
533 uu := 4. |
|
534 bb:=uu. |
|
535 cc:=uu floor. |
|
536 dd floor:uu. |
|
537 dd floor:3 b:uu. |
|
538 ]. |
|
539 dd do:[:w|w seduce. |
|
540 ] |
|
541 ^self. |
|
542 '. |
|
543 self assert:collector notNil. |
|
544 self assert:collector tree notNil. |
|
545 recognizer := SmallSenseRecognizer new. |
|
546 foundCollection := recognizer |
|
547 recognize:3 |
|
548 position:8 |
|
549 collector:collector. |
|
550 self assert:(foundCollection ~~ OrderedCollection). |
|
551 self assert:(foundCollection objectNameCollection size >= 142). |
|
552 |
|
553 " self assert:(foundNode beforeNode). |
|
554 self assert:((foundNode line)=2). |
|
555 self assert:((foundNode position)=2). |
|
556 self assert:(foundNode statement isErrorNode). |
|
557 self assert:(foundNode statement errorToken =':='). |
|
558 self assert:(foundNode beforeStatement isNil)." |
|
559 |
|
560 "Created: / 07-03-2011 / 18:14:26 / Jakub <zelenja7@fel.cvut.cz>" |
|
561 "Modified: / 17-03-2011 / 18:41:05 / Jakub <zelenja7@fel.cvut.cz>" |
|
562 ! |
|
563 |
|
564 testRecognizer5 |
|
565 |collector recognizer foundCollection| |
|
566 |
|
567 collector := self |
|
568 doForSource:' |
|
569 | helper| |
|
570 self |
|
571 u := 3. |
|
572 b:=u. |
|
573 c:= u floor aa . |
|
574 d floor: u. |
|
575 d floor: 3 b:u. |
|
576 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
577 array := #(3 4 5 6 ). |
|
578 val := ConstantNode type:tokenType |
|
579 value:tokenValue. |
|
580 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
581 uu := 4. |
|
582 bb:=uu. |
|
583 cc:=uu floor. |
|
584 dd floor:uu. |
|
585 dd floor:3 b:uu. |
|
586 ]. |
|
587 dd do:[:w|w seduce. |
|
588 ] |
|
589 ^self. |
|
590 '. |
|
591 self assert:collector notNil. |
|
592 self assert:collector tree notNil. |
|
593 recognizer := SmallSenseRecognizer new. |
|
594 foundCollection := recognizer |
|
595 recognize:3 |
|
596 position:10 |
|
597 collector:collector. |
|
598 self assert:(foundCollection ~~ OrderedCollection). |
|
599 self assert:(foundCollection objectNameCollection size >= self class selectors size). |
|
600 |
|
601 " self assert:(foundNode beforeNode). |
|
602 self assert:((foundNode line)=2). |
|
603 self assert:((foundNode position)=2). |
|
604 self assert:(foundNode statement isErrorNode). |
|
605 self assert:(foundNode statement errorToken =':='). |
|
606 self assert:(foundNode beforeStatement isNil)." |
|
607 |
|
608 "Created: / 07-03-2011 / 18:33:31 / Jakub <zelenja7@fel.cvut.cz>" |
|
609 "Modified: / 04-04-2011 / 14:06:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
610 "Modified: / 06-04-2011 / 19:06:08 / Jakub <zelenja7@fel.cvut.cz>" |
|
611 ! |
|
612 |
|
613 testRecognizer6 |
|
614 |collector recognizer foundCollection| |
|
615 |
|
616 collector := self |
|
617 doForSource:' |
|
618 | helper| |
|
619 super |
|
620 u := 3. |
|
621 b:=u. |
|
622 c:= u floor aa . |
|
623 d floor: u. |
|
624 d floor: 3 b:u. |
|
625 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
626 array := #(3 4 5 6 ). |
|
627 val := ConstantNode type:tokenType |
|
628 value:tokenValue. |
|
629 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
630 uu := 4. |
|
631 bb:=uu. |
|
632 cc:=uu floor. |
|
633 dd floor:uu. |
|
634 dd floor:3 b:uu. |
|
635 ]. |
|
636 dd do:[:w|w seduce. |
|
637 ] |
|
638 ^self. |
|
639 '. |
|
640 self assert:collector notNil. |
|
641 self assert:collector tree notNil. |
|
642 recognizer := SmallSenseRecognizer new. |
|
643 foundCollection := recognizer |
|
644 recognize:3 |
|
645 position:11 |
|
646 collector:collector. |
|
647 self assert:(foundCollection ~~ OrderedCollection). |
|
648 self assert:(foundCollection objectNameCollection size >= 503). |
|
649 |
|
650 " self assert:(foundNode beforeNode). |
|
651 self assert:((foundNode line)=2). |
|
652 self assert:((foundNode position)=2). |
|
653 self assert:(foundNode statement isErrorNode). |
|
654 self assert:(foundNode statement errorToken =':='). |
|
655 self assert:(foundNode beforeStatement isNil)." |
|
656 |
|
657 "Created: / 07-03-2011 / 18:35:35 / Jakub <zelenja7@fel.cvut.cz>" |
|
658 "Modified: / 08-04-2011 / 00:06:23 / Jakub <zelenja7@fel.cvut.cz>" |
|
659 ! |
|
660 |
|
661 testRecognizer7 |
|
662 |collector recognizer foundCollection| |
|
663 |
|
664 collector := self |
|
665 doForSource:' |
|
666 | helper| |
|
667 : |
|
668 u := 3. |
|
669 b:=u. |
|
670 c:= u floor aa . |
|
671 d floor: u. |
|
672 d floor: 3 b:u. |
|
673 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
674 array := #(3 4 5 6 ). |
|
675 val := ConstantNode type:tokenType |
|
676 value:tokenValue. |
|
677 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
678 uu := 4. |
|
679 bb:=uu. |
|
680 cc:=uu floor. |
|
681 dd floor:uu. |
|
682 dd floor:3 b:uu. |
|
683 ]. |
|
684 dd do:[:w|w seduce. |
|
685 ] |
|
686 ^self. |
|
687 '. |
|
688 self assert:collector notNil. |
|
689 self assert:collector tree notNil. |
|
690 recognizer := SmallSenseRecognizer new. |
|
691 foundCollection := recognizer |
|
692 recognize:3 |
|
693 position:11 |
|
694 collector:collector. |
|
695 self assert:(foundCollection ~~ OrderedCollection). |
|
696 self assert:(foundCollection objectNameCollection size >17). |
|
697 |
|
698 " self assert:(foundNode beforeNode). |
|
699 self assert:((foundNode line)=2). |
|
700 self assert:((foundNode position)=2). |
|
701 self assert:(foundNode statement isErrorNode). |
|
702 self assert:(foundNode statement errorToken =':='). |
|
703 self assert:(foundNode beforeStatement isNil)." |
|
704 |
|
705 "Created: / 07-03-2011 / 18:39:58 / Jakub <zelenja7@fel.cvut.cz>" |
|
706 "Modified: / 17-03-2011 / 18:45:29 / Jakub <zelenja7@fel.cvut.cz>" |
|
707 ! |
|
708 |
|
709 testRecognizer8 |
|
710 |collector recognizer foundCollection| |
|
711 |
|
712 collector := self |
|
713 doForSource:' |
|
714 | helper| |
|
715 : |
|
716 u := 3. |
|
717 b:=u. |
|
718 c:= u floor aa . |
|
719 d floor: u. |
|
720 d floor: 3 b:u. |
|
721 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
722 array := #(3 4 5 6 ). |
|
723 val := ConstantNode type:tokenType |
|
724 value:tokenValue. |
|
725 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
726 uu := 4. |
|
727 bb:=uu. |
|
728 cc:=uu floor. |
|
729 dd floor:uu. |
|
730 dd floor:3 b:uu. |
|
731 ]. |
|
732 dd do:[:w|w seduce. |
|
733 ] |
|
734 ^self. |
|
735 '. |
|
736 self assert:collector notNil. |
|
737 self assert:collector tree notNil. |
|
738 recognizer := SmallSenseRecognizer new. |
|
739 foundCollection := recognizer |
|
740 recognize:3 |
|
741 position:6 |
|
742 collector:collector. |
|
743 self assert:(foundCollection ~~ OrderedCollection). |
|
744 self assert:(foundCollection objectNameCollection size >= 48). |
|
745 |
|
746 " self assert:(foundNode beforeNode). |
|
747 self assert:((foundNode line)=2). |
|
748 self assert:((foundNode position)=2). |
|
749 self assert:(foundNode statement isErrorNode). |
|
750 self assert:(foundNode statement errorToken =':='). |
|
751 self assert:(foundNode beforeStatement isNil)." |
|
752 |
|
753 "Created: / 07-03-2011 / 19:26:53 / Jakub <zelenja7@fel.cvut.cz>" |
|
754 "Modified: / 06-04-2011 / 19:07:02 / Jakub <zelenja7@fel.cvut.cz>" |
|
755 ! |
|
756 |
|
757 testRecognizer9 |
|
758 |collector recognizer foundCollection| |
|
759 |
|
760 collector := self |
|
761 doForSource:' |
|
762 | helper| |
|
763 : |
|
764 u := 3. |
|
765 b:=u. |
|
766 c:= u floor aa . |
|
767 d floor: u. |
|
768 d floor: 3 b:u. |
|
769 self rememberSymbolUsed:nil . c call: b . b call:c dd:d. |
|
770 array := #(3 4 5 6 ). |
|
771 val := ConstantNode type:tokenType |
|
772 value:tokenValue. |
|
773 [ u== #Symbol or: [u=3 ] ] ifTrue:[ |
|
774 uu := 4. |
|
775 bb:=uu. |
|
776 cc:=uu floor. |
|
777 dd floor:uu. |
|
778 dd floor:3 b:uu. |
|
779 ]. |
|
780 dd do:[:w|w seduce. |
|
781 ] |
|
782 ^self. |
|
783 '. |
|
784 self assert:collector notNil. |
|
785 self assert:collector tree notNil. |
|
786 recognizer := SmallSenseRecognizer new. |
|
787 foundCollection := recognizer |
|
788 recognize:3 |
|
789 position:4 |
|
790 collector:collector. |
|
791 self assert:(foundCollection ~~ OrderedCollection). |
|
792 self assert:(foundCollection objectNameCollection size >= 48). |
|
793 |
|
794 " self assert:(foundNode beforeNode). |
|
795 self assert:((foundNode line)=2). |
|
796 self assert:((foundNode position)=2). |
|
797 self assert:(foundNode statement isErrorNode). |
|
798 self assert:(foundNode statement errorToken =':='). |
|
799 self assert:(foundNode beforeStatement isNil)." |
|
800 |
|
801 "Created: / 07-03-2011 / 19:27:11 / Jakub <zelenja7@fel.cvut.cz>" |
|
802 "Modified: / 06-04-2011 / 19:07:13 / Jakub <zelenja7@fel.cvut.cz>" |
|
803 ! ! |
|
804 |
|
805 !RecognizerTests class methodsFor:'documentation'! |
|
806 |
|
807 version_SVN |
|
808 ^ '$Id$' |
|
809 ! ! |
|
810 |