Lines Matching refs:trie
71 void checkFirst(UCharsTrie &trie, const StringAndValue data[], int32_t dataLength);
72 void checkNext(UCharsTrie &trie, const StringAndValue data[], int32_t dataLength);
73 void checkNextWithState(UCharsTrie &trie, const StringAndValue data[], int32_t dataLength);
74 void checkNextString(UCharsTrie &trie, const StringAndValue data[], int32_t dataLength);
75 void checkIterator(UCharsTrie &trie, const StringAndValue data[], int32_t dataLength);
298 LocalPointer<UCharsTrie> trie(buildTrie(data, UPRV_LENGTHOF(data), USTRINGTRIE_BUILD_FAST)); in TestNextForCodePoint() local
299 if(trie.isNull()) { in TestNextForCodePoint()
303 if( (result=trie->nextForCodePoint(0x4dff))!=USTRINGTRIE_NO_VALUE || result!=trie->current() || in TestNextForCodePoint()
304 (result=trie->nextForCodePoint(0x10000))!=USTRINGTRIE_NO_VALUE || result!=trie->current() || in TestNextForCodePoint()
305 (result=trie->nextForCodePoint(0x9999))!=USTRINGTRIE_NO_VALUE || result!=trie->current() || in TestNextForCodePoint()
306 (result=trie->nextForCodePoint(0x20000))!=USTRINGTRIE_NO_VALUE || result!=trie->current() || in TestNextForCodePoint()
307 (result=trie->nextForCodePoint(0xdfff))!=USTRINGTRIE_NO_VALUE || result!=trie->current() || in TestNextForCodePoint()
308 … (result=trie->nextForCodePoint(0x10ffff))!=USTRINGTRIE_FINAL_VALUE || result!=trie->current() || in TestNextForCodePoint()
309 trie->getValue()!=2000000000 in TestNextForCodePoint()
313 if( (result=trie->firstForCodePoint(0x4dff))!=USTRINGTRIE_NO_VALUE || result!=trie->current() || in TestNextForCodePoint()
314 (result=trie->nextForCodePoint(0x10000))!=USTRINGTRIE_NO_VALUE || result!=trie->current() || in TestNextForCodePoint()
315 (result=trie->nextForCodePoint(0x9999))!=USTRINGTRIE_NO_VALUE || result!=trie->current() || in TestNextForCodePoint()
316 … (result=trie->nextForCodePoint(0x20002))!=USTRINGTRIE_FINAL_VALUE || result!=trie->current() || in TestNextForCodePoint()
317 trie->getValue()!=44444 in TestNextForCodePoint()
321 …if( (result=trie->reset().nextForCodePoint(0x4dff))!=USTRINGTRIE_NO_VALUE || result!=trie->current… in TestNextForCodePoint()
322 (result=trie->nextForCodePoint(0x10000))!=USTRINGTRIE_NO_VALUE || result!=trie->current() || in TestNextForCodePoint()
323 (result=trie->nextForCodePoint(0x9999))!=USTRINGTRIE_NO_VALUE || result!=trie->current() || in TestNextForCodePoint()
324 …(result=trie->nextForCodePoint(0x20222))!=USTRINGTRIE_NO_MATCH || result!=trie->current() // no m… in TestNextForCodePoint()
328 …if( (result=trie->reset().nextForCodePoint(0x4dff))!=USTRINGTRIE_NO_VALUE || result!=trie->current… in TestNextForCodePoint()
329 … (result=trie->nextForCodePoint(0x103ff))!=USTRINGTRIE_FINAL_VALUE || result!=trie->current() || in TestNextForCodePoint()
330 trie->getValue()!=99999 in TestNextForCodePoint()
387 LocalPointer<UCharsTrie> trie(buildLargeTrie(1111)); in TestLargeTrie() local
388 if(trie.isNull()) { in TestLargeTrie()
396 if(trie->first(x[0])==USTRINGTRIE_NO_MATCH) { in TestLargeTrie()
403 UStringTrieResult result=trie->next(x.getBuffer(), x.length()); in TestLargeTrie()
404 if(!USTRINGTRIE_HAS_VALUE(result) || result!=trie->current() || value!=trie->getValue()) { in TestLargeTrie()
466 LocalPointer<UCharsTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_FAST)); in TestHasUniqueValue() local
467 if(trie.isNull()) { in TestHasUniqueValue()
471 if(trie->hasUniqueValue(uniqueValue)) { in TestHasUniqueValue()
474 trie->next(u_j); in TestHasUniqueValue()
475 trie->next(u_a); in TestHasUniqueValue()
476 trie->next(u_n); in TestHasUniqueValue()
478 if(!trie->hasUniqueValue(uniqueValue) || uniqueValue!=1) { in TestHasUniqueValue()
481 trie->first(u_j); in TestHasUniqueValue()
482 trie->next(u_u); in TestHasUniqueValue()
483 if(trie->hasUniqueValue(uniqueValue)) { in TestHasUniqueValue()
486 if(trie->next(u_n)!=USTRINGTRIE_INTERMEDIATE_VALUE || 6!=trie->getValue()) { in TestHasUniqueValue()
490 if(!trie->hasUniqueValue(uniqueValue) || uniqueValue!=6) { in TestHasUniqueValue()
494 trie->first(u_a); in TestHasUniqueValue()
495 trie->next(u_u); in TestHasUniqueValue()
496 if(!trie->hasUniqueValue(uniqueValue) || uniqueValue!=8) { in TestHasUniqueValue()
502 LocalPointer<UCharsTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_SMALL)); in TestGetNextUChars() local
503 if(trie.isNull()) { in TestGetNextUChars()
508 int32_t count=trie->getNextUChars(app); in TestGetNextUChars()
512 trie->next(u_j); in TestGetNextUChars()
513 trie->next(u_a); in TestGetNextUChars()
514 trie->next(u_n); in TestGetNextUChars()
517 count=trie->getNextUChars(app); in TestGetNextUChars()
522 trie->getValue(); // next() had returned USTRINGTRIE_INTERMEDIATE_VALUE. in TestGetNextUChars()
524 count=trie->getNextUChars(app); in TestGetNextUChars()
529 trie->next(u_u); in TestGetNextUChars()
531 count=trie->getNextUChars(app); in TestGetNextUChars()
535 trie->next(u_a); in TestGetNextUChars()
537 count=trie->getNextUChars(app); in TestGetNextUChars()
541 trie->next(u_r); in TestGetNextUChars()
542 trie->next(u_y); in TestGetNextUChars()
545 count=trie->getNextUChars(app); in TestGetNextUChars()
552 LocalPointer<UCharsTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_FAST)); in TestIteratorFromBranch() local
553 if(trie.isNull()) { in TestIteratorFromBranch()
557 trie->next(u_j); in TestIteratorFromBranch()
558 trie->next(u_a); in TestIteratorFromBranch()
559 trie->next(u_n); in TestIteratorFromBranch()
561 UCharsTrie::Iterator iter(*trie, 0, errorCode); in TestIteratorFromBranch()
601 LocalPointer<UCharsTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_SMALL)); in TestIteratorFromLinearMatch() local
602 if(trie.isNull()) { in TestIteratorFromLinearMatch()
606 trie->next(u_j); in TestIteratorFromLinearMatch()
607 trie->next(u_a); in TestIteratorFromLinearMatch()
608 trie->next(u_n); in TestIteratorFromLinearMatch()
609 trie->next(u_u); in TestIteratorFromLinearMatch()
610 trie->next(u_a); in TestIteratorFromLinearMatch()
612 UCharsTrie::Iterator iter(*trie, 0, errorCode); in TestIteratorFromLinearMatch()
629 LocalPointer<UCharsTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_FAST)); in TestTruncatingIteratorFromRoot() local
630 if(trie.isNull()) { in TestTruncatingIteratorFromRoot()
634 UCharsTrie::Iterator iter(*trie, 4, errorCode); in TestTruncatingIteratorFromRoot()
680 LocalPointer<UCharsTrie> trie(buildTrie(data, UPRV_LENGTHOF(data), USTRINGTRIE_BUILD_FAST)); in TestTruncatingIteratorFromLinearMatchShort() local
681 if(trie.isNull()) { in TestTruncatingIteratorFromLinearMatchShort()
685 trie->next(u_a); in TestTruncatingIteratorFromLinearMatchShort()
686 trie->next(u_b); in TestTruncatingIteratorFromLinearMatchShort()
689 UCharsTrie::Iterator iter(*trie, 2, errorCode); in TestTruncatingIteratorFromLinearMatchShort()
708 LocalPointer<UCharsTrie> trie(buildTrie(data, UPRV_LENGTHOF(data), USTRINGTRIE_BUILD_FAST)); in TestTruncatingIteratorFromLinearMatchLong() local
709 if(trie.isNull()) { in TestTruncatingIteratorFromLinearMatchLong()
713 trie->next(u_a); in TestTruncatingIteratorFromLinearMatchLong()
714 trie->next(u_b); in TestTruncatingIteratorFromLinearMatchLong()
715 trie->next(u_c); in TestTruncatingIteratorFromLinearMatchLong()
718 UCharsTrie::Iterator iter(*trie, 3, errorCode); in TestTruncatingIteratorFromLinearMatchLong()
758 LocalPointer<UCharsTrie> trie(buildTrie(data, dataLength, buildOption)); in checkData() local
759 if(trie.isNull()) { in checkData()
762 checkFirst(*trie, data, dataLength); in checkData()
763 checkNext(*trie, data, dataLength); in checkData()
764 checkNextWithState(*trie, data, dataLength); in checkData()
765 checkNextString(*trie, data, dataLength); in checkData()
766 checkIterator(*trie, data, dataLength); in checkData()
794 LocalPointer<UCharsTrie> trie(builder_->build(buildOption, errorCode)); in buildTrie() local
814 return trie.orphan(); in buildTrie()
820 void UCharsTrieTest::checkFirst(UCharsTrie &trie, in checkFirst() argument
829 UStringTrieResult firstResult=trie.first(c); in checkFirst()
830 int32_t firstValue=USTRINGTRIE_HAS_VALUE(firstResult) ? trie.getValue() : -1; in checkFirst()
831 UStringTrieResult nextResult=trie.next(nextCp); in checkFirst()
832 if(firstResult!=trie.reset().next(c) || in checkFirst()
833 firstResult!=trie.current() || in checkFirst()
834 firstValue!=(USTRINGTRIE_HAS_VALUE(firstResult) ? trie.getValue() : -1) || in checkFirst()
835 nextResult!=trie.next(nextCp) in checkFirst()
843 firstResult=trie.firstForCodePoint(c); in checkFirst()
844 firstValue=USTRINGTRIE_HAS_VALUE(firstResult) ? trie.getValue() : -1; in checkFirst()
845 nextResult=trie.nextForCodePoint(nextCp); in checkFirst()
846 if(firstResult!=trie.reset().nextForCodePoint(c) || in checkFirst()
847 firstResult!=trie.current() || in checkFirst()
848 firstValue!=(USTRINGTRIE_HAS_VALUE(firstResult) ? trie.getValue() : -1) || in checkFirst()
849 nextResult!=trie.nextForCodePoint(nextCp) in checkFirst()
855 trie.reset(); in checkFirst()
858 void UCharsTrieTest::checkNext(UCharsTrie &trie, in checkNext() argument
866 result=trie.next(expectedString.getTerminatedBuffer(), stringLength)) || in checkNext()
867 result!=trie.current() in checkNext()
870 } else if(trie.getValue()!=data[i].value) { in checkNext()
873 (long)trie.getValue(), (long)trie.getValue(), in checkNext()
875 } else if(result!=trie.current() || trie.getValue()!=data[i].value) { in checkNext()
878 trie.reset(); in checkNext()
880 result=trie.current(); in checkNext()
887 trie.getValue(); in checkNext()
888 if(trie.current()!=USTRINGTRIE_INTERMEDIATE_VALUE) { in checkNext()
893 result=trie.next(expectedString[j]); in checkNext()
898 if(result!=trie.current()) { in checkNext()
907 trie.getValue(); in checkNext()
908 if(result!=trie.current()) { in checkNext()
913 trie.saveState(state); in checkNext()
919 if(trie.resetToState(state).next(c)) { in checkNext()
928 trie.reset(); in checkNext()
932 void UCharsTrieTest::checkNextWithState(UCharsTrie &trie, in checkNextWithState() argument
938 trie.resetToState(noState); in checkNextWithState()
944 if(!USTRINGTRIE_MATCHES(trie.next(expectedString[j]))) { in checkNextWithState()
949 trie.saveState(state); in checkNextWithState()
950 UStringTrieResult resultAtState=trie.current(); in checkNextWithState()
954 valueAtState=trie.getValue(); in checkNextWithState()
956 result=trie.next(0); // mismatch in checkNextWithState()
957 if(result!=USTRINGTRIE_NO_MATCH || result!=trie.current()) { in checkNextWithState()
960 if( resultAtState!=trie.resetToState(state).current() || in checkNextWithState()
961 (USTRINGTRIE_HAS_VALUE(resultAtState) && valueAtState!=trie.getValue()) in checkNextWithState()
967 result=trie.next(expectedString.getTerminatedBuffer()+partialLength, in checkNextWithState()
969 result!=trie.current()) { in checkNextWithState()
974 result=trie.resetToState(state). in checkNextWithState()
977 result!=trie.current()) { in checkNextWithState()
980 } else if(trie.getValue()!=data[i].value) { in checkNextWithState()
983 (long)trie.getValue(), (long)trie.getValue(), in checkNextWithState()
986 trie.reset(); in checkNextWithState()
992 void UCharsTrieTest::checkNextString(UCharsTrie &trie, in checkNextString() argument
997 if(!trie.next(expectedString.getTerminatedBuffer(), stringLength/2)) { in checkNextString()
1002 if(trie.next(expectedString.getTerminatedBuffer()+stringLength/2, in checkNextString()
1006 trie.reset(); in checkNextString()
1010 void UCharsTrieTest::checkIterator(UCharsTrie &trie, in checkIterator() argument
1013 UCharsTrie::Iterator iter(trie, 0, errorCode); in checkIterator()