Skip to content

Commit

Permalink
HSEARCH-610 add one more test for empty doc id set
Browse files Browse the repository at this point in the history
  • Loading branch information
hferentschik committed Nov 3, 2010
1 parent ba9d660 commit 348e5cf
Showing 1 changed file with 13 additions and 0 deletions.
Expand Up @@ -49,6 +49,7 @@
* as it's useful to test the implementation.
*
* @author Sanne Grinovero
* @author Hardy Ferentschik
* @see AndDocIdSet
* @see BitSet
*/
Expand Down Expand Up @@ -284,6 +285,7 @@ public static boolean docIdSetsEqual(DocIdSet expected, DocIdSet actual) {
}

// HSEARCH-610

public void testWithOpenBitSet() throws IOException {
DocIdSet idSet1 = new OpenBitSet( new long[] { 1121 }, 1 ); // bits 0, 5, 6, 10
DocIdSet idSet2 = new OpenBitSet( new long[] { 64 }, 1 ); // bit 6
Expand All @@ -294,6 +296,7 @@ public void testWithOpenBitSet() throws IOException {
}

// HSEARCH-610

public void testWithDocIdBitSet() throws IOException {
DocIdSet idSet1 = integersToDocIdSet( 0, 5, 6, 10 );
DocIdSet idSet2 = integersToDocIdSet( 6 );
Expand All @@ -304,6 +307,7 @@ public void testWithDocIdBitSet() throws IOException {
}

// HSEARCH-610

public void testWithSortedVIntList() throws IOException {
SortedVIntList idSet1 = new SortedVIntList( 0, 5, 6, 10 );
SortedVIntList idSet2 = new SortedVIntList( 6 );
Expand All @@ -313,6 +317,15 @@ public void testWithSortedVIntList() throws IOException {
assertTrue( docIdSetsEqual( expected, actual ) );
}

public void testEmptyDocIdSet() throws Exception {
DocIdSet idSet1 = new DocIdBitSet( new BitSet() );
DocIdSet idSet2 = integersToDocIdSet( 0, 5, 6, 10 );
DocIdSet actual = createAndDocIdSet( idSet1, idSet2 );

DocIdSet expected = DocIdSet.EMPTY_DOCIDSET;
assertTrue( docIdSetsEqual( expected, actual ) );
}

private AndDocIdSet createAndDocIdSet(DocIdSet... docIdSets) {
List<DocIdSet> list = new ArrayList<DocIdSet>();
list.addAll( Arrays.asList( docIdSets ) );
Expand Down

0 comments on commit 348e5cf

Please sign in to comment.