You mean whether FixedBitSet should throw exc if numBits=0? I don't
think it's very likely that someone will use it?

But you're right - it's not invalid to create a 0-length bitset, even
if not very useful.

Shai

On Sunday, July 17, 2011, Michael McCandless <[email protected]> wrote:
> Is it just the test that has a problem w/ numBits == 0?
>
> I think it should be fine to create a 0-length bitset.  It's just that
> you can't then use it :)
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
> On Sun, Jul 17, 2011 at 2:01 AM,  <[email protected]> wrote:
>> Author: shaie
>> Date: Sun Jul 17 06:01:02 2011
>> New Revision: 1147535
>>
>> URL: http://svn.apache.org/viewvc?rev=1147535&view=rev
>> Log:
>> random.nextInt does not take '0' as a valid argument, so ensure numBits is 
>> never 0
>>
>> Modified:
>>    
>> lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/TestFixedBitSet.java
>>
>> Modified: 
>> lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/TestFixedBitSet.java
>> URL: 
>> http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/TestFixedBitSet.java?rev=1147535&r1=1147534&r2=1147535&view=diff
>> ==============================================================================
>> --- 
>> lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/TestFixedBitSet.java
>>  (original)
>> +++ 
>> lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/TestFixedBitSet.java
>>  Sun Jul 17 06:01:02 2011
>> @@ -197,7 +197,7 @@ public class TestFixedBitSet extends Luc
>>   */
>>
>>   public void testEquals() {
>> -    final int numBits = random.nextInt(2000);
>> +    final int numBits = random.nextInt(2000) + 1 /* numBits cannot be 0 */;
>>     FixedBitSet b1 = new FixedBitSet(numBits);
>>     FixedBitSet b2 = new FixedBitSet(numBits);
>>     assertTrue(b1.equals(b2));
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to