You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2012/01/12 18:59:49 UTC
svn commit: r1230673 -
/lucene/dev/branches/lucene3305/modules/analysis/kuromoji/src/test/org/apache/lucene/analysis/kuromoji/dict/TestTokenInfoDictionary.java
Author: rmuir
Date: Thu Jan 12 17:59:48 2012
New Revision: 1230673
URL: http://svn.apache.org/viewvc?rev=1230673&view=rev
Log:
LUCENE-3305: strengthen test a bit more
Modified:
lucene/dev/branches/lucene3305/modules/analysis/kuromoji/src/test/org/apache/lucene/analysis/kuromoji/dict/TestTokenInfoDictionary.java
Modified: lucene/dev/branches/lucene3305/modules/analysis/kuromoji/src/test/org/apache/lucene/analysis/kuromoji/dict/TestTokenInfoDictionary.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3305/modules/analysis/kuromoji/src/test/org/apache/lucene/analysis/kuromoji/dict/TestTokenInfoDictionary.java?rev=1230673&r1=1230672&r2=1230673&view=diff
==============================================================================
--- lucene/dev/branches/lucene3305/modules/analysis/kuromoji/src/test/org/apache/lucene/analysis/kuromoji/dict/TestTokenInfoDictionary.java (original)
+++ lucene/dev/branches/lucene3305/modules/analysis/kuromoji/src/test/org/apache/lucene/analysis/kuromoji/dict/TestTokenInfoDictionary.java Thu Jan 12 17:59:48 2012
@@ -32,6 +32,8 @@ public class TestTokenInfoDictionary ext
// just for debugging
int numTerms = 0;
int numWords = 0;
+ int lastWordId = -1;
+ int lastSourceId = -1;
TokenInfoDictionary tid = TokenInfoDictionary.getInstance();
ConnectionCosts matrix = ConnectionCosts.getInstance();
FST<Long> fst = tid.getFST().getInternalFST();
@@ -48,10 +50,16 @@ public class TestTokenInfoDictionary ext
assertTrue(UnicodeUtil.validUTF16String(new String(chars)));
Long output = mapping.output;
- tid.lookupWordIds(output.intValue(), scratch);
+ int sourceId = output.intValue();
+ // we walk in order, terms, sourceIds, and wordIds should always be increasing
+ assertTrue(sourceId > lastSourceId);
+ lastSourceId = sourceId;
+ tid.lookupWordIds(sourceId, scratch);
for (int i = 0; i < scratch.length; i++) {
numWords++;
int wordId = scratch.ints[scratch.offset+i];
+ assertTrue(wordId > lastWordId);
+ lastWordId = wordId;
String baseForm = tid.getBaseForm(wordId);
assertTrue(baseForm == null || UnicodeUtil.validUTF16String(baseForm));