dungba88 commented on code in PR #12624: URL: https://github.com/apache/lucene/pull/12624#discussion_r1415625009
########## lucene/core/src/test/org/apache/lucene/util/fst/TestFSTDataOutputWriter.java: ########## @@ -0,0 +1,230 @@ +/* + * 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. + */ +package org.apache.lucene.util.fst; + +import static org.apache.lucene.tests.util.fst.FSTTester.toIntsRef; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; +import org.apache.lucene.store.DataInput; +import org.apache.lucene.store.DataOutput; +import org.apache.lucene.store.Directory; +import org.apache.lucene.store.InputStreamDataInput; +import org.apache.lucene.store.OutputStreamDataOutput; +import org.apache.lucene.tests.store.MockDirectoryWrapper; +import org.apache.lucene.tests.util.LuceneTestCase; +import org.apache.lucene.tests.util.TestUtil; +import org.apache.lucene.tests.util.fst.FSTTester; +import org.apache.lucene.util.BytesRef; +import org.apache.lucene.util.IntsRef; + +public class TestFSTDataOutputWriter extends LuceneTestCase { + + private MockDirectoryWrapper dir; + + @Override + public void setUp() throws Exception { + super.setUp(); + dir = newMockDirectory(); + } + + @Override + public void tearDown() throws Exception { + // can be null if we force simpletext (funky, some kind of bug in test runner maybe) + if (dir != null) { + dir.close(); + } + super.tearDown(); + } + + public void testRandom() throws Exception { + + final int iters = atLeast(10); + final int maxBytes = TEST_NIGHTLY ? 200000 : 20000; + for (int iter = 0; iter < iters; iter++) { + final int numBytes = TestUtil.nextInt(random(), 1, maxBytes); + final byte[] expected = new byte[numBytes]; + final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + final DataOutput dataOutput = new OutputStreamDataOutput(baos); Review Comment: Ah I think it was left over code from previous implementation. Will remove it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org