lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: svn commit: r1147535 - /lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/TestFixedBitSet.java
Date Sun, 17 Jul 2011 18:08:47 GMT
OK so this was a test-only limitation (good) not a problem w/ FixedBitSet.

I'll add an additional test case to explicitly test the 0 case.

Mike McCandless

http://blog.mikemccandless.com

On Sun, Jul 17, 2011 at 1:22 PM, Shai Erera <serera@gmail.com> wrote:
> 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 <lucene@mikemccandless.com> 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,  <shaie@apache.org> 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: dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: dev-help@lucene.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: dev-help@lucene.apache.org
>
>

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


Mime
View raw message