Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
guarantee that bits is non-null once resize has been called
- Loading branch information
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.zaxxer.sparsebits; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
public class InitWithZeroTest { | ||
private SparseBitSet bitset; | ||
|
||
@Before | ||
public void setup() { | ||
bitset = new SparseBitSet(0); | ||
} | ||
|
||
@Test | ||
public void testPreviousSetBit() { | ||
Assert.assertEquals(-1, bitset.previousSetBit(0)); | ||
} | ||
|
||
@Test | ||
public void testPreviousClearBit() { | ||
Assert.assertEquals(0, bitset.previousClearBit(0)); | ||
} | ||
|
||
@Test | ||
public void testNextSetBit() { | ||
Assert.assertEquals(-1, bitset.nextSetBit(0)); | ||
} | ||
|
||
@Test | ||
public void testNextClearBit() { | ||
Assert.assertEquals(0, bitset.nextClearBit(0)); | ||
} | ||
|
||
@Test | ||
public void testClone() { | ||
Assert.assertEquals(-1, bitset.clone().nextSetBit(0)); | ||
} | ||
|
||
@Test | ||
public void testAnd() { | ||
bitset.and(new SparseBitSet()); | ||
} | ||
} |