use of org.apache.derby.iapi.services.io.FormatableBitSet in project derby by apache.
the class FormatableBitSetTest method testIntCtor0.
// Test cases for single arg constructor
public void testIntCtor0() {
FormatableBitSet zeroBits = new FormatableBitSet(0);
assertEquals(0, zeroBits.getLength());
assertEquals(0, zeroBits.getLengthInBytes());
assertEquals(0, zeroBits.getNumBitsSet());
assertTrue(zeroBits.invariantHolds());
assertEquals(0, zeroBits.getByteArray().length);
}
use of org.apache.derby.iapi.services.io.FormatableBitSet in project derby by apache.
the class FormatableBitSetTest method testANDWithEmpty.
public void testANDWithEmpty() {
bitset18.and(new FormatableBitSet());
assertEquals(0, bitset18.getNumBitsSet());
assertTrue(bitset18.invariantHolds());
}
use of org.apache.derby.iapi.services.io.FormatableBitSet in project derby by apache.
the class FormatableBitSetTest method numBitsSetInTwoBytes.
// test getNumBitsSet() for a two-byte bit set
public void numBitsSetInTwoBytes() throws Exception {
for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; ++i) {
final byte b1 = (byte) i;
final int bits1 = bitsInByte(b1);
for (int j = Byte.MIN_VALUE; j <= Byte.MAX_VALUE; ++j) {
final byte b2 = (byte) j;
FormatableBitSet bs = new FormatableBitSet(new byte[] { b1, b2 });
assertEquals("invalid bit count for b1=" + b1 + " and b2=" + b2, bits1 + bitsInByte(b2), bs.getNumBitsSet());
}
}
}
use of org.apache.derby.iapi.services.io.FormatableBitSet in project derby by apache.
the class FormatableBitSetTest method testIntCtor1.
public void testIntCtor1() {
FormatableBitSet oneBit = new FormatableBitSet(1);
assertEquals(1, oneBit.getLength());
assertEquals(1, oneBit.getLengthInBytes());
assertEquals(0, oneBit.getNumBitsSet());
assertTrue(oneBit.invariantHolds());
assertEquals(1, oneBit.getByteArray().length);
}
use of org.apache.derby.iapi.services.io.FormatableBitSet in project derby by apache.
the class FormatableBitSetTest method testORWithEmpty.
public void testORWithEmpty() {
FormatableBitSet cpy = new FormatableBitSet(bitset18);
bitset18.or(empty);
assertEquals(9, bitset18.getNumBitsSet());
assertTrue(cpy.equals(bitset18));
assertTrue(bitset18.invariantHolds());
}
Aggregations