summaryrefslogtreecommitdiffstats
path: root/intl/icu/source/test/testdata/ssearch.xml
blob: c9fc6d37960ceb69acef213c6d2b6ea7ec64cd80 (plain)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
<?xml version="1.0" encoding="UTF-8"?>

<!-- Copyright (C) 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html -->
<!-- Copyright (c) 2007-2009 IBM Corporation and others. All rights reserved -->

<!-- Test data file for string search  -->
<!DOCTYPE stringsearch-tests [
<!ELEMENT stringsearch-tests (test-case+)>
<!ATTLIST stringsearch-tests debug IDREF #IMPLIED >
<!ELEMENT test-case (pattern, pre?, m?, post?)>
<!ATTLIST test-case 
          id ID #REQUIRED
          locale CDATA "en" 
          strength (PRIMARY | SECONDARY | TERTIARY | QUATERNARY | IDENTICAL) "TERTIARY" 
          norm (ON | OFF) "OFF"
          alternate_handling (NON_IGNORABLE | SHIFTED) "NON_IGNORABLE"
          >

<!ELEMENT pattern (#PCDATA)>
<!ELEMENT pre  (#PCDATA)>
<!ELEMENT m    (#PCDATA)>
<!ELEMENT post (#PCDATA)>
]>

<stringsearch-tests>
  <!-- debug="test11"     (for copying into the above element)  -->
    
    <!-- Very simple match  -->
    <test-case id="test01" >
       <pattern>abc</pattern>
       <pre>xxx</pre><m>abc</m><post>yyy</post>
    </test-case>
    
    <!-- Very simple no-match  -->
    <test-case id="test02" >
       <pattern>abc</pattern>
       <pre>xxx</pre><post>yyy</post>
    </test-case>

    <!-- Match after several near-misses. -->
    <test-case id="test03" >
       <pattern>string</pattern>
       <pre>silly spring stling strxng strilg strinx stri</pre><m>string</m><post> fling</post>
    </test-case>
    
    <test-case id="test04" strength="PRIMARY" >
       <pattern>FUSS</pattern>
       <pre>abc</pre><m>fuss</m><post>sss</post>
    </test-case>
    
    <test-case id="test05" strength="PRIMARY" >
       <pattern>FUSS</pattern>
       <pre>abc</pre><m>fuß</m><post>sss</post>
    </test-case>

  <test-case id="test05.5" strength="PRIMARY" >
    <pattern>fuss</pattern>
    <pre>a </pre>
    <m>fuß</m>
    <post>ball table</post>
  </test-case>

  <test-case id="test06" strength="PRIMARY" >
      <pattern>fuß</pattern>
       <pre>abc</pre><m>fuss</m><post>xyz</post>
    </test-case>
    
    <test-case id="test07" strength="SECONDARY" >
      <pattern>fuß</pattern>
      <pre>abcfussxyz</pre>
    </test-case>
    
    <test-case id="test08" strength="PRIMARY" >
      <pattern>fus</pattern>
      <pre>abcfuß</pre><post>xyz</post>
    </test-case>
    
    <!-- A good match following an initial match that failed because
         of not ending on a character boundary -->
    <test-case id="test09" strength="PRIMARY">
      <pattern>fus</pattern>
      <pre>fuß  </pre><m>fus</m><post>sss</post>
    </test-case>


    <!-- Test cases from usrchdat.c  BREAKITERATOREXACT -->

    <test-case id="test10" strength="TERTIARY">
      <pattern>fox</pattern>
      <m>fox</m><post>y fox</post>
    </test-case>

    <test-case id="test11" strength="PRIMARY" locale="de_DE@collation=phonebook">
      <pattern>toe</pattern>
      <pre>This is a </pre><m></m><post>ne</post>
    </test-case>
    
    <test-case id="test11a" strength="SECONDARY" locale="de_DE@collation=phonebook">
      <pattern>toe</pattern>
      <pre>This is a </pre><post>Töne</post>
    </test-case>
    
    <test-case id="test12" strength="TERTIARY">
      <pattern>e</pattern>
      <pre>tésting that é doés not match </pre><m>e</m><post></post>
    </test-case>
    
    <test-case id="test13" strength="PRIMARY" locale="fr">
      <pattern>e</pattern>
      <pre></pre><m>É</m><post>É</post>
    </test-case>
    
    <test-case id="test14" strength="PRIMARY" locale="fr">
      <pattern>O</pattern>
      <pre>C</pre><m>O\u0302</m><post></post>
    </test-case>


    <!-- Test cases from usrchdat.c  STRENGTH -->


    <test-case id="test15" strength="PRIMARY" locale="en">
      <pattern>fox</pattern>
      <pre>The quick brown </pre><m>fox</m><post> jumps over the lazy foxes</post>
    </test-case>
    
    <test-case id="test16" strength="PRIMARY" locale="fr">
      <pattern>peche</pattern>
      <pre>blackbirds pat </pre><m>p\u00E9ch\u00E9</m><post> </post>
    </test-case>
    
    <test-case id="test17" strength="PRIMARY" locale="fr">
      <pattern>peche</pattern>
      <pre>blackbirds pat </pre><m>p\u00EAche</m><post> </post>
    </test-case>
    
    <test-case id="test18" strength="PRIMARY" locale="fr">
      <pattern>peche</pattern>
      <pre>blackbirds pat </pre><m>p\u00E9che</m><post>r </post>
    </test-case>
    
    <test-case id="test19" strength="PRIMARY" locale="fr">
      <pattern>peche</pattern>
      <pre>blackbirds pat </pre><m>p\u00EAche</m><post>r </post>
    </test-case>
    
    <test-case id="test20" strength="PRIMARY" locale="es">
      <pattern>channel</pattern>
      <pre>A </pre><m>channel</m><post>, </post>
    </test-case>
    
    <test-case id="test21" strength="PRIMARY" locale="es">
      <pattern>channel</pattern>
      <pre>A </pre><m>CHANNEL</m><post>, </post>
    </test-case>
    
    <test-case id="test22" strength="PRIMARY" locale="es">
      <pattern>channel</pattern>
      <pre>A </pre><m>Channel</m><post>s, </post>
    </test-case>
    
    <test-case id="test23" strength="PRIMARY" locale="es">
      <pattern>channel</pattern>
      <pre>A </pre><m>channel</m><post>... </post>
    </test-case>
    
    <test-case id="test24" strength="TERTIARY" locale="en">
      <pattern>A\u0300</pattern>
      <pre>A miss, and then </pre><m>\u00c0</m><post> should match but not A"</post>
    </test-case>
    
    <!-- TODO:  In the original test data, this test matched at IDENTICAL strength.
                Doesn't seem right.  The characters are different.
                -->
    <test-case id="test24a" strength="IDENTICAL" locale="en">
      <pattern>A\u0300</pattern>
      <pre>At IDENTICAL, should this match?  </pre><m>\u00c0</m><post></post>
    </test-case>

  <test-case id="test24b" strength="IDENTICAL" alternate_handling="SHIFTED" locale="en">
    <pattern>A\u0300</pattern>
    <pre>At IDENTICAL, should this match?  </pre>
    <m>\u00c0</m>
    <post></post>
  </test-case>

  <test-case id="test25" strength="SECONDARY" locale="en">
      <pattern>Ű</pattern>
      <pre>12</pre><m>ű</m><post> Ű</post>
    </test-case>
    
    <test-case id="test26" strength="SECONDARY" locale="en">
      <pattern>A</pattern>
      <pre>12</pre><m>a</m><post>...</post>
    </test-case>


    <!--  Test Cases from usrchdat.c,  VARIABLE -->
    <test-case id="test27" strength="TERTIARY" locale="en">
      <pattern>blackbird</pattern>
      <pre>black-bird </pre><m>blackbird</m><post>...</post>
    </test-case>

    <test-case id="test28" strength="TERTIARY" locale="en">
      <pattern>go</pattern>
      <pre> on</pre>
    </test-case>

    <!-- TODO:  this gives an U_ILLEGAL_ARGUMENT error when opening
                the UStringSearch.  How did the original test run? -->
    <!--
    <test-case id="test29" strength="PRIMARY" locale="en">
      <pattern>  </pattern>
      <pre></pre><m></m><post>abc</post>
    </test-case>
    -->

    <test-case id="test30" strength="SECONDARY" locale="en">
      <pattern>abc</pattern>
      <pre>  a bc   ab c    a  bc     ab  c"</pre>
    </test-case>

    <test-case id="test31" strength="SECONDARY" locale="en">
      <pattern>abc</pattern>
      <pre>           ---------------</pre>
    </test-case>


    <!--  Normalization test cases from usrchdat.c  -->
    <test-case id="test32" strength="TERTIARY"  norm="ON">
      <pattern>a\u0325\u0300</pattern>
      <pre></pre><m>a\u0300\u0325</m>
    </test-case>


    <test-case id="test32a" strength="TERTIARY"  norm="OFF">
      <pattern>a\u0325\u0300</pattern>
      <pre>a\u0300\u0325</pre>
    </test-case>


    <!-- COMPOSITEBOUNDARIES from usrchdat.c
         Boundaries are not identical to original test data because
         of matching only full combining sequences
    -->
    <test-case id="test40" strength="TERTIARY">
      <pattern>A</pattern>
      <pre>À</pre>   <!-- \u00C0 -->
    </test-case>
    
    <test-case id="test41" strength="TERTIARY">
      <pattern>A</pattern>
      <pre>À</pre><m>A</m><post>C</post>
    </test-case>
    
    <test-case id="test42" strength="TERTIARY">
      <pattern>A\u030A</pattern>
      <pre>À\u01FA</pre>
    </test-case>



    <!-- SUPPLEMENTARYCANONICAL from usrchdat.c  -->
    <test-case id="test50" strength="TERTIARY">
      <pattern>\uD800\uDC00</pattern>
      <pre>abc \uD802\uDC00 \uD800\uDC01 \uD801\uDC00 </pre><m>\uD800\uDC00</m>
      <post>abc abc\uD800\uDC00 \uD800\uD800\uDC00 \uD800\uDC00\uDC00</post>
    </test-case>
    
    <test-case id="test51" strength="TERTIARY">
      <pattern>\\uD834\\uDDB9</pattern>
      <pre>and</pre><m>\\uD834\\uDDB9</m><post>this sentence</post>
    </test-case>

    <test-case id="test52" strength="TERTIARY">
      <pattern> \\uD834\\uDDB9 </pattern>
      <pre>and</pre><m> \\uD834\\uDDB9 </m><post>this sentence</post>
    </test-case>
    
    <test-case id="test53" strength="TERTIARY">
      <pattern>-\\uD834\\uDDB9-</pattern>
      <pre>and</pre><m>-\\uD834\\uDDB9-</m><post>this sentence</post>
    </test-case>
    
    <test-case id="test54" strength="TERTIARY">
      <pattern>,\\uD834\\uDDB9,</pattern>
      <pre>and</pre><m>,\\uD834\\uDDB9,</m><post>this sentence</post>
    </test-case>
    
    <test-case id="test55" strength="TERTIARY">
      <pattern>?\\uD834\\uDDB9?</pattern>
      <pre>and</pre><m>?\\uD834\\uDDB9?</m><post>this sentence</post>
    </test-case>
    

    <!-- Long combining sequences  -->
    <!-- Backwards search fails because patterns ends w/ ignorables
    <test-case id="test60" strength="PRIMARY">
      <pattern>A\u0301\u0301\u0301\u0301</pattern>
      <m>A\u0301\u0301\u0301\u0301\u0301</m>
    </test-case>
    -->

    <test-case id="test61" strength="TERTIARY">
      <pattern>A\u0301\u0301\u0301\u0301</pattern>
          <pre>A\u0301\u0301\u0301\u0301\u0301</pre>
    </test-case>
    
    <test-case id="test62" strength="TERTIARY">
      <pattern>A\u0301\u0301\u0301\u0301</pattern>
            <m>A\u0301\u0301\u0301\u0301</m>
    </test-case>

    <!-- stand-alone combining marks don't match attached marks  -->
    <test-case id="test63" strength="TERTIARY">
      <pattern>\u0301</pattern>
      <pre>A\u0301\u0301\u0301\u0301</pre>
    </test-case>
    
    <test-case id="test64" strength="TERTIARY">
      <pattern>\u0301</pattern>
      <post>\u0301\u0301\u0301\u0301</post>
    </test-case>

  <!-- stand-alone combining mark does match an un-attached combining mark -->
    <test-case id="test65" strength="TERTIARY">
       <pattern>\u0301</pattern>
       <m>\u0301</m><post>A\u0301\u0301</post>
    </test-case>

    <test-case id="test66" strength="TERTIARY">
       <pattern>\u0301</pattern>
       <m>\u0301</m>
    </test-case>
          
    <!-- stand-alone combining marks at end of the target text -->
    <test-case id="test67" strength="TERTIARY">
       <pattern>\u0301</pattern>
       <pre>abcd\r</pre><m>\u0301</m>
    </test-case>

      <!-- attached combining marks at end of the target text, no match -->
    <test-case id="test68" strength="TERTIARY">
       <pattern>\u0301</pattern>
       <pre>abcd\u0301</pre>
    </test-case>



   <!-- no match within expansions at the start -->
    <test-case id="test70" strength="PRIMARY">
      <pattern>Eligature</pattern>
      <pre>Æligature</pre>
    </test-case>

    <test-case id="test71" strength="PRIMARY">
      <pattern>AEligature</pattern>
      <m>Æligature</m>
    </test-case>

    <test-case id="test72" strength="PRIMARY">
        <pattern>AEligature</pattern>
        <m>Æligature</m>
    </test-case>
    
    <!-- unattached combining Tilde will not match a Tilde that is
         part of a composed Ñ  (\u00D1)  -->
    <test-case id="test73" strength="SECONDARY">
        <pattern>\u0303</pattern>  <!-- combining tilde -->
        <pre>Ñ&#x0d;</pre><m>\u0303</m>
    </test-case>
    
    <test-case id="test74" strength="SECONDARY">
        <pattern>\u0303</pattern>  <!-- combining tilde -->
        <pre>Ñ &#x0d;</pre><m>\u0303</m><post>a</post>
    </test-case>

  <test-case id="test75" strength="TERTIARY" locale="fr">
    <pattern>\u00EA</pattern>
    <pre>p</pre><m>\u00EA</m><post>che</post>
  </test-case>

  <test-case id="test76" strength="TERTIARY" locale="fr">
    <pattern>\u00EA</pattern>
    <pre>p</pre><m>e\u0302</m><post>che</post>
  </test-case>

  <test-case id="test77" strength="TERTIARY" locale="fr">
    <pattern>e\u0302</pattern>
    <pre>p</pre><m>\u00EA</m><post>che</post>
  </test-case>

  <!-- Test cases from ticket:5382 -->
  <test-case id="test78" strength="SECONDARY" locale="hu_HU">
    <pattern>\u0170</pattern>
    <m>\u0171</m>
    <post>12</post>
  </test-case>

  <test-case id="test79" strength="SECONDARY" locale="hu_HU">
    <pattern>\u0170</pattern>
    <pre>1</pre>
    <m>\u0171</m>
    <post>2</post>
  </test-case>

  <test-case id="test80" strength="SECONDARY" locale="hu_HU">
    <pattern>\u0170</pattern>
    <pre>12</pre>
    <m>\u0171</m>
  </test-case>
  
  <!-- Test cases from ticket:5959 -->
  <test-case id="test81" strength="SECONDARY">
    <pattern>\u2166</pattern>
    <m>VII</m>
  </test-case>

  <test-case id="test82" strength="SECONDARY">
    <pattern>VII</pattern>
    <m>\u2166</m>
  </test-case>

  <test-case id="test83" strength="IDENTICAL" alternate_handling="SHIFTED" locale="en">
    <pattern>Universal Declaration of Human Rights</pattern>
    <pre>Proclaims this </pre><m>Universal Declaration of Human Rights</m><post> as a common standard of achievement for all peoples and all nations</post>
  </test-case>

  <test-case id="test83b" strength="TERTIARY" alternate_handling="SHIFTED" locale="en">
    <pattern>Universal Declaration of Human Rights</pattern>
    <pre>Proclaims this </pre>
    <m>Universal-Declaration-of-Human-Rights</m>
    <post> as a common standard of achievement for all peoples and all nations</post>
  </test-case>

  <test-case id="test84" strength="TERTIARY" locale="en">
    <pattern>\u05E9\u0591\u05E9</pattern>
    <m>\u05E9\u0592\u05E9</m>
  </test-case>

  <test-case id="test84b" strength="IDENTICAL" locale="en">
    <pattern>\u05E9\u0591\u05E9</pattern>
    <pre>\u05E9\u0592\u05E9</pre>
  </test-case>
</stringsearch-tests>