You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/01/26 23:51:44 UTC

svn commit: r1236431 - /lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/fst/TestFSTs.java

Author: mikemccand
Date: Thu Jan 26 22:51:43 2012
New Revision: 1236431

URL: http://svn.apache.org/viewvc?rev=1236431&view=rev
Log:
add test case

Modified:
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/fst/TestFSTs.java

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/fst/TestFSTs.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/fst/TestFSTs.java?rev=1236431&r1=1236430&r2=1236431&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/fst/TestFSTs.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/fst/TestFSTs.java Thu Jan 26 22:51:43 2012
@@ -1890,4 +1890,32 @@ public class TestFSTs extends LuceneTest
     assertFalse(arc.isFinal());
     assertEquals(42, arc.output.longValue());
   }
+
+  public void testLargeOutputsOnArrayArcs() throws Exception {
+    final ByteSequenceOutputs outputs = ByteSequenceOutputs.getSingleton();
+    final Builder<BytesRef> builder = new Builder<BytesRef>(FST.INPUT_TYPE.BYTE1, outputs);
+
+    final byte[] bytes = new byte[300];
+    final IntsRef input = new IntsRef();
+    input.grow(1);
+    input.length = 1;
+    final BytesRef output = new BytesRef(bytes);
+    for(int arc=0;arc<6;arc++) {
+      input.ints[0] = arc;
+      output.bytes[0] = (byte) arc;
+      builder.add(input, BytesRef.deepCopyOf(output));
+    }
+
+    final FST<BytesRef> fst = builder.finish();
+    for(int arc=0;arc<6;arc++) {
+      input.ints[0] = arc;
+      final BytesRef result = Util.get(fst, input);
+      assertNotNull(result);
+      assertEquals(300, result.length);
+      assertEquals(result.bytes[result.offset], arc);
+      for(int byteIDX=1;byteIDX<result.length;byteIDX++) {
+        assertEquals(0, result.bytes[result.offset+byteIDX]);
+      }
+    }
+  }
 }