Index: lucene/core/src/test/org/apache/lucene/util/fst/Test2BFST.java =================================================================== --- lucene/core/src/test/org/apache/lucene/util/fst/Test2BFST.java (revision 0) +++ lucene/core/src/test/org/apache/lucene/util/fst/Test2BFST.java (working copy) @@ -0,0 +1,63 @@ +package org.apache.lucene.util.fst; + +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.lucene.util.BytesRef; +import org.apache.lucene.util.IntsRef; +import org.apache.lucene.util.LuceneTestCase; +import org.junit.Ignore; + +// nocommit +@Ignore("Requires tons of heap to run") +public class Test2BFST extends LuceneTestCase { + + public void test() throws Exception { + Outputs outputs = ByteSequenceOutputs.getSingleton(); + final Builder b = new Builder(FST.INPUT_TYPE.BYTE1, outputs); + + int[] ints = new int[5]; + IntsRef input = new IntsRef(ints, 0, 5); + + byte[] outputBytes = new byte[20]; + BytesRef output = new BytesRef(outputBytes); + int count = 0; + while(true) { + random().nextBytes(outputBytes); + //System.out.println("add: " + input + " -> " + output); + // nocommit: why, if i fail to make deep copy of the + // output, does FST not grow!? + b.add(input, BytesRef.deepCopyOf(output)); + count++; + if (count % 100000 == 0) { + System.out.println(count + "...: " + b.fst.sizeInBytes() + " bytes"); + } + + int downTo = ints.length-1; + while(downTo >= 0) { + if (ints[downTo] < 255) { + ints[downTo]++; + break; + } else { + ints[downTo] = 0; + downTo--; + } + } + + } + } +} Property changes on: lucene/core/src/test/org/apache/lucene/util/fst/Test2BFST.java ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property