I am embarking on an ambitious project, the implementation of a Ruby API for the Lucene index file format (name suggestions welcome!). In digging under the covers deeper than ever before, I'm learning lots of what makes Lucene tick. In order to really learn it, I'm writing some unit tests to assert my understanding. Here's an example:

public class InputStreamTest extends TestCase {
public void testReadVInt() throws IOException {
InputStream is = new MockInputStream(new byte[] { (byte) 0x80, 0x01,
(byte) 0xFF, 0x7F,
(byte) 0x80, (byte) 0x80, 0x01,
(byte) 0x81, (byte) 0x80, 0x01});
assertEquals(128,is.readVInt());
assertEquals(16383,is.readVInt());
assertEquals(16384,is.readVInt());
assertEquals(16385,is.readVInt());
}
}


The MockInputStream is a Lucene InputStream subclass that simply feeds out the bytes, similar to the RAMDirectory$RAMInputStream. The above asserts come directly from the documentation on the file format description of VInt I don't believe there are existing unit tests that are asserting features at this low of a level, are there?

I would like to make these unit tests part of Lucene's codebase.

Is it bad form to propose myself as a committer to CVS on Lucene? I'm already a jakarta-lucene-sandbox and Ant committer (and also a committer on the SourceForge XDoclet project), as well as a newly elected ASF Member - just so you know I'll be responsible with the codebase :) It would be more fun to commit my test cases (and only test cases at this point, no functionality changes at all - Lucene works perfectly well for me as is) myself than to submit them as patches. Also, you certainly could expect documentation additions over time as well.

Thanks,
        Erik

p.s. If anyone knows of an existing or in-the-works Ruby implementation, please let me know so I don't reinvent the wheel. Or if you'd like to assist, it'll certainly be open-source.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to