Lines Matching refs:index

31 UnicodeString joinLabelsAndAppend(AlphabeticIndex::ImmutableIndex &index, UnicodeString &dest) {  in joinLabelsAndAppend()  argument
34 for (int32_t i = 0; (bucket = index.getBucket(i)) != NULL; ++i) { in joinLabelsAndAppend()
51 void AlphabeticIndexTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par… in runIndexedTest() argument
86 AlphabeticIndex *index = new AlphabeticIndex(Locale::getEnglish(), status); in APITest() local
88 lc = index->getBucketCount(status); in APITest()
92 delete index; in APITest()
101 index = new AlphabeticIndex(coll, status); in APITest()
103 TEST_ASSERT(coll == &index->getCollator()); in APITest()
105 1, index->getBucketCount(status)); in APITest()
107 delete index; in APITest()
113 index = new AlphabeticIndex(Locale::getEnglish(), status); in APITest()
117 index->addLabels(additions, status); in APITest()
119 lc = index->getBucketCount(status); in APITest()
122 31, index->getBucketCount(status)); in APITest()
124 delete index; in APITest()
130 index = new AlphabeticIndex(Locale::getEnglish(), status); in APITest()
132 AlphabeticIndex &aip = index->addLabels(Locale::getJapanese(), status); in APITest()
133 TEST_ASSERT(&aip == index); in APITest()
135 lc = index->getBucketCount(status); in APITest()
138 delete index; in APITest()
143 index = new AlphabeticIndex(Locale::getGerman(), status); in APITest()
147 const RuleBasedCollator &indexCol = index->getCollator(); in APITest()
152 UnicodeString s = index->getUnderflowLabel(); in APITest()
154 s = index->getOverflowLabel(); in APITest()
156 s = index->getInflowLabel(); in APITest()
158 index->setOverflowLabel(UNICODE_STRING_SIMPLE("O"), status); in APITest()
159index->setUnderflowLabel(UNICODE_STRING_SIMPLE("U"), status).setInflowLabel(UNICODE_STRING_SIMPLE(… in APITest()
160 s = index->getUnderflowLabel(); in APITest()
162 s = index->getOverflowLabel(); in APITest()
164 s = index->getInflowLabel(); in APITest()
170 delete index; in APITest()
184 index = new AlphabeticIndex(Locale::getEnglish(), status); in APITest()
186 index->addRecord(UnicodeString("Adam"), this, status); in APITest()
189 index->resetBucketIterator(status); in APITest()
191 index->nextBucket(status); // Move to underflow label in APITest()
192 index->nextBucket(status); // Move to "A" in APITest()
194 const UnicodeString &label2 = index->getBucketLabel(); in APITest()
198 b = index->nextRecord(status); in APITest()
201 const UnicodeString &itemName = index->getRecordName(); in APITest()
204 const void *itemContext = index->getRecordData(); in APITest()
207 delete index; in APITest()
212 index = new AlphabeticIndex(Locale::getEnglish(), status); in APITest()
214 while (index->nextBucket(status)) { in APITest()
216 while (index->nextRecord(status)) { in APITest()
223 index->addRecord(adam, NULL, status); in APITest()
224 index->addRecord(baker, NULL, status); in APITest()
225 index->addRecord(charlie, NULL, status); in APITest()
226 index->addRecord(chad, NULL, status); in APITest()
229 index->resetBucketIterator(status); in APITest()
230 while (index->nextBucket(status)) { in APITest()
232 while (index->nextRecord(status)) { in APITest()
240 TEST_ASSERT(index->nextBucket(status) == FALSE); in APITest()
241 index->resetBucketIterator(status); in APITest()
243 TEST_ASSERT(index->nextBucket(status) == TRUE); in APITest()
245 index->clearRecords(status); in APITest()
247 index->resetBucketIterator(status); in APITest()
248 while (index->nextBucket(status)) { in APITest()
250 while (index->nextRecord(status)) { in APITest()
255 delete index; in APITest()
260 index = new AlphabeticIndex(Locale::getEnglish(), status); in APITest()
262 index->setUnderflowLabel(adam, status).setOverflowLabel(charlie, status); in APITest()
264 for (i=0; index->nextBucket(status); i++) { in APITest()
266 UnicodeString label = index->getBucketLabel(); in APITest()
267 UAlphabeticIndexLabelType type = index->getBucketLabelType(); in APITest()
284 delete index; in APITest()
289 index = new AlphabeticIndex(Locale::getEnglish(), status); in APITest()
291 int32_t n = index->getBucketIndex(adam, status); in APITest()
294 n = index->getBucketIndex(baker, status); in APITest()
296 n = index->getBucketIndex(Cyrillic, status); in APITest()
298 n = index->getBucketIndex(zed, status); in APITest()
301 for (i=0; index->nextBucket(status); i++) { in APITest()
302 n = index->getBucketIndex(); in APITest()
304 UnicodeString label = index->getBucketLabel(); in APITest()
309 delete index; in APITest()
310 index = new AlphabeticIndex(Locale::createFromName("ru"), status); in APITest()
312 assertEquals("Russian index.getBucketCount()", 32, index->getBucketCount(status)); in APITest()
319 … if (index->getCollator().getReorderCodes(reorderCodes, UPRV_LENGTHOF(reorderCodes), status) > 0) { in APITest()
320 expectedLatinIndex = index->getBucketCount(status) - 1; in APITest()
322 n = index->getBucketIndex(adam, status); in APITest()
325 n = index->getBucketIndex(baker, status); in APITest()
327 n = index->getBucketIndex(Cyrillic, status); in APITest()
329 n = index->getBucketIndex(zed, status); in APITest()
332 delete index; in APITest()
358 AlphabeticIndex index(loc, status); in ManyLocalesTest() local
360 lc = index.getBucketCount(status); in ManyLocalesTest()
364 LocalPointer<AlphabeticIndex::ImmutableIndex> immIndex(index.buildImmutableIndex(status)); in ManyLocalesTest()
368 assertEquals("initial bucket index", -1, index.getBucketIndex()); in ManyLocalesTest()
370 while (index.nextBucket(status)) { in ManyLocalesTest()
372 assertEquals("bucket index", bucketIndex, index.getBucketIndex()); in ManyLocalesTest()
373 const UnicodeString &label = index.getBucketLabel(); in ManyLocalesTest()
383 UAlphabeticIndexLabelType labelType = index.getBucketLabelType(); in ManyLocalesTest()
532 AlphabeticIndex index(locale, status); in TestIndexCharactersList() local
534 LocalPointer<AlphabeticIndex::ImmutableIndex> immIndex(index.buildImmutableIndex(status)); in TestIndexCharactersList()
558 AlphabeticIndex index(coll.orphan(), status); in TestHaniFirst() local
560 assertEquals("getBucketCount()", 1, index.getBucketCount(status)); // ... (underflow only) in TestHaniFirst()
561 index.addLabels(Locale::getEnglish(), status); in TestHaniFirst()
562 assertEquals("getBucketCount()", 28, index.getBucketCount(status)); // ... A-Z ... in TestHaniFirst()
563 int32_t bucketIndex = index.getBucketIndex(UnicodeString((UChar)0x897f), status); in TestHaniFirst()
565 bucketIndex = index.getBucketIndex("i", status); in TestHaniFirst()
567 bucketIndex = index.getBucketIndex(UnicodeString((UChar)0x03B1), status); in TestHaniFirst()
570 bucketIndex = index.getBucketIndex(UnicodeString(0x50005), status); in TestHaniFirst()
572 bucketIndex = index.getBucketIndex(UnicodeString((UChar)0xFFFF), status); in TestHaniFirst()
587 AlphabeticIndex index(coll.orphan(), status); in TestPinyinFirst() local
589 assertEquals("getBucketCount()", 28, index.getBucketCount(status)); // ... A-Z ... in TestPinyinFirst()
590 index.addLabels(Locale::getChinese(), status); in TestPinyinFirst()
591 assertEquals("getBucketCount()", 28, index.getBucketCount(status)); // ... A-Z ... in TestPinyinFirst()
592 int32_t bucketIndex = index.getBucketIndex(UnicodeString((UChar)0x897f), status); in TestPinyinFirst()
594 bucketIndex = index.getBucketIndex("i", status); in TestPinyinFirst()
596 bucketIndex = index.getBucketIndex(UnicodeString((UChar)0x03B1), status); in TestPinyinFirst()
599 bucketIndex = index.getBucketIndex(UnicodeString(0x50005), status); in TestPinyinFirst()
601 bucketIndex = index.getBucketIndex(UnicodeString((UChar)0xFFFF), status); in TestPinyinFirst()
607 AlphabeticIndex index(Locale::getGerman(), status); in TestSchSt() local
608 index.addLabels(UnicodeSet("[\\u00C6{Sch*}{St*}]", status), status); in TestSchSt()
611 LocalPointer<AlphabeticIndex::ImmutableIndex> immIndex(index.buildImmutableIndex(status)); in TestSchSt()
613 assertEquals("getBucketCount()", 31, index.getBucketCount(status)); in TestSchSt()
640 assertEquals(msg, testCase.bucketIndex, index.getBucketIndex(name, status)); in TestSchSt()
653 AlphabeticIndex index(coll.orphan(), status); in TestNoLabels() local
655 index.addRecord(UnicodeString((UChar)0x897f), NULL, status); in TestNoLabels()
656 index.addRecord("i", NULL, status); in TestNoLabels()
657 index.addRecord(UnicodeString((UChar)0x03B1), NULL, status); in TestNoLabels()
658 assertEquals("getBucketCount()", 1, index.getBucketCount(status)); // ... in TestNoLabels()
659 TEST_ASSERT(index.nextBucket(status)); in TestNoLabels()
660 … assertEquals("underflow label type", (int32_t)U_ALPHAINDEX_UNDERFLOW, index.getBucketLabelType()); in TestNoLabels()
661 assertEquals("all records in the underflow bucket", (int32_t)3, index.getBucketRecordCount()); in TestNoLabels()
668 AlphabeticIndex index(loc, status); in TestChineseZhuyin() local
669 LocalPointer<AlphabeticIndex::ImmutableIndex> immIndex(index.buildImmutableIndex(status)); in TestChineseZhuyin()
681 AlphabeticIndex index(Locale::getJapanese(), status); in TestJapaneseKanji() local
682 LocalPointer<AlphabeticIndex::ImmutableIndex> immIndex(index.buildImmutableIndex(status)); in TestJapaneseKanji()
698 AlphabeticIndex index("zh-u-co-unihan", status); in TestChineseUnihan() local
703 index.setMaxLabelCount(500, status); // ICU 54 default is 99. in TestChineseUnihan()
704 LocalPointer<AlphabeticIndex::ImmutableIndex> immIndex(index.buildImmutableIndex(status)); in TestChineseUnihan()
718 int32_t bucketIndex = index.getBucketIndex(UnicodeString((UChar)0x4e5d), status); in TestChineseUnihan()
721 bucketIndex = index.getBucketIndex(UnicodeString((UChar)0x7527), status); in TestChineseUnihan()