You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "uschindler (via GitHub)" <gi...@apache.org> on 2023/02/06 23:27:00 UTC

[GitHub] [lucene] uschindler commented on pull request #12134: Add tests for size() and contains() to LongHashSet

uschindler commented on PR #12134:
URL: https://github.com/apache/lucene/pull/12134#issuecomment-1419932992

   I found a bug, first test works, second one does not work:
   
   ```java
     public void testSameValue() {
       LongHashSet set2 = new LongHashSet(new long[] {42L, 42L});
       assertEquals(1, set2.size());
       assertEquals(42L, set2.minValue);
       assertEquals(42L, set2.maxValue);
     }
   
     public void testSameMissingPlaceholder() {
       LongHashSet set2 = new LongHashSet(new long[] {Long.MIN_VALUE, Long.MIN_VALUE});
       assertEquals(1, set2.size());
       assertEquals(Long.MIN_VALUE, set2.minValue);
       assertEquals(Long.MIN_VALUE, set2.maxValue);
     }
   ```
   
   The problem is that `MISSING` is counted twice, because it is not added to the hashtable and handled separately in ctor. The fix is easy...
   
   Will commit a fix, too.


-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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