You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Erik Hatcher <li...@ehatchersolutions.com> on 2003/07/19 01:09:54 UTC

tests cases, Ruby, commitership

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: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Re: tests cases, Ruby, commitership

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Hello Erik,

No, I don't think there are any such low-level tests.  It would be good
to have them.  If you write a solid suite of such tests, perhaps they
could be molded into a utility for checking index integrity.

As for your access to Lucene CVS - hello no!  Just kidding, of course,
I think that would be appropriate.  We'll do one of those [VOTE] things
:)

Otis


--- Erik Hatcher <li...@ehatchersolutions.com> wrote:
> 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: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org