Lines Matching defs:breaker
41 WordBreaker breaker;
42 breaker.setLocale(icu::Locale::getUS());
43 breaker.setText(buf, NELEM(buf));
44 EXPECT_EQ(0, breaker.current());
45 EXPECT_EQ(6, breaker.next()); // after "hello "
46 EXPECT_EQ(0, breaker.wordStart()); // "hello"
47 EXPECT_EQ(5, breaker.wordEnd());
48 EXPECT_EQ(0, breaker.breakBadness());
49 EXPECT_EQ(6, breaker.current());
50 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
51 EXPECT_EQ(6, breaker.wordStart()); // "world"
52 EXPECT_EQ(11, breaker.wordEnd());
53 EXPECT_EQ(0, breaker.breakBadness());
54 EXPECT_EQ(11, breaker.current());
59 WordBreaker breaker;
60 breaker.setLocale(icu::Locale::getUS());
61 breaker.setText(buf, NELEM(buf));
62 EXPECT_EQ(0, breaker.current());
63 EXPECT_EQ(7, breaker.next()); // after "hel{SOFT HYPHEN}lo "
64 EXPECT_EQ(0, breaker.wordStart()); // "hel{SOFT HYPHEN}lo"
65 EXPECT_EQ(6, breaker.wordEnd());
66 EXPECT_EQ(0, breaker.breakBadness());
67 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
68 EXPECT_EQ(7, breaker.wordStart()); // "world"
69 EXPECT_EQ(12, breaker.wordEnd());
70 EXPECT_EQ(0, breaker.breakBadness());
76 WordBreaker breaker;
77 breaker.setLocale(icu::Locale::getUS());
78 breaker.setText(buf, NELEM(buf));
79 EXPECT_EQ(0, breaker.current());
80 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next());
81 EXPECT_EQ(0, breaker.wordStart());
82 EXPECT_EQ((ssize_t)NELEM(buf), breaker.wordEnd());
83 EXPECT_EQ(0, breaker.breakBadness());
88 WordBreaker breaker;
89 breaker.setLocale(icu::Locale::getUS());
90 breaker.setText(buf, NELEM(buf));
91 EXPECT_EQ(0, breaker.current());
93 EXPECT_EQ(4, breaker.next()); // after CENT SIGN
94 EXPECT_EQ(0, breaker.wordStart()); // "US¢"
95 EXPECT_EQ(3, breaker.wordEnd());
97 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end of string
98 EXPECT_EQ(4, breaker.wordStart()); // "JP¥"
99 EXPECT_EQ((ssize_t)NELEM(buf), breaker.wordEnd());
104 WordBreaker breaker;
106 breaker.setLocale(burmese);
107 breaker.setText(buf, NELEM(buf));
108 EXPECT_EQ(0, breaker.current());
110 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end of string
111 EXPECT_EQ(0, breaker.wordStart());
112 EXPECT_EQ((ssize_t)NELEM(buf), breaker.wordEnd());
126 WordBreaker breaker;
127 breaker.setLocale(icu::Locale::getUS());
128 breaker.setText(buf, NELEM(buf));
129 EXPECT_EQ(0, breaker.current());
130 EXPECT_EQ(7, breaker.next()); // after man + zwj + heart + zwj + man
131 EXPECT_EQ(0, breaker.wordStart());
132 EXPECT_EQ(7, breaker.wordEnd());
133 EXPECT_EQ(17, breaker.next()); // after woman + zwj + heart + zwj + woman
134 EXPECT_EQ(7, breaker.wordStart());
135 EXPECT_EQ(17, breaker.wordEnd());
136 EXPECT_EQ(22, breaker.next()); // after eye + zwj + left speech bubble
137 EXPECT_EQ(17, breaker.wordStart());
138 EXPECT_EQ(22, breaker.wordEnd());
139 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
140 EXPECT_EQ(22, breaker.wordStart());
141 EXPECT_EQ(27, breaker.wordEnd());
149 WordBreaker breaker;
150 breaker.setLocale(icu::Locale::getUS());
151 breaker.setText(buf, NELEM(buf));
152 EXPECT_EQ(0, breaker.current());
153 EXPECT_EQ(4, breaker.next()); // after boy + type 1-2 fitzpatrick modifier
154 EXPECT_EQ(0, breaker.wordStart());
155 EXPECT_EQ(4, breaker.wordEnd());
156 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
157 EXPECT_EQ(4, breaker.wordStart());
158 EXPECT_EQ(8, breaker.wordEnd());
173 WordBreaker breaker;
174 breaker.setLocale(icu::Locale::getEnglish());
175 breaker.setText(buf, NELEM(buf));
176 EXPECT_EQ(0, breaker.current());
177 EXPECT_EQ(2, breaker.next());
178 EXPECT_EQ(0, breaker.wordStart());
179 EXPECT_EQ(2, breaker.wordEnd());
181 EXPECT_EQ(4, breaker.next());
182 EXPECT_EQ(2, breaker.wordStart());
183 EXPECT_EQ(4, breaker.wordEnd());
185 EXPECT_EQ(7, breaker.next());
186 EXPECT_EQ(4, breaker.wordStart());
187 EXPECT_EQ(7, breaker.wordEnd());
189 EXPECT_EQ(9, breaker.next());
190 EXPECT_EQ(7, breaker.wordStart());
191 EXPECT_EQ(9, breaker.wordEnd());
193 EXPECT_EQ(10, breaker.next());
194 EXPECT_EQ(9, breaker.wordStart());
195 EXPECT_EQ(10, breaker.wordEnd());
197 EXPECT_EQ(12, breaker.next());
198 EXPECT_EQ(10, breaker.wordStart());
199 EXPECT_EQ(12, breaker.wordEnd());
201 EXPECT_EQ(14, breaker.next());
202 EXPECT_EQ(12, breaker.wordStart());
203 EXPECT_EQ(14, breaker.wordEnd());
205 EXPECT_EQ(16, breaker.next());
206 EXPECT_EQ(14, breaker.wordStart());
207 EXPECT_EQ(16, breaker.wordEnd());
221 WordBreaker breaker;
222 breaker.setLocale(icu::Locale::getUS());
223 breaker.setText(buf, size);
224 EXPECT_EQ(0, breaker.current());
225 EXPECT_EQ(kFlagLength, breaker.next()); // end of the first flag
226 EXPECT_EQ(0, breaker.wordStart());
227 EXPECT_EQ(kFlagLength, breaker.wordEnd());
228 EXPECT_EQ(static_cast<ssize_t>(size), breaker.next());
229 EXPECT_EQ(kFlagLength, breaker.wordStart());
230 EXPECT_EQ(kFlagLength * 2, breaker.wordEnd());
246 WordBreaker breaker;
247 breaker.setLocale(icu::Locale::getUS());
248 breaker.setText(buf, size);
249 EXPECT_EQ(0, breaker.current());
250 EXPECT_EQ(kFlagLength, breaker.next()); // end of the first flag sequence
251 EXPECT_EQ(0, breaker.wordStart());
252 EXPECT_EQ(kFlagLength, breaker.wordEnd());
253 EXPECT_EQ(static_cast<ssize_t>(size), breaker.next());
254 EXPECT_EQ(kFlagLength, breaker.wordStart());
255 EXPECT_EQ(kFlagLength * 2, breaker.wordEnd());
261 WordBreaker breaker;
262 breaker.setLocale(icu::Locale::getUS());
263 breaker.setText(buf, NELEM(buf));
264 EXPECT_EQ(0, breaker.current());
265 EXPECT_EQ(9, breaker.next()); // after "¡¡hello, "
266 EXPECT_EQ(2, breaker.wordStart()); // "hello"
267 EXPECT_EQ(7, breaker.wordEnd());
268 EXPECT_EQ(0, breaker.breakBadness());
269 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
270 EXPECT_EQ(9, breaker.wordStart()); // "world"
271 EXPECT_EQ(14, breaker.wordEnd());
272 EXPECT_EQ(0, breaker.breakBadness());
278 WordBreaker breaker;
279 breaker.setLocale(icu::Locale::getUS());
280 breaker.setText(buf, NELEM(buf));
281 EXPECT_EQ(0, breaker.current());
282 EXPECT_EQ(11, breaker.next()); // after "foo@example"
283 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
284 EXPECT_EQ(1, breaker.breakBadness());
285 EXPECT_EQ(16, breaker.next()); // after ".com "
286 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
287 EXPECT_EQ(0, breaker.breakBadness());
288 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
289 EXPECT_EQ(16, breaker.wordStart()); // "x"
290 EXPECT_EQ(17, breaker.wordEnd());
291 EXPECT_EQ(0, breaker.breakBadness());
297 WordBreaker breaker;
298 breaker.setLocale(icu::Locale::getUS());
299 breaker.setText(buf, NELEM(buf));
300 EXPECT_EQ(0, breaker.current());
301 EXPECT_EQ(7, breaker.next()); // after "mailto:"
302 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
303 EXPECT_EQ(1, breaker.breakBadness());
304 EXPECT_EQ(18, breaker.next()); // after "foo@example"
305 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
306 EXPECT_EQ(1, breaker.breakBadness());
307 EXPECT_EQ(23, breaker.next()); // after ".com "
308 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
309 EXPECT_EQ(0, breaker.breakBadness());
310 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
311 EXPECT_EQ(23, breaker.wordStart()); // "x"
312 EXPECT_EQ(24, breaker.wordEnd());
313 EXPECT_EQ(0, breaker.breakBadness());
321 WordBreaker breaker;
322 breaker.setLocale(icu::Locale::getUS());
323 breaker.setText(buf, NELEM(buf));
324 EXPECT_EQ(0, breaker.current());
325 EXPECT_EQ(11, breaker.next()); // after "foo@example"
326 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
327 EXPECT_EQ(1, breaker.breakBadness());
328 EXPECT_EQ(15, breaker.next()); // after ".com"
329 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
330 EXPECT_EQ(0, breaker.breakBadness());
331 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
332 EXPECT_EQ(15, breaker.wordStart()); // "?"
333 EXPECT_EQ(16, breaker.wordEnd());
334 EXPECT_EQ(0, breaker.breakBadness());
340 WordBreaker breaker;
341 breaker.setLocale(icu::Locale::getUS());
342 breaker.setText(buf, NELEM(buf));
343 EXPECT_EQ(0, breaker.current());
344 EXPECT_EQ(11, breaker.next()); // after "foo@example"
345 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
346 EXPECT_EQ(1, breaker.breakBadness());
347 EXPECT_EQ(17, breaker.next()); // after ".com? "
348 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
349 EXPECT_EQ(0, breaker.breakBadness());
350 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
351 EXPECT_EQ(17, breaker.wordStart()); // "x"
352 EXPECT_EQ(18, breaker.wordEnd());
353 EXPECT_EQ(0, breaker.breakBadness());
358 WordBreaker breaker;
359 breaker.setLocale(icu::Locale::getUS());
360 breaker.setText(buf, NELEM(buf));
361 EXPECT_EQ(0, breaker.current());
362 EXPECT_EQ(2, breaker.next()); // after "a "
363 EXPECT_EQ(0, breaker.wordStart()); // "a"
364 EXPECT_EQ(1, breaker.wordEnd());
365 EXPECT_EQ(0, breaker.breakBadness());
366 EXPECT_EQ(4, breaker.next()); // after "@ "
367 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
368 EXPECT_EQ(0, breaker.breakBadness());
369 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
370 EXPECT_EQ(4, breaker.wordStart()); // "b"
371 EXPECT_EQ(5, breaker.wordEnd());
372 EXPECT_EQ(0, breaker.breakBadness());
378 WordBreaker breaker;
379 breaker.setLocale(icu::Locale::getUS());
380 breaker.setText(buf, NELEM(buf));
381 EXPECT_EQ(0, breaker.current());
382 EXPECT_EQ(5, breaker.next()); // after "http:"
383 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
384 EXPECT_EQ(1, breaker.breakBadness());
385 EXPECT_EQ(7, breaker.next()); // after "//"
386 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
387 EXPECT_EQ(1, breaker.breakBadness());
388 EXPECT_EQ(14, breaker.next()); // after "example"
389 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
390 EXPECT_EQ(1, breaker.breakBadness());
391 EXPECT_EQ(19, breaker.next()); // after ".com "
392 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
393 EXPECT_EQ(0, breaker.breakBadness());
394 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
395 EXPECT_EQ(19, breaker.wordStart()); // "x"
396 EXPECT_EQ(20, breaker.wordEnd());
397 EXPECT_EQ(0, breaker.breakBadness());
404 WordBreaker breaker;
405 breaker.setLocale(icu::Locale::getUS());
406 breaker.setText(buf, NELEM(buf));
407 EXPECT_EQ(0, breaker.current());
408 EXPECT_EQ(5, breaker.next()); // after "http:"
409 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
410 EXPECT_EQ(1, breaker.breakBadness());
411 EXPECT_EQ(7, breaker.next()); // after "//"
412 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
413 EXPECT_EQ(1, breaker.breakBadness());
414 EXPECT_EQ(8, breaker.next()); // after "a"
415 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
416 EXPECT_EQ(1, breaker.breakBadness());
417 EXPECT_EQ(10, breaker.next()); // after ".b"
418 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
419 EXPECT_EQ(1, breaker.breakBadness());
420 EXPECT_EQ(11, breaker.next()); // after "/"
421 breaker.wordStart() >= breaker.wordEnd());
422 EXPECT_EQ(1, breaker.breakBadness());
423 EXPECT_EQ(13, breaker.next()); // after "~c"
424 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
425 EXPECT_EQ(1, breaker.breakBadness());
426 EXPECT_EQ(15, breaker.next()); // after ",d"
427 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
428 EXPECT_EQ(1, breaker.breakBadness());
429 EXPECT_EQ(17, breaker.next()); // after "-e"
430 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
431 EXPECT_EQ(1, breaker.breakBadness());
432 EXPECT_EQ(19, breaker.next()); // after "?f"
433 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
434 EXPECT_EQ(1, breaker.breakBadness());
435 EXPECT_EQ(20, breaker.next()); // after "="
436 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
437 EXPECT_EQ(1, breaker.breakBadness());
438 EXPECT_EQ(21, breaker.next()); // after "g"
439 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
440 EXPECT_EQ(1, breaker.breakBadness());
441 EXPECT_EQ(22, breaker.next()); // after "&"
442 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
443 EXPECT_EQ(1, breaker.breakBadness());
444 EXPECT_EQ(23, breaker.next()); // after "h"
445 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
446 EXPECT_EQ(1, breaker.breakBadness());
447 EXPECT_EQ(25, breaker.next()); // after "#i"
448 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
449 EXPECT_EQ(1, breaker.breakBadness());
450 EXPECT_EQ(27, breaker.next()); // after "%j"
451 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
452 EXPECT_EQ(1, breaker.breakBadness());
453 EXPECT_EQ(29, breaker.next()); // after "_k"
454 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
455 EXPECT_EQ(1, breaker.breakBadness());
456 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
457 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
458 EXPECT_EQ(0, breaker.breakBadness());
463 WordBreaker breaker;
464 breaker.setLocale(icu::Locale::getUS());
465 breaker.setText(buf, NELEM(buf));
466 EXPECT_EQ(0, breaker.current());
467 EXPECT_EQ(5, breaker.next()); // after "http:"
468 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
469 EXPECT_EQ(7, breaker.next()); // after "//"
470 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
471 EXPECT_EQ(8, breaker.next()); // after "a"
472 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
473 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
474 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
479 WordBreaker breaker;
480 breaker.setLocale(icu::Locale::getUS());
481 breaker.setText(buf, NELEM(buf));
482 EXPECT_EQ(0, breaker.current());
483 EXPECT_EQ(5, breaker.next()); // after "http:"
484 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
485 EXPECT_EQ(7, breaker.next()); // after "//"
486 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
487 EXPECT_EQ(8, breaker.next()); // after "a"
488 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
489 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
490 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());
495 WordBreaker breaker;
496 breaker.setLocale(icu::Locale::getUS());
497 breaker.setText(buf, NELEM(buf));
498 EXPECT_EQ(0, breaker.current());
499 EXPECT_EQ((ssize_t)NELEM(buf), breaker.next()); // end
500 EXPECT_TRUE(breaker.wordStart() >= breaker.wordEnd());