Lines Matching refs:trie
61 void checkFirst(BytesTrie &trie, const StringAndValue data[], int32_t dataLength);
62 void checkNext(BytesTrie &trie, const StringAndValue data[], int32_t dataLength);
63 void checkNextWithState(BytesTrie &trie, const StringAndValue data[], int32_t dataLength);
64 void checkNextString(BytesTrie &trie, const StringAndValue data[], int32_t dataLength);
65 void checkIterator(const BytesTrie &trie, const StringAndValue data[], int32_t dataLength);
306 LocalPointer<BytesTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_FAST)); in TestHasUniqueValue() local
307 if(trie.isNull()) { in TestHasUniqueValue()
311 if(trie->hasUniqueValue(uniqueValue)) { in TestHasUniqueValue()
314 trie->next('j'); in TestHasUniqueValue()
315 trie->next('a'); in TestHasUniqueValue()
316 trie->next('n'); in TestHasUniqueValue()
318 if(!trie->hasUniqueValue(uniqueValue) || uniqueValue!=1) { in TestHasUniqueValue()
321 trie->first('j'); in TestHasUniqueValue()
322 trie->next('u'); in TestHasUniqueValue()
323 if(trie->hasUniqueValue(uniqueValue)) { in TestHasUniqueValue()
326 if(trie->next('n')!=USTRINGTRIE_INTERMEDIATE_VALUE || 6!=trie->getValue()) { in TestHasUniqueValue()
330 if(!trie->hasUniqueValue(uniqueValue) || uniqueValue!=6) { in TestHasUniqueValue()
334 trie->first('a'); in TestHasUniqueValue()
335 trie->next('u'); in TestHasUniqueValue()
336 if(!trie->hasUniqueValue(uniqueValue) || uniqueValue!=8) { in TestHasUniqueValue()
342 LocalPointer<BytesTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_SMALL)); in TestGetNextBytes() local
343 if(trie.isNull()) { in TestGetNextBytes()
348 int32_t count=trie->getNextBytes(sink); in TestGetNextBytes()
352 trie->next('j'); in TestGetNextBytes()
353 trie->next('a'); in TestGetNextBytes()
354 trie->next('n'); in TestGetNextBytes()
356 count=trie->getNextBytes(sink.Reset()); in TestGetNextBytes()
362 trie->getValue(); // next() had returned USTRINGTRIE_INTERMEDIATE_VALUE. in TestGetNextBytes()
364 count=trie->getNextBytes(sink.Reset()); in TestGetNextBytes()
369 trie->next('u'); in TestGetNextBytes()
371 count=trie->getNextBytes(sink.Reset()); in TestGetNextBytes()
375 trie->next('a'); in TestGetNextBytes()
377 count=trie->getNextBytes(sink.Reset()); in TestGetNextBytes()
381 trie->next('r'); in TestGetNextBytes()
382 trie->next('y'); in TestGetNextBytes()
384 count=trie->getNextBytes(sink.Reset()); in TestGetNextBytes()
391 LocalPointer<BytesTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_FAST)); in TestIteratorFromBranch() local
392 if(trie.isNull()) { in TestIteratorFromBranch()
396 trie->next('j'); in TestIteratorFromBranch()
397 trie->next('a'); in TestIteratorFromBranch()
398 trie->next('n'); in TestIteratorFromBranch()
400 BytesTrie::Iterator iter(*trie, 0, errorCode); in TestIteratorFromBranch()
440 LocalPointer<BytesTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_SMALL)); in TestIteratorFromLinearMatch() local
441 if(trie.isNull()) { in TestIteratorFromLinearMatch()
445 trie->next('j'); in TestIteratorFromLinearMatch()
446 trie->next('a'); in TestIteratorFromLinearMatch()
447 trie->next('n'); in TestIteratorFromLinearMatch()
448 trie->next('u'); in TestIteratorFromLinearMatch()
449 trie->next('a'); in TestIteratorFromLinearMatch()
451 BytesTrie::Iterator iter(*trie, 0, errorCode); in TestIteratorFromLinearMatch()
468 LocalPointer<BytesTrie> trie(buildMonthsTrie(USTRINGTRIE_BUILD_FAST)); in TestTruncatingIteratorFromRoot() local
469 if(trie.isNull()) { in TestTruncatingIteratorFromRoot()
473 BytesTrie::Iterator iter(*trie, 4, errorCode); in TestTruncatingIteratorFromRoot()
519 LocalPointer<BytesTrie> trie(buildTrie(data, UPRV_LENGTHOF(data), USTRINGTRIE_BUILD_FAST)); in TestTruncatingIteratorFromLinearMatchShort() local
520 if(trie.isNull()) { in TestTruncatingIteratorFromLinearMatchShort()
524 trie->next('a'); in TestTruncatingIteratorFromLinearMatchShort()
525 trie->next('b'); in TestTruncatingIteratorFromLinearMatchShort()
528 BytesTrie::Iterator iter(*trie, 2, errorCode); in TestTruncatingIteratorFromLinearMatchShort()
547 LocalPointer<BytesTrie> trie(buildTrie(data, UPRV_LENGTHOF(data), USTRINGTRIE_BUILD_FAST)); in TestTruncatingIteratorFromLinearMatchLong() local
548 if(trie.isNull()) { in TestTruncatingIteratorFromLinearMatchLong()
552 trie->next('a'); in TestTruncatingIteratorFromLinearMatchLong()
553 trie->next('b'); in TestTruncatingIteratorFromLinearMatchLong()
554 trie->next('c'); in TestTruncatingIteratorFromLinearMatchLong()
557 BytesTrie::Iterator iter(*trie, 3, errorCode); in TestTruncatingIteratorFromLinearMatchLong()
596 LocalPointer<BytesTrie> trie(buildTrie(data, dataLength, buildOption)); in checkData() local
597 if(trie.isNull()) { in checkData()
600 checkFirst(*trie, data, dataLength); in checkData()
601 checkNext(*trie, data, dataLength); in checkData()
602 checkNextWithState(*trie, data, dataLength); in checkData()
603 checkNextString(*trie, data, dataLength); in checkData()
604 checkIterator(*trie, data, dataLength); in checkData()
630 LocalPointer<BytesTrie> trie(builder_->build(buildOption, errorCode)); in buildTrie() local
649 return trie.orphan(); in buildTrie()
655 void BytesTrieTest::checkFirst(BytesTrie &trie, in checkFirst() argument
662 UStringTrieResult firstResult=trie.first(c); in checkFirst()
663 int32_t firstValue=USTRINGTRIE_HAS_VALUE(firstResult) ? trie.getValue() : -1; in checkFirst()
664 UStringTrieResult nextResult=trie.next(data[i].s[1]); in checkFirst()
665 if(firstResult!=trie.reset().next(c) || in checkFirst()
666 firstResult!=trie.current() || in checkFirst()
667 firstValue!=(USTRINGTRIE_HAS_VALUE(firstResult) ? trie.getValue() : -1) || in checkFirst()
668 nextResult!=trie.next(data[i].s[1]) in checkFirst()
674 trie.reset(); in checkFirst()
677 void BytesTrieTest::checkNext(BytesTrie &trie, in checkNext() argument
683 if( !USTRINGTRIE_HAS_VALUE(result=trie.next(data[i].s, stringLength)) || in checkNext()
684 result!=trie.current() in checkNext()
687 } else if(trie.getValue()!=data[i].value) { in checkNext()
690 (long)trie.getValue(), (long)trie.getValue(), in checkNext()
692 } else if(result!=trie.current() || trie.getValue()!=data[i].value) { in checkNext()
695 trie.reset(); in checkNext()
697 result=trie.current(); in checkNext()
704 trie.getValue(); in checkNext()
705 if(trie.current()!=USTRINGTRIE_INTERMEDIATE_VALUE) { in checkNext()
710 result=trie.next(data[i].s[j]); in checkNext()
715 if(result!=trie.current()) { in checkNext()
724 trie.getValue(); in checkNext()
725 if(result!=trie.current()) { in checkNext()
730 trie.saveState(state); in checkNext()
744 if(trie.resetToState(state).next(c)) { in checkNext()
753 trie.reset(); in checkNext()
757 void BytesTrieTest::checkNextWithState(BytesTrie &trie, in checkNextWithState() argument
763 trie.resetToState(noState); in checkNextWithState()
769 if(!USTRINGTRIE_MATCHES(trie.next(expectedString[j]))) { in checkNextWithState()
774 trie.saveState(state); in checkNextWithState()
775 UStringTrieResult resultAtState=trie.current(); in checkNextWithState()
779 valueAtState=trie.getValue(); in checkNextWithState()
781 result=trie.next(0); // mismatch in checkNextWithState()
782 if(result!=USTRINGTRIE_NO_MATCH || result!=trie.current()) { in checkNextWithState()
785 if( resultAtState!=trie.resetToState(state).current() || in checkNextWithState()
786 (USTRINGTRIE_HAS_VALUE(resultAtState) && valueAtState!=trie.getValue()) in checkNextWithState()
792 result=trie.next(expectedString+partialLength, in checkNextWithState()
794 result!=trie.current()) { in checkNextWithState()
799 result=trie.resetToState(state). in checkNextWithState()
802 result!=trie.current()) { in checkNextWithState()
805 } else if(trie.getValue()!=data[i].value) { in checkNextWithState()
808 (long)trie.getValue(), (long)trie.getValue(), in checkNextWithState()
811 trie.reset(); in checkNextWithState()
817 void BytesTrieTest::checkNextString(BytesTrie &trie, in checkNextString() argument
822 if(!trie.next(expectedString, stringLength/2)) { in checkNextString()
827 if(trie.next(expectedString+stringLength/2, stringLength+1-stringLength/2)) { in checkNextString()
830 trie.reset(); in checkNextString()
834 void BytesTrieTest::checkIterator(const BytesTrie &trie, in checkIterator() argument
837 BytesTrie::Iterator iter(trie, 0, errorCode); in checkIterator()