Lines Matching refs:trie
64 void checkFirst(BytesTrie &trie, const StringAndValue data[], int32_t dataLength);
65 void checkNext(BytesTrie &trie, const StringAndValue data[], int32_t dataLength);
66 void checkNextWithState(BytesTrie &trie, const StringAndValue data[], int32_t dataLength);
67 void checkNextString(BytesTrie &trie, const StringAndValue data[], int32_t dataLength);
68 void checkIterator(const BytesTrie &trie, const StringAndValue data[], int32_t dataLength);
310 LocalPointer<BytesTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_FAST)); in TestHasUniqueValue() local
311 if(trie.isNull()) { in TestHasUniqueValue()
315 if(trie->hasUniqueValue(uniqueValue)) { in TestHasUniqueValue()
318 trie->next('j'); in TestHasUniqueValue()
319 trie->next('a'); in TestHasUniqueValue()
320 trie->next('n'); in TestHasUniqueValue()
322 if(!trie->hasUniqueValue(uniqueValue) || uniqueValue!=1) { in TestHasUniqueValue()
325 trie->first('j'); in TestHasUniqueValue()
326 trie->next('u'); in TestHasUniqueValue()
327 if(trie->hasUniqueValue(uniqueValue)) { in TestHasUniqueValue()
330 if(trie->next('n')!=USTRINGTRIE_INTERMEDIATE_VALUE || 6!=trie->getValue()) { in TestHasUniqueValue()
334 if(!trie->hasUniqueValue(uniqueValue) || uniqueValue!=6) { in TestHasUniqueValue()
338 trie->first('a'); in TestHasUniqueValue()
339 trie->next('u'); in TestHasUniqueValue()
340 if(!trie->hasUniqueValue(uniqueValue) || uniqueValue!=8) { in TestHasUniqueValue()
346 LocalPointer<BytesTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_SMALL)); in TestGetNextBytes() local
347 if(trie.isNull()) { in TestGetNextBytes()
352 int32_t count=trie->getNextBytes(sink); in TestGetNextBytes()
356 trie->next('j'); in TestGetNextBytes()
357 trie->next('a'); in TestGetNextBytes()
358 trie->next('n'); in TestGetNextBytes()
360 count=trie->getNextBytes(sink.Reset()); in TestGetNextBytes()
366 trie->getValue(); // next() had returned USTRINGTRIE_INTERMEDIATE_VALUE. in TestGetNextBytes()
368 count=trie->getNextBytes(sink.Reset()); in TestGetNextBytes()
373 trie->next('u'); in TestGetNextBytes()
375 count=trie->getNextBytes(sink.Reset()); in TestGetNextBytes()
379 trie->next('a'); in TestGetNextBytes()
381 count=trie->getNextBytes(sink.Reset()); in TestGetNextBytes()
385 trie->next('r'); in TestGetNextBytes()
386 trie->next('y'); in TestGetNextBytes()
388 count=trie->getNextBytes(sink.Reset()); in TestGetNextBytes()
395 LocalPointer<BytesTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_FAST)); in TestIteratorFromBranch() local
396 if(trie.isNull()) { in TestIteratorFromBranch()
400 trie->next('j'); in TestIteratorFromBranch()
401 trie->next('a'); in TestIteratorFromBranch()
402 trie->next('n'); in TestIteratorFromBranch()
404 BytesTrie::Iterator iter(*trie, 0, errorCode); in TestIteratorFromBranch()
444 LocalPointer<BytesTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_SMALL)); in TestIteratorFromLinearMatch() local
445 if(trie.isNull()) { in TestIteratorFromLinearMatch()
449 trie->next('j'); in TestIteratorFromLinearMatch()
450 trie->next('a'); in TestIteratorFromLinearMatch()
451 trie->next('n'); in TestIteratorFromLinearMatch()
452 trie->next('u'); in TestIteratorFromLinearMatch()
453 trie->next('a'); in TestIteratorFromLinearMatch()
455 BytesTrie::Iterator iter(*trie, 0, errorCode); in TestIteratorFromLinearMatch()
472 LocalPointer<BytesTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_FAST)); in TestTruncatingIteratorFromRoot() local
473 if(trie.isNull()) { in TestTruncatingIteratorFromRoot()
477 BytesTrie::Iterator iter(*trie, 4, errorCode); in TestTruncatingIteratorFromRoot()
523 LocalPointer<BytesTrie> trie(buildTrie(data, UPRV_LENGTHOF(data), USTRINGTRIE_BUILD_FAST)); in TestTruncatingIteratorFromLinearMatchShort() local
524 if(trie.isNull()) { in TestTruncatingIteratorFromLinearMatchShort()
528 trie->next('a'); in TestTruncatingIteratorFromLinearMatchShort()
529 trie->next('b'); in TestTruncatingIteratorFromLinearMatchShort()
532 BytesTrie::Iterator iter(*trie, 2, errorCode); in TestTruncatingIteratorFromLinearMatchShort()
551 LocalPointer<BytesTrie> trie(buildTrie(data, UPRV_LENGTHOF(data), USTRINGTRIE_BUILD_FAST)); in TestTruncatingIteratorFromLinearMatchLong() local
552 if(trie.isNull()) { in TestTruncatingIteratorFromLinearMatchLong()
556 trie->next('a'); in TestTruncatingIteratorFromLinearMatchLong()
557 trie->next('b'); in TestTruncatingIteratorFromLinearMatchLong()
558 trie->next('c'); in TestTruncatingIteratorFromLinearMatchLong()
561 BytesTrie::Iterator iter(*trie, 3, errorCode); in TestTruncatingIteratorFromLinearMatchLong()
609 LocalPointer<BytesTrie> trie(buildTrie(data, dataLength, buildOption)); in checkData() local
610 if(trie.isNull()) { in checkData()
613 checkFirst(*trie, data, dataLength); in checkData()
614 checkNext(*trie, data, dataLength); in checkData()
615 checkNextWithState(*trie, data, dataLength); in checkData()
616 checkNextString(*trie, data, dataLength); in checkData()
617 checkIterator(*trie, data, dataLength); in checkData()
643 LocalPointer<BytesTrie> trie(builder_->build(buildOption, errorCode)); in buildTrie() local
662 return trie.orphan(); in buildTrie()
668 void BytesTrieTest::checkFirst(BytesTrie &trie, in checkFirst() argument
675 UStringTrieResult firstResult=trie.first(c); in checkFirst()
676 int32_t firstValue=USTRINGTRIE_HAS_VALUE(firstResult) ? trie.getValue() : -1; in checkFirst()
677 UStringTrieResult nextResult=trie.next(data[i].s[1]); in checkFirst()
678 if(firstResult!=trie.reset().next(c) || in checkFirst()
679 firstResult!=trie.current() || in checkFirst()
680 firstValue!=(USTRINGTRIE_HAS_VALUE(firstResult) ? trie.getValue() : -1) || in checkFirst()
681 nextResult!=trie.next(data[i].s[1]) in checkFirst()
687 trie.reset(); in checkFirst()
690 void BytesTrieTest::checkNext(BytesTrie &trie, in checkNext() argument
696 if( !USTRINGTRIE_HAS_VALUE(result=trie.next(data[i].s, stringLength)) || in checkNext()
697 result!=trie.current() in checkNext()
700 } else if(trie.getValue()!=data[i].value) { in checkNext()
703 (long)trie.getValue(), (long)trie.getValue(), in checkNext()
705 } else if(result!=trie.current() || trie.getValue()!=data[i].value) { in checkNext()
708 trie.reset(); in checkNext()
710 result=trie.current(); in checkNext()
717 trie.getValue(); in checkNext()
718 if(trie.current()!=USTRINGTRIE_INTERMEDIATE_VALUE) { in checkNext()
723 result=trie.next(data[i].s[j]); in checkNext()
728 if(result!=trie.current()) { in checkNext()
737 trie.getValue(); in checkNext()
738 if(result!=trie.current()) { in checkNext()
743 trie.saveState(state); in checkNext()
757 if(trie.resetToState(state).next(c)) { in checkNext()
766 trie.reset(); in checkNext()
770 void BytesTrieTest::checkNextWithState(BytesTrie &trie, in checkNextWithState() argument
776 trie.resetToState(noState); in checkNextWithState()
782 if(!USTRINGTRIE_MATCHES(trie.next(expectedString[j]))) { in checkNextWithState()
787 trie.saveState(state); in checkNextWithState()
788 UStringTrieResult resultAtState=trie.current(); in checkNextWithState()
792 valueAtState=trie.getValue(); in checkNextWithState()
794 result=trie.next(0); // mismatch in checkNextWithState()
795 if(result!=USTRINGTRIE_NO_MATCH || result!=trie.current()) { in checkNextWithState()
798 if( resultAtState!=trie.resetToState(state).current() || in checkNextWithState()
799 (USTRINGTRIE_HAS_VALUE(resultAtState) && valueAtState!=trie.getValue()) in checkNextWithState()
805 result=trie.next(expectedString+partialLength, in checkNextWithState()
807 result!=trie.current()) { in checkNextWithState()
812 result=trie.resetToState(state). in checkNextWithState()
815 result!=trie.current()) { in checkNextWithState()
818 } else if(trie.getValue()!=data[i].value) { in checkNextWithState()
821 (long)trie.getValue(), (long)trie.getValue(), in checkNextWithState()
824 trie.reset(); in checkNextWithState()
830 void BytesTrieTest::checkNextString(BytesTrie &trie, in checkNextString() argument
835 if(!trie.next(expectedString, stringLength/2)) { in checkNextString()
840 if(trie.next(expectedString+stringLength/2, stringLength+1-stringLength/2)) { in checkNextString()
843 trie.reset(); in checkNextString()
847 void BytesTrieTest::checkIterator(const BytesTrie &trie, in checkIterator() argument
850 BytesTrie::Iterator iter(trie, 0, errorCode); in checkIterator()